I'm searching for the clean way to adapt the offset of the content behind the Material-UI AppBar.
I assumed that theme.mixins.toolbar would adapt automatically but it's not the case.
(Using theme density prop as described here => https://material-ui.com/customization/density/ is not working neither)
export default props => {
const classes = useStyles();
return (
<>
<AppBar position="fixed" >
<Toolbar variant="dense">
<IconButton edge="start" className={classes.menuButton} aria-label="menu">
<MenuIcon color="secondary"/>
</IconButton>
<Typography variant="h7" className={classes.title}>
My Title
</Typography>
</Toolbar>
</AppBar>
<div className={classes.offset} />
<Container >
{props.children}
</Container>
</>
);
}
const useStyles = makeStyles(theme => ({
root: {
flexGrow: 1,
},
menuButton: {
marginRight: theme.spacing(2),
},
title: {
flexGrow: 1,
},
offset: theme.mixins.toolbar
}));