How do i make the link.name which belongs to the current page the user is on have className text-accent: import Link from "next/link";
import { usePathname } from "next/navigation";
import React, { useState } from 'react';
import { GrBusinessService } from "react-icons/gr";
import { BsPersonWorkspace } from "react-icons/bs";
import { HiHomeModern } from "react-icons/hi2";
import { SiAffinitydesigner } from "react-icons/si";
import { BsFillChatLeftHeartFill } from "react-icons/bs";
import { GrMail } from "react-icons/gr";
export const navData = [
{ name: "home", path: "/", Icon: HiHomeModern },
{ name: "about", path: "/about", Icon: BsPersonWorkspace },
{ name: "services", path: "/services", Icon: GrBusinessService },
{ name: "designs", path: "/designs", Icon: SiAffinitydesigner },
{ name: "testimonials", path: "/testimonials", Icon: BsFillChatLeftHeartFill },
{ name: "contact", path: "/contact", Icon: GrMail },
];
const MobileNav = () => {
const pathname = usePathname();
const [isNavVisible, setIsNavVisible] = useState(false);
const toggleNav = () => {
setIsNavVisible(!isNavVisible);
};
return (
<>
<button
className="hamburger-btn" // Add your styles or classes here
onClick={toggleNav} // Attach the toggle function
aria-label="Toggle navigation"
>
<span className={hamburger-line first ${isNavVisible ? 'toggled' : ''}}>
<span className={hamburger-line second ${isNavVisible ? 'toggled' : ''}}>
<span className={hamburger-line third ${isNavVisible ? 'toggled' : ''}}>
<nav className={flex flex-col items-left gap-y-4 mb-0 py-6 px-12 bg-matte border border-accent rounded-3xl w-60 fixed top-1/4 left-1/2 -translate-x-1/2 -translate-y-1/2 ${isNavVisible ? 'visible' : 'hidden'}}>
{navData.map((link, i) => (
<Link
className={${link.path === pathname && "text-accent"} relative flex items-center group hover:text-accent transition-all duration-300}
href={link.path}
key={i}
>
<link.Icon className="text-lg" aria-hidden />
{link.name}
))}
</>
);
};
export default MobileNav;