refactor: enhance link active state handling in Navbar and HamburgerMenu components
This commit is contained in:
@@ -28,8 +28,15 @@ export default function Navbar() {
|
||||
routes.contact,
|
||||
];
|
||||
|
||||
const linkClass = (href: string) =>
|
||||
pathname === href ? 'text-primary font-semibold' : 'text-white';
|
||||
const linkClass = (href: string) => {
|
||||
let isActive = false;
|
||||
if (href === '/' || href === `/${locale}`) {
|
||||
isActive = pathname === '/' || pathname === `/${locale}`;
|
||||
} else {
|
||||
isActive = pathname.startsWith(href);
|
||||
}
|
||||
return isActive ? 'text-primary font-semibold' : 'text-white';
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user