Theme: add a class to indicate if in dark mode.

master
Tom Hacohen 4 years ago
parent fd0a83d6a2
commit f80ce5b458

@ -182,13 +182,14 @@ class App extends React.PureComponent {
public render() { public render() {
const credentials = this.props.credentials ?? null; const credentials = this.props.credentials ?? null;
const { darkMode } = this.props;
const errors = this.props.errors; const errors = this.props.errors;
const fetching = this.props.fetchCount > 0; const fetching = this.props.fetchCount > 0;
const muiTheme = createMuiTheme({ const muiTheme = createMuiTheme({
palette: { palette: {
type: this.props.darkMode ? 'dark' : undefined, type: darkMode ? 'dark' : undefined,
primary: amber, primary: amber,
secondary: { secondary: {
light: lightBlue.A200, light: lightBlue.A200,
@ -210,7 +211,7 @@ class App extends React.PureComponent {
return ( return (
<ThemeProvider theme={muiTheme}> <ThemeProvider theme={muiTheme}>
<BrowserRouter> <BrowserRouter>
<div style={styles.main}> <div style={styles.main} className={darkMode ? 'theme-dark' : 'theme-light'}>
<AppBarWitHistory <AppBarWitHistory
toggleDrawerIcon={<IconButton onClick={this.toggleDrawer}><NavigationMenu /></IconButton>} toggleDrawerIcon={<IconButton onClick={this.toggleDrawer}><NavigationMenu /></IconButton>}
iconElementRight={ iconElementRight={

Loading…
Cancel
Save