frontend/smart-hut/src/components/Header.js

79 lines
1.9 KiB
JavaScript
Raw Normal View History

2020-05-12 13:18:33 +00:00
import React from 'react';
import PropTypes from 'prop-types';
import { makeStyles } from '@material-ui/core/styles';
import Toolbar from '@material-ui/core/Toolbar';
import Button from '@material-ui/core/Button';
import IconButton from '@material-ui/core/IconButton';
import SearchIcon from '@material-ui/icons/Search';
import Typography from '@material-ui/core/Typography';
import Link from '@material-ui/core/Link';
2020-03-23 20:24:17 +00:00
const useStyles = makeStyles((theme) => ({
toolbar: {
borderBottom: `1px solid ${theme.palette.divider}`,
},
toolbarTitle: {
flex: 1,
},
toolbarSecondary: {
2020-05-12 13:18:33 +00:00
justifyContent: 'space-between',
overflowX: 'auto',
2020-03-23 20:24:17 +00:00
},
toolbarLink: {
padding: theme.spacing(1),
flexShrink: 0,
},
}));
export default function Header(props) {
2020-03-23 20:24:17 +00:00
const classes = useStyles();
const { sections, title } = props;
2020-03-23 20:24:17 +00:00
return (
2020-05-12 13:18:33 +00:00
<>
2020-03-23 20:24:17 +00:00
<Toolbar className={classes.toolbar}>
<Typography
component="h2"
variant="h5"
color="inherit"
align="center"
noWrap
className={classes.toolbarTitle}
>
{title}
</Typography>
<Toolbar
component="nav"
variant="dense"
className={classes.toolbarSecondary}
>
{sections.map((section) => (
<Link
color="inherit"
noWrap
key={section.title}
variant="body2"
href={section.url}
className={classes.toolbarLink}
>
{section.title}
</Link>
))}
</Toolbar>
2020-05-12 13:18:33 +00:00
<Button size="small" variant="outlined" style={{ margin: '0 1rem' }}>
2020-03-23 20:24:17 +00:00
Login
</Button>
2020-03-23 20:24:17 +00:00
<Button variant="outlined" size="small">
Sign up
</Button>
</Toolbar>
2020-05-12 13:18:33 +00:00
</>
2020-03-23 20:24:17 +00:00
);
}
Header.propTypes = {
2020-03-23 20:24:17 +00:00
sections: PropTypes.array,
title: PropTypes.string,
};