diff --git a/src/components/Header.tsx b/src/components/Header.tsx index a0e81212..d9bbde89 100644 --- a/src/components/Header.tsx +++ b/src/components/Header.tsx @@ -21,12 +21,20 @@ export default function Header() { useEffect(() => { window.addEventListener('scroll', handleScroll); + window.addEventListener('resize', handleResize); return () => { window.removeEventListener('scroll', handleScroll); + window.removeEventListener('resize', handleResize); }; }, []); + const handleResize = () => { + if (window.innerWidth >= 768) { + setIsMenuOpen(false); + } + }; + const handleScroll = () => { const scrollPosition = window.scrollY; setIsScrolled(scrollPosition > 0);