Advertisement
SpykeRel04D

Untitled

Jul 22nd, 2020
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. import React from 'react';
  2. import { makeStyles } from '@material-ui/core/styles';
  3. import AppBar from '@material-ui/core/AppBar';
  4. import Toolbar from '@material-ui/core/Toolbar';
  5. import Typography from '@material-ui/core/Typography';
  6. import Button from '@material-ui/core/Button';
  7. import IconButton from '@material-ui/core/IconButton';
  8. import MenuIcon from '@material-ui/icons/Menu';
  9. import { getUser, removeUserSession } from '../Utils/Common';
  10.  
  11. const useStyles = makeStyles((theme) => ({
  12. root: {
  13. flexGrow: 1,
  14. background: "#90caf9"
  15. },
  16. menuButton: {
  17. marginRight: theme.spacing(2),
  18. },
  19. title: {
  20. flexGrow: 1,
  21. },
  22. topBar: {
  23. background: "#90caf9"
  24. }
  25. }));
  26.  
  27. function Menu(props) {
  28. const classes = useStyles();
  29. const user = getUser();
  30.  
  31. const handleLogout = () => {
  32. removeUserSession();
  33. props.history.push('/');
  34. };
  35.  
  36. const handleBurger = () => {
  37.  
  38. };
  39.  
  40. return(
  41. <div>
  42. <div className={classes.root}>
  43. <AppBar className={classes.topBar} position="static">
  44. <Toolbar>
  45. <IconButton edge="start" className={classes.menuButton} color="inherit" aria-label="menu" onClick={handleBurger}>
  46. <MenuIcon />
  47. </IconButton>
  48. <Typography variant="h6" className={classes.title}>
  49. {user.username}
  50. </Typography>
  51. <Button color="inherit" onClick={handleLogout}>Logout</Button>
  52. </Toolbar>
  53. </AppBar>
  54. </div>
  55. </div>
  56. );
  57. }
  58.  
  59. export default Menu;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement