diff --git a/Website/app/Header.js b/Website/app/Header.js index 022c8ce2..a9603be8 100644 --- a/Website/app/Header.js +++ b/Website/app/Header.js @@ -5,19 +5,26 @@ import { useState } from "react"; import Link from "next/link"; import { useCallback, useEffect } from "react"; -function NavLink({ to, children, cn }) { +function handleNavLinkClick(to, setOpen) { + if (window.location.pathname === to) { + setOpen(false); + } else { + window.location.href = to; + } +} + +function NavLink({ to, children, cn, setOpen }) { return ( - handleNavLinkClick(to, setOpen)} className={`text-gray-900 hover:text-black ${cn}`} > {children} - + ); } -function MobileNav({ open }) { +function MobileNav({ open, setOpen }) { return (
- {/* Logo container */}
- {/* Mobile Nav */}
- + About - + Download - + Contact - {/* Social Icons */}
{ - // add event listener to window window.addEventListener("scroll", onScroll, { passive: true }); - // remove event listener on unmount to prevent memory leaks return () => { window.removeEventListener("scroll", onScroll); }; @@ -128,7 +133,6 @@ export default function Header({ props }) { }} role={"button"} > - {/* hamburger button */}
- {/* NAVBAR BUTTONS */}
- - + + HOME - - + + ABOUT - - + + DOWNLOAD - - + + CONTACT ); -} +} \ No newline at end of file