-
Notifications
You must be signed in to change notification settings - Fork 0
/
Header.js
64 lines (59 loc) · 1.73 KB
/
Header.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import AppBar from "@material-ui/core/AppBar";
import Toolbar from "@material-ui/core/Toolbar";
import Typography from "@material-ui/core/Typography";
import { makeStyles } from "@material-ui/core/styles";
import { Action, Image, Link, SideDrawer } from ".";
import { Container, Hidden } from "@material-ui/core";
const useStyles = makeStyles((theme) => ({
root: {
flexGrow: 1,
},
logo: {
width: "200px",
},
mainMenu: {
flexGrow: 1,
display: "flex",
justifyContent: "flex-end",
"& a": {
margin: theme.spacing(1),
}
}
}));
function Header({ asset, title, mainMenuActions }) {
const classes = useStyles();
return (
<div className={classes.root}>
<AppBar color="transparent" position="sticky">
<Container>
<Toolbar>
<Link href='/' className={classes.logo}>
{asset
? <Image
asset={asset}
src={asset.url}
alt={title}
width="200"
height="60"
/>
: <Typography variant="h6">{title}</Typography>
}
</Link>
<Hidden smDown>
<div className={classes.mainMenu}>
{mainMenuActions.map((navigationItem, index) =>
<Action key={index} action={navigationItem} />)}
</div>
</Hidden>
<Hidden mdUp>
<div className={classes.mainMenu}>
<SideDrawer navLinks={mainMenuActions}/>
</div>
</Hidden>
</Toolbar>
</Container>
</AppBar>
</div >
);
}
export default Header;