diff --git a/client/src/Header.tsx b/client/src/Header.tsx index 88df0d9..e350113 100644 --- a/client/src/Header.tsx +++ b/client/src/Header.tsx @@ -1,93 +1,169 @@ -import { AppBar, Button, ButtonGroup, Grid, Link, Typography } from "@mui/material"; +import { + AppBar, + Button, + ButtonGroup, + Grid, + Link, + Typography, +} from "@mui/material"; import Box from "@mui/material/Box"; -import AcUnitIcon from '@mui/icons-material/AcUnit'; +import AcUnitIcon from "@mui/icons-material/AcUnit"; import { cyan } from "@mui/material/colors"; import { useContext } from "react"; import { LoginContext } from "./Context"; -import AccountCircleIcon from '@mui/icons-material/AccountCircle'; -import HomeIcon from '@mui/icons-material/Home'; -import PostAddIcon from '@mui/icons-material/PostAdd'; +import AccountCircleIcon from "@mui/icons-material/AccountCircle"; +import HomeIcon from "@mui/icons-material/Home"; +import PostAddIcon from "@mui/icons-material/PostAdd"; function LoginDisplay({ sx }: { sx?: React.CSSProperties }): JSX.Element { - const loginCtx = useContext(LoginContext); + const loginCtx = useContext(LoginContext); - const handleLogin = (): void => { - console.log("Login button pressed") - if (loginCtx.currentUser == undefined) { - loginCtx.setOpen?.(true); // If the loginCtx.setOpen is defined, call it with true as the argument - } else { - loginCtx.setCurrentUser?.(""); - loginCtx.setUserToken?.(""); - } - } - - if (loginCtx.currentUser != undefined) { - return ( - - - Logged in as: - - - handleLogin()}> - {loginCtx.currentUser} - - - - ) + const handleLogin = (): void => { + console.log("Login button pressed"); + if (loginCtx.currentUser == undefined) { + loginCtx.setOpen?.(true); // If the loginCtx.setOpen is defined, call it with true as the argument + } else { + loginCtx.setCurrentUser?.(""); + loginCtx.setUserToken?.(""); } + }; + if (loginCtx.currentUser != undefined) { return ( - - - - ) + + + Logged in as: + + + handleLogin()}> + {loginCtx.currentUser} + + + + ); + } + + return ( + + + + ); } function Header({ sx }: { sx?: React.CSSProperties }): JSX.Element { - return ( - - - - - - - ) + return ( + + + + + + + + + + + + + + ); } -function HeaderLogo({ clickable, sx }: { clickable?: boolean, sx?: React.CSSProperties }): JSX.Element { - const clickStyle = { - transition: "0.3s all ease-in-out", - ":hover": { textShadow: "0 0px 15px" + cyan[400] } - } +function HeaderLogo({ + clickable, + sx, +}: { + clickable?: boolean; + sx?: React.CSSProperties; +}): JSX.Element { + const clickStyle = { + transition: "0.3s all ease-in-out", + ":hover": { textShadow: "0 0px 15px" + cyan[400] }, + }; - return ( - - - FrostByte - - ) + return ( + + + + FrostByte + + + ); } function NavButtons({ sx }: { sx?: React.CSSProperties }): JSX.Element { - return ( - - - {["Home", "New"].map((typename): JSX.Element => { - return ( - - ) - })} - - ) + return ( + + + {["Home", "New"].map((typename): JSX.Element => { + return ( + + ); + })} + + + ); } -export default Header; \ No newline at end of file +export default Header;