|
| 1 | +import React from 'react'; |
| 2 | +import PropTypes from 'prop-types'; |
| 3 | +import AppBar from '@material-ui/core/AppBar'; |
| 4 | +import Grid from '@material-ui/core/Grid'; |
| 5 | +import Hidden from '@material-ui/core/Hidden'; |
| 6 | +import IconButton from '@material-ui/core/IconButton'; |
| 7 | +import MenuIcon from '@material-ui/icons/Menu'; |
| 8 | +import Toolbar from '@material-ui/core/Toolbar'; |
| 9 | +import { withStyles } from '@material-ui/core/styles'; |
| 10 | + |
| 11 | +const lightColor = 'rgba(255, 255, 255, 0.7)'; |
| 12 | + |
| 13 | +const styles = (theme) => ({ |
| 14 | + secondaryBar: { |
| 15 | + zIndex: 0, |
| 16 | + }, |
| 17 | + menuButton: { |
| 18 | + marginLeft: -theme.spacing(1), |
| 19 | + }, |
| 20 | + iconButtonAvatar: { |
| 21 | + padding: 4, |
| 22 | + }, |
| 23 | + link: { |
| 24 | + textDecoration: 'none', |
| 25 | + color: lightColor, |
| 26 | + '&:hover': { |
| 27 | + color: theme.palette.common.white, |
| 28 | + }, |
| 29 | + }, |
| 30 | + button: { |
| 31 | + borderColor: lightColor, |
| 32 | + }, |
| 33 | +}); |
| 34 | + |
| 35 | +function Header(props) { |
| 36 | + const { classes, onDrawerToggle } = props; |
| 37 | + |
| 38 | + return ( |
| 39 | + <React.Fragment> |
| 40 | + <AppBar color="primary" position="sticky" elevation={0}> |
| 41 | + <Toolbar> |
| 42 | + <Grid container spacing={1} alignItems="center"> |
| 43 | + <Hidden smUp> |
| 44 | + <Grid item> |
| 45 | + <IconButton |
| 46 | + color="inherit" |
| 47 | + aria-label="open drawer" |
| 48 | + onClick={onDrawerToggle} |
| 49 | + className={classes.menuButton} |
| 50 | + > |
| 51 | + <MenuIcon /> |
| 52 | + </IconButton> |
| 53 | + </Grid> |
| 54 | + </Hidden> |
| 55 | + </Grid> |
| 56 | + </Toolbar> |
| 57 | + </AppBar> |
| 58 | + </React.Fragment> |
| 59 | + ); |
| 60 | +} |
| 61 | + |
| 62 | +Header.propTypes = { |
| 63 | + classes: PropTypes.object.isRequired, |
| 64 | + onDrawerToggle: PropTypes.func.isRequired, |
| 65 | +}; |
| 66 | + |
| 67 | +export default withStyles(styles)(Header); |
0 commit comments