Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React from 'react';
- import { makeStyles } from '@material-ui/core/styles';
- import AppBar from '@material-ui/core/AppBar';
- import Toolbar from '@material-ui/core/Toolbar';
- import Typography from '@material-ui/core/Typography';
- import Button from '@material-ui/core/Button';
- import IconButton from '@material-ui/core/IconButton';
- import MenuIcon from '@material-ui/icons/Menu';
- import { getUser, removeUserSession } from '../Utils/Common';
- const useStyles = makeStyles((theme) => ({
- root: {
- flexGrow: 1,
- background: "#90caf9"
- },
- menuButton: {
- marginRight: theme.spacing(2),
- },
- title: {
- flexGrow: 1,
- },
- topBar: {
- background: "#90caf9"
- }
- }));
- function Menu(props) {
- const classes = useStyles();
- const user = getUser();
- const handleLogout = () => {
- removeUserSession();
- props.history.push('/');
- };
- const handleBurger = () => {
- };
- return(
- <div>
- <div className={classes.root}>
- <AppBar className={classes.topBar} position="static">
- <Toolbar>
- <IconButton edge="start" className={classes.menuButton} color="inherit" aria-label="menu" onClick={handleBurger}>
- <MenuIcon />
- </IconButton>
- <Typography variant="h6" className={classes.title}>
- {user.username}
- </Typography>
- <Button color="inherit" onClick={handleLogout}>Logout</Button>
- </Toolbar>
- </AppBar>
- </div>
- </div>
- );
- }
- export default Menu;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement