"use client"; import { useEffect, useState } from "react"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { useTheme } from "next-themes"; import { Menu, Moon, Sun, X } from "lucide-react"; import { useI18n } from "@/i18n/context"; import { locales } from "@/i18n/config"; import type { Locale } from "@/i18n/config"; export default function Navbar() { const { t } = useI18n(); const pathname = usePathname(); const { resolvedTheme, setTheme } = useTheme(); const [scrolled, setScrolled] = useState(false); const [open, setOpen] = useState(false); useEffect(() => { const onScroll = () => setScrolled(window.scrollY > 24); onScroll(); window.addEventListener("scroll", onScroll, { passive: true }); return () => window.removeEventListener("scroll", onScroll); }, []); const links = [ { href: "#projects", label: t.nav.projects }, { href: "#skills", label: t.nav.skills }, { href: "#contact", label: t.nav.contact }, ]; const currentLocale = (pathname.split("/")[1] ?? "pt") as Locale; return (
{open && (
{links.map((link) => ( setOpen(false)} className="rounded-lg px-3 py-2 font-mono text-sm text-mute transition-colors hover:bg-surface hover:text-brand" > {"// "} {link.label} ))}
)}
); }