"use client"; import { useTranslations } from 'next-intl'; import { Link, usePathname, useRouter } from '@/i18n/routing'; import { useState, useEffect } from 'react'; import { Menu, X } from 'lucide-react'; import { motion, AnimatePresence } from 'framer-motion'; export default function Navbar({ locale }: { locale: string }) { const t = useTranslations('Navbar'); const pathname = usePathname(); const router = useRouter(); const [isScrolled, setIsScrolled] = useState(false); const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false); useEffect(() => { const handleScroll = () => setIsScrolled(window.scrollY > 50); window.addEventListener('scroll', handleScroll); return () => window.removeEventListener('scroll', handleScroll); }, []); const switchLocale = (newLocale: string) => { router.replace(pathname, { locale: newLocale }); }; const navLinks = [ { href: pathname === '/' ? '#about' : '/#about', label: t('about') }, { href: '/accommodation', label: t('accommodation') }, { href: pathname === '/' ? '#beach' : '/#beach', label: t('beach') }, { href: pathname === '/' ? '#dining' : '/#dining', label: t('dining') }, { href: pathname === '/' ? '#events' : '/#events', label: t('events') }, { href: pathname === '/' ? '#gallery' : '/#gallery', label: t('gallery') }, { href: pathname === '/' ? '#contact' : '/#contact', label: t('contact') }, ]; return ( ); }