Skip to content

Commit 65504a5

Browse files
committed
hide navbar when route has been changed
1 parent fbb1e38 commit 65504a5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app/components/Navbar.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22

33
import Image from "next/image"
44
import Link from "next/link"
5+
import { usePathname } from "next/navigation"
56
import DevshLogo from "@/public/devsh_transparent_1920.png"
6-
import { ReactNode, useState } from "react"
7+
import { ReactNode, useEffect, useState } from "react"
78
import { motion } from "framer-motion"
89

910
type Link = {
@@ -37,6 +38,11 @@ function NavbarLink({children, href, onClick}: {children: ReactNode, href: strin
3738

3839
export default function Navbar() {
3940
const [isDropdownEnabled, setIsDropdownEnabled] = useState(false);
41+
const pathname = usePathname()
42+
43+
useEffect(() => {
44+
setIsDropdownEnabled(!isDropdownEnabled)
45+
}, [pathname])
4046

4147
return (
4248
<nav className="sticky top-0 border-b border-[#181818] bg-black z-40">

0 commit comments

Comments
 (0)