"use client"; import { AnimatePresence, motion } from "framer-motion"; import { Menu, X } from "lucide-react"; import Image from "next/image"; import { type MouseEvent, useState } from "react"; import { business, type Locale } from "@/config/business"; import type { Messages } from "@/messages"; import LanguageSwitcher from "./LanguageSwitcher"; import PhysicsButton from "./PhysicsButton"; export default function Navbar({ locale, onLocaleChange, t, whatsappUrl }: { locale: Locale; onLocaleChange: (locale: Locale) => void; t: Messages; whatsappUrl: string }) { const [open, setOpen] = useState(false); function scrollToSection(event: MouseEvent, href: string) { if (!href.startsWith("#")) return; event.preventDefault(); const target = document.querySelector(href); if (!target) return; setOpen(false); target.scrollIntoView({ behavior: "smooth", block: "start" }); window.history.replaceState(null, "", href); } return (
{open ? (
{t.nav.links.map((link) => ( scrollToSection(event, link.href)} className="rounded-2xl px-4 py-3 text-sm font-semibold text-ink/72 hover:bg-white"> {link.label} ))}
{t.nav.cta}
) : null}
); }