File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { cn } from "@/lib/utils";
66import { NavItem } from "@/types/nav" ;
77import Image from "next/image" ;
88import Link from "next/link" ;
9+ import { usePathname } from 'next/navigation' ;
910import { useEffect , useRef , useState } from "react" ;
1011import { BiMenuAltRight } from "react-icons/bi" ;
1112import { MdOutlineClose } from "react-icons/md" ;
@@ -19,6 +20,7 @@ interface MainNavProps {
1920export function MainNav ( { items } : MainNavProps ) {
2021 const [ toggle , setToggle ] = useState < boolean > ( false ) ;
2122 const menuRef = useRef < HTMLDivElement > ( null ) ;
23+ const pathname = usePathname ( ) ;
2224
2325 useEffect ( ( ) => {
2426 if ( ! toggle ) return ;
@@ -77,7 +79,8 @@ export function MainNav({ items }: MainNavProps) {
7779 href = { item . href }
7880 className = { cn (
7981 "flex items-center whitespace-nowrap text-xl font-semibold sm:text-sm" ,
80- item . disabled && "cursor-not-allowed opacity-80"
82+ item . disabled && "cursor-not-allowed opacity-80" ,
83+ ( item . href === pathname ) && "text-purple-600"
8184 ) }
8285 >
8386 { item . title }
You can’t perform that action at this time.
0 commit comments