refactor: enhance link active state handling in Navbar and HamburgerMenu components

This commit is contained in:
2025-06-16 14:02:21 +03:30
parent 7c56fdc8cd
commit 96e0fc9e0d
6 changed files with 30 additions and 12 deletions
+9 -2
View File
@@ -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 (
<>