import { useEffect, useState } from 'react' import { Link, useLocation } from 'react-router-dom' import './Navigation.css' export default function Navigation() { const [scrolled, setScrolled] = useState(false) const [mobileOpen, setMobileOpen] = useState(false) const location = useLocation() useEffect(() => { const handleScroll = () => setScrolled(window.scrollY > 50) window.addEventListener('scroll', handleScroll) return () => window.removeEventListener('scroll', handleScroll) }, []) useEffect(() => { function handleKeyDown(event) { if (event.key === 'Escape') setMobileOpen(false) } document.addEventListener('keydown', handleKeyDown) return () => document.removeEventListener('keydown', handleKeyDown) }, []) function closeMenu() { setMobileOpen(false) } const navLinks = [ { to: '/artikel', label: 'Artikel' }, { to: '/kniepunkt', label: 'Kniepunkt' }, { to: '/podcast', label: 'Podcast' }, { to: '/speaking', label: 'Speaking' }, { to: '/consulting', label: 'Beratung' }, { to: '/ueber-mich', label: 'Über mich' }, { to: '/kontakt', label: 'Kontakt' }, ] const isActive = (path) => location.pathname === path || location.pathname.startsWith(`${path}/`) return ( ) }