Fix app header

This commit is contained in:
dominik-zeglen 2020-09-10 17:11:36 +02:00
parent b1623eaaf5
commit ed3d168d22
2 changed files with 21 additions and 32 deletions

View file

@ -34,7 +34,7 @@ const useStyles = makeStyles(
marginTop: theme.spacing(0.5), marginTop: theme.spacing(0.5),
transition: theme.transitions.duration.standard + "ms", transition: theme.transitions.duration.standard + "ms",
[theme.breakpoints.down("sm")]: { [theme.breakpoints.down("sm")]: {
display: "none" margin: theme.spacing(4, 0, 3, 0)
} }
}, },
skeleton: { skeleton: {
@ -45,10 +45,7 @@ const useStyles = makeStyles(
color: "inherit", color: "inherit",
flex: 1, flex: 1,
marginLeft: theme.spacing(), marginLeft: theme.spacing(),
textTransform: "uppercase", textTransform: "uppercase"
[theme.breakpoints.down("sm")]: {
display: "none"
}
} }
}), }),
{ name: "AppHeader" } { name: "AppHeader" }

View file

@ -2,6 +2,7 @@ import Avatar from "@material-ui/core/Avatar";
import Chip from "@material-ui/core/Chip"; import Chip from "@material-ui/core/Chip";
import ClickAwayListener from "@material-ui/core/ClickAwayListener"; import ClickAwayListener from "@material-ui/core/ClickAwayListener";
import Grow from "@material-ui/core/Grow"; import Grow from "@material-ui/core/Grow";
import Hidden from "@material-ui/core/Hidden";
import LinearProgress from "@material-ui/core/LinearProgress"; import LinearProgress from "@material-ui/core/LinearProgress";
import MenuItem from "@material-ui/core/MenuItem"; import MenuItem from "@material-ui/core/MenuItem";
import Menu from "@material-ui/core/MenuList"; import Menu from "@material-ui/core/MenuList";
@ -67,30 +68,18 @@ const useStyles = makeStyles(
}, },
darkThemeSwitch: { darkThemeSwitch: {
[theme.breakpoints.down("sm")]: { [theme.breakpoints.down("sm")]: {
marginRight: -theme.spacing(1.5) marginRight: theme.spacing(1)
}, },
marginRight: theme.spacing(2) marginRight: theme.spacing(2)
}, },
header: { header: {
[theme.breakpoints.down("sm")]: { [theme.breakpoints.down("sm")]: {
height: 88, height: "auto"
marginBottom: 0
}, },
display: "flex", display: "flex",
height: 40, height: 40,
marginBottom: theme.spacing(3) marginBottom: theme.spacing(3)
}, },
menu: {
background: theme.palette.background.paper,
height: "100vh",
padding: "25px 20px"
},
menuSmall: {
background: theme.palette.background.paper,
height: "100vh",
overflow: "hidden",
padding: 25
},
popover: { popover: {
zIndex: 1 zIndex: 1
}, },
@ -105,11 +94,6 @@ const useStyles = makeStyles(
flex: 1 flex: 1
}, },
userBar: { userBar: {
[theme.breakpoints.down("sm")]: {
alignItems: "flex-end",
flexDirection: "column-reverse",
overflow: "hidden"
},
alignItems: "center", alignItems: "center",
display: "flex" display: "flex"
}, },
@ -204,13 +188,15 @@ const AppLayout: React.FC<AppLayoutProps> = ({ children }) => {
<AppHeaderContext.Provider value={appHeaderAnchor}> <AppHeaderContext.Provider value={appHeaderAnchor}>
<AppActionContext.Provider value={appActionAnchor}> <AppActionContext.Provider value={appActionAnchor}>
<div className={classes.root}> <div className={classes.root}>
<SideBar <Hidden smDown>
menuItems={menuStructure} <SideBar
location={location.pathname} menuItems={menuStructure}
user={user} location={location.pathname}
renderConfigure={renderConfigure} user={user}
onMenuItemClick={navigate} renderConfigure={renderConfigure}
/> onMenuItemClick={navigate}
/>
</Hidden>
<div className={classes.content}> <div className={classes.content}>
{appState.loading ? ( {appState.loading ? (
<LinearProgress className={classes.appLoader} color="primary" /> <LinearProgress className={classes.appLoader} color="primary" />
@ -221,7 +207,10 @@ const AppLayout: React.FC<AppLayoutProps> = ({ children }) => {
<div> <div>
<Container> <Container>
<div className={classes.header}> <div className={classes.header}>
<div ref={appHeaderAnchor} /> <Hidden smDown>
<div ref={appHeaderAnchor} />
</Hidden>
<Hidden mdUp>=</Hidden>
<div className={classes.spacer} /> <div className={classes.spacer} />
<div className={classes.userBar}> <div className={classes.userBar}>
<ThemeSwitch <ThemeSwitch
@ -311,6 +300,9 @@ const AppLayout: React.FC<AppLayoutProps> = ({ children }) => {
</div> </div>
</div> </div>
</div> </div>
<Hidden mdUp>
<div ref={appHeaderAnchor} />
</Hidden>
</Container> </Container>
</div> </div>
<main className={classes.view}> <main className={classes.view}>