From 71fb97fdac7ff371694e1d22c205af49d3babf0e Mon Sep 17 00:00:00 2001 From: SeldomseenSchweig Date: Fri, 3 Nov 2023 09:14:29 -0700 Subject: [PATCH] pulled, changed navbar to not have any errors --- src/components/navbar/NavBar.tsx | 165 +++++++++++++++++------- src/components/navbar/Navbar.module.css | 2 - 2 files changed, 115 insertions(+), 52 deletions(-) diff --git a/src/components/navbar/NavBar.tsx b/src/components/navbar/NavBar.tsx index 18b8f653..9d7093cd 100644 --- a/src/components/navbar/NavBar.tsx +++ b/src/components/navbar/NavBar.tsx @@ -18,64 +18,129 @@ import Link from "next/link"; import * as React from "react"; import { MouseEventHandler } from "react"; import $navbar from "./Navbar.module.css"; -import Link from "next/link"; -import Image from "next/image"; -import { - PeopleOutline, - CoPresent, - Settings, - Logout, -} from "@mui/icons-material"; -import { signOut } from "next-auth/react"; -import { useSession } from "next-auth/react"; -const NavBar = () => { +interface NavItemProps { + href?: string; + icon: React.ReactNode; + text: string; + onClick?: MouseEventHandler; +} + +export default function NavBar() { + const [mobileOpen, setMobileOpen] = React.useState(false); + const desktop = useMediaQuery("(min-width: 992px)"); + const { status } = useSession(); + const handleDrawerToggle = () => { + setMobileOpen(!mobileOpen); + }; + + const logo = ( + + logo + + ); + + const ToolbarMenu = ({ name }: { name: React.ReactNode }) => ( + + {logo} + + {name} + + + ); + + const NavItem = ({ href, icon, text, onClick }: NavItemProps) => ( + + + {icon} +

+ {text} +

+ +
+ ); + + const drawer = ( +
+ + } text="Students" /> + } text="Staff" /> + } text="Settings" /> + } + text="Logout" + onClick={() => signOut({ callbackUrl: "/" })} + /> + +
+ ); + return ( <> {status === "authenticated" && ( - + {/* Modal for sidebar when screen is <= md size */} + + } + /> + {drawer} + + )} ); -}; +} diff --git a/src/components/navbar/Navbar.module.css b/src/components/navbar/Navbar.module.css index 74f732be..ca7685ef 100644 --- a/src/components/navbar/Navbar.module.css +++ b/src/components/navbar/Navbar.module.css @@ -16,7 +16,6 @@ .linkItem { padding: 1.25rem 0 1.25rem calc(45% - 1.5rem * 1.5); } - .link { color: var(--on-primary); text-decoration: none; @@ -34,7 +33,6 @@ .burger { color: var(--primary-99); } - @media (min-width: 992px) { .linkItem { padding-left: 9%;