Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. import React, { Fragment, useState } from 'react';
  2. import { Grid, AppBar, Button, Fab } from '@material-ui/core'
  3. import { Link } from 'react-router-dom';
  4. import * as ROUTES from '../../routes/route';
  5. import { makeStyles } from '@material-ui/core/styles';
  6. import HomeIcon from '@material-ui/icons/Home';
  7.  
  8. const cssStyles = makeStyles(theme => ({
  9. appbar: {
  10. paddingLeft: "20px",
  11. },
  12. fab: {
  13. background: 'linear-gradient(45deg, #FE6B8B 30%, #FF8E53 90%)',
  14. borderRadius: 50,
  15. border: 0,
  16. color: 'white',
  17. height: 48,
  18. padding: '0 30px',
  19. boxShadow: '0 3px 5px 2px rgba(255, 105, 135, .3)',
  20. }
  21.  
  22. }));
  23.  
  24. function Header(props) {
  25. const [loginStatus, setLoginStatus] = useState(false);
  26.  
  27. // ! TODO: Somehow figure out how to work with state here
  28.  
  29. const useStyle = cssStyles();
  30. const LoggedOut = () => {
  31. return (
  32. <Fragment>
  33. <Grid item md={1} style={{ marginLeft: "auto" }}>
  34. <Link to={ROUTES.LOGIN} style={{ textDecoration: "none" }}>
  35. <Button className={useStyle.fab}>Login</Button>
  36. </Link>
  37. </Grid>
  38. <Grid item md={1} style={{ marginLeft: "20px" }} >
  39. <Link to={ROUTES.REGISTER} style={{ textDecoration: "none", color: "white" }}>
  40. <Button color="inherit">Register</Button>
  41. </Link>
  42. </Grid>
  43. </Fragment>
  44. )}
  45.  
  46. const LoggedIn = ()=> {
  47. // TODO
  48. }
  49.  
  50. return (
  51. <Fragment>
  52. <AppBar color="primary" position="static" className={useStyle.appbar}>
  53. <Grid
  54. container
  55. direction="row"
  56. justify="flex-start"
  57. alignItems="center"
  58. >
  59. <Grid item md={1}>
  60. <Link to={ROUTES.HOME}>
  61. <img src={process.env.PUBLIC_URL + '/lines.ico'} width="50px" height="50px" />
  62. </Link>
  63. </Grid>
  64. {(loginStatus=== true)? <LoggedIn/>: <LoggedOut/>}
  65. </Grid>
  66. </AppBar>
  67. </Fragment>
  68. )
  69. }
  70.  
  71.  
  72.  
  73. export default Header;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement