Custom name with admin image on vacation

I use admin-on-rest to create our next panel. I would like to be able to add a logo / image in the title before the title. Will this include a custom theme, or is there a less invasive way to do this?

+4
source share
1 answer

I found the answer to this question and thought that I would share it with stackoverflow for the next developer facing this question.

titleprop <Admin />does not accept node. So this works:

import {Admin} from 'admin-on-rest';

const App = () => (
  <Admin title={<AppTitle />}>
    // Resources
  </Admin>
);

// Default styles
const appTitleStyles = {
  whiteSpace        : 'nowrap',
  overflow          : 'hidden',
  WebkitTextOverflow: 'ellipsis',
  textOverflow      : 'ellipsis',
  margin            : 0,
  letterSpacing     : 0,
  fontSize          : 24,
  fontWeight        : '400',
  color             : 'rgb(255, 255, 255)',
  height            : 44,
  paddingTop        : 10,
  paddingBottom     : 10,
  WebkitFlex        : '1 1 0%',
  MsFlex            : '1 1 0%',
  flex              : '1 1 0%'
};

const AppTitle = () => (
  <img style={appTitleStyles} src="./my-cool-logo.png" />
);

export default App;
+3
source

Source: https://habr.com/ru/post/1684603/


All Articles