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";
6
6
import { NavItem } from "@/types/nav" ;
7
7
import Image from "next/image" ;
8
8
import Link from "next/link" ;
9
+ import { usePathname } from 'next/navigation' ;
9
10
import { useEffect , useRef , useState } from "react" ;
10
11
import { BiMenuAltRight } from "react-icons/bi" ;
11
12
import { MdOutlineClose } from "react-icons/md" ;
@@ -19,6 +20,7 @@ interface MainNavProps {
19
20
export function MainNav ( { items } : MainNavProps ) {
20
21
const [ toggle , setToggle ] = useState < boolean > ( false ) ;
21
22
const menuRef = useRef < HTMLDivElement > ( null ) ;
23
+ const pathname = usePathname ( ) ;
22
24
23
25
useEffect ( ( ) => {
24
26
if ( ! toggle ) return ;
@@ -77,7 +79,8 @@ export function MainNav({ items }: MainNavProps) {
77
79
href = { item . href }
78
80
className = { cn (
79
81
"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"
81
84
) }
82
85
>
83
86
{ item . title }
You can’t perform that action at this time.
0 commit comments