diff --git a/app/[locale]/navbar.tsx b/app/[locale]/navbar.tsx index e57d1b4..7ae2f27 100644 --- a/app/[locale]/navbar.tsx +++ b/app/[locale]/navbar.tsx @@ -1,13 +1,13 @@ "use client" import { Fragment, useEffect, useState } from "react" -import Link from "next/link" import { cn } from "@/lib/utils" import { ThemeSwitch } from "../../components/custom/theme-switch" import { useTranslations } from "next-intl" import { LocaleSwitch } from "../../components/custom/locale-switch" import { Button } from "@/components/ui/button" import { Menu, X } from "lucide-react" +import { Link, usePathname } from "@/i18n/navigation" import { DropdownMenu, DropdownMenuContent, @@ -19,6 +19,7 @@ import { export default function Navbar() { const [scrolled, setScrolled] = useState(false); const [mobileMenuOpen, setMobileMenuOpen] = useState(false); + const pathname = usePathname() const t = useTranslations('pages'); useEffect(() => { @@ -47,6 +48,12 @@ export default function Navbar() { { href: "/projects", label: t("projects") }, ]; + const isActiveHref = (href: string) => { + if (!pathname) return false + if (href === "/") return pathname === "/" + return pathname === href || pathname.startsWith(`${href}/`) + } + return (
@@ -63,12 +70,19 @@ export default function Navbar() { : "border-foreground/0" )} > -

bH

+

bH