"use client"; import { useState, useEffect } from "react"; import Link from "next/link"; import { usePathname } from "next/navigation"; import { Menu, X, Globe } from "lucide-react"; import { motion, AnimatePresence } from "framer-motion"; import { Locale } from "../dictionaries"; export default function Navbar({ lang, dict }: { lang: Locale; dict: any }) { const [isScrolled, setIsScrolled] = useState(false); const [mobileMenuOpen, setMobileMenuOpen] = useState(false); const pathname = usePathname(); const isHome = pathname === `/${lang}` || pathname === `/${lang}/`; const navLinks = [ { name: dict.home, href: `/${lang}` }, { name: dict.corporate, href: `/${lang}/kurumsal` }, { name: dict.venues, href: `/${lang}/#mekanlar` }, { name: dict.gallery, href: `/${lang}/galeri` }, { name: dict.contact, href: `/${lang}/iletisim` }, ]; useEffect(() => { const handleScroll = () => { setIsScrolled(window.scrollY > 50); }; window.addEventListener("scroll", handleScroll); return () => window.removeEventListener("scroll", handleScroll); }, []); const switchLanguage = (newLang: string) => { if (!pathname) return '/'; // Replace the current lang code in the URL with the new one const segments = pathname.split('/'); if (segments[1] === 'tr' || segments[1] === 'en') { segments[1] = newLang; } else { segments.splice(1, 0, newLang); } return segments.join('/'); }; return (
{/* Logo */} Moy Group Logo {/* Desktop Nav */} {/* Mobile menu button */}
{/* Mobile Nav */} {mobileMenuOpen && (
{navLinks.map((link) => ( setMobileMenuOpen(false)} className="block px-3 py-4 text-white border-b border-gray-800 hover:text-[var(--color-moy-gold)] uppercase tracking-wider text-sm" > {link.name} ))}
setMobileMenuOpen(false)} className={`text-sm ${lang === 'tr' ? 'text-[var(--color-moy-gold)] font-bold' : ''}`}>Türkçe setMobileMenuOpen(false)} className={`text-sm ${lang === 'en' ? 'text-[var(--color-moy-gold)] font-bold' : ''}`}>English
)}
); }