'use client'; import React, { useState, useEffect } from 'react'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import ThemeSelector from '../molecules/ThemeSelector'; // Icons const MenuIcon = ({ className = '' }: { className?: string }) => ( ); const CloseIcon = ({ className = '' }: { className?: string }) => ( ); interface NavLinkProps { href: string; children: React.ReactNode; isMobile?: boolean; onClick?: () => void; } const NavLink = ({ href, children, isMobile = false, onClick }: NavLinkProps) => { const pathname = usePathname(); const isActive = pathname === href; const baseStyles = "transition-colors duration-200 px-3 py-2 rounded-md text-lg font-medium"; const mobileStyles = isMobile ? "block w-full text-left" : ""; // Create a visually distinct style for active links using the exact primary blue color const activeStyles = isActive ? "text-white font-bold border-b-4 border-accent" : "text-gray-700 hover:bg-gray-100 dark:text-white dark:hover:bg-gray-700"; // Apply background color using inline style for active links to ensure exact color match const linkStyle = isActive ? { backgroundColor: 'var(--color-primary)' } : {}; return ( {children} ); }; const Navigation = () => { const [isOpen, setIsOpen] = useState(false); const [scrolled, setScrolled] = useState(false); const toggleMenu = () => setIsOpen(!isOpen); const closeMenu = () => setIsOpen(false); // Handle scroll effect useEffect(() => { const handleScroll = () => { const offset = window.scrollY; if (offset > 50) { setScrolled(true); } else { setScrolled(false); } }; window.addEventListener('scroll', handleScroll); return () => window.removeEventListener('scroll', handleScroll); }, []); // Close menu on ESC key useEffect(() => { const handleEsc = (event: KeyboardEvent) => { if (event.key === 'Escape') { setIsOpen(false); } }; window.addEventListener('keydown', handleEsc); return () => window.removeEventListener('keydown', handleEsc); }, []); return ( ); }; export default Navigation;