blob: fbbd37a137671148d6d0bdbd269b32ba3eb9102d (
plain)
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
|
import React from 'react';
import { AppBar, Toolbar, useScrollTrigger, Slide } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
interface PropTypes {
menu: JSX.Element;
logo: JSX.Element;
search: JSX.Element;
}
const useStyles = makeStyles(theme => ({
root: {
display: 'flex',
justifyContent: 'space-between',
},
}));
const MobileHeader: React.FC<PropTypes> = React.memo(props => {
const classes = useStyles();
const trigger = useScrollTrigger();
const { menu, search, logo } = props;
return (
<Slide appear={false} direction="down" in={!trigger}>
<AppBar position="fixed">
<Toolbar className={classes.root}>
{menu}
{logo}
{search}
</Toolbar>
</AppBar>
</Slide>
);
});
export default MobileHeader;
|