'use client'; import { useState, useEffect } from 'react'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { Button } from '@/components/ui/Button'; import { LocaleSwitcher } from '@/components/LocaleSwitcher'; import { getLocaleFromPath } from '@/lib/i18n'; interface MobileMenuProps { locale: string; siteName: string; onClose?: () => void; } export function MobileMenu({ locale, siteName, onClose }: MobileMenuProps) { const [isOpen, setIsOpen] = useState(false); const pathname = usePathname(); const currentLocale = getLocaleFromPath(pathname); // Main navigation menu const mainMenu = [ { title: 'Home', path: `/${locale}` }, { title: 'Blog', path: `/${locale}/blog` }, { title: 'Products', path: `/${locale}/products` }, { title: 'Contact', path: `/${locale}/contact` } ]; // Product categories (could be dynamic from data) const productCategories = [ { title: 'Medium Voltage', path: `/${locale}/product-category/medium-voltage` }, { title: 'Low Voltage', path: `/${locale}/product-category/low-voltage` }, { title: 'Accessories', path: `/${locale}/product-category/accessories` } ]; // Close on route change useEffect(() => { setIsOpen(false); if (onClose) onClose(); }, [pathname, onClose]); const toggleMenu = () => { setIsOpen(!isOpen); if (!isOpen && onClose) onClose(); }; const closeMenu = () => { setIsOpen(false); if (onClose) onClose(); }; return ( <> {/* Mobile Toggle Button */} {/* Mobile Menu Overlay */} {isOpen && (