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 (