'use client'; import { Link, usePathname, useRouter } from '@/i18n/routing'; import { useState, useEffect } from 'react'; import { useLocale, useTranslations } from 'next-intl'; import { motion, AnimatePresence } from 'framer-motion'; export default function Navbar() { const [isOpen, setIsOpen] = useState(false); const pathname = usePathname(); const router = useRouter(); const locale = useLocale(); const t = useTranslations('Navbar'); // Close menu on route change useEffect(() => { setIsOpen(false); }, [pathname]); // Lock body scroll when menu is open useEffect(() => { if (isOpen) { document.body.style.overflow = 'hidden'; } else { document.body.style.overflow = 'unset'; } }, [isOpen]); const changeLocale = (nextLocale: string) => { router.replace(pathname, { locale: nextLocale }); }; const navLinks = [ { name: t('meira'), href: '/fleet/meira' }, { name: t('princess'), href: '/fleet/princess-melda' }, { name: t('queen'), href: '/fleet/queen-of-salmakis' }, { name: t('dolce'), href: '/fleet/dolce-mare' }, { name: t('sunworld'), href: '/fleet/sunworld-8' }, ]; const menuVariants = { closed: { opacity: 0, y: "-100%", transition: { duration: 0.8, ease: [0.76, 0, 0.24, 1] } }, open: { opacity: 1, y: 0, transition: { duration: 0.8, ease: [0.76, 0, 0.24, 1] } } }; const linkVariants = { closed: { opacity: 0, y: 30 }, open: (i: number) => ({ opacity: 1, y: 0, transition: { delay: 0.3 + (i * 0.1), duration: 0.6, ease: "easeOut" } }) }; return ( ); }