Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/sections/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ const Header: React.FC = () => {
return () => window.removeEventListener('scroll', handleScroll);
}, []);

// Handle window resize to close mobile menu on larger screens
useEffect(() => {
const handleResize = () => {
if (window.innerWidth >= 1024) {
setIsMobileMenuOpen(false);
setActiveDropdown(null);
}
};

window.addEventListener('resize', handleResize);
return () => window.removeEventListener('resize', handleResize);
}, []);

// Handle body scroll lock when mobile menu is open
useEffect(() => {
if (isMobileMenuOpen) {
Expand Down Expand Up @@ -160,7 +173,7 @@ const Header: React.FC = () => {
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.2 }}
className="fixed inset-0 bg-black/30 md:hidden z-40"
className="fixed inset-0 bg-black/30 lg:hidden z-40"
onClick={() => setIsMobileMenuOpen(false)}
/>
)}
Expand Down Expand Up @@ -195,8 +208,7 @@ const MobileNavDrawer: React.FC<{
animate={{ opacity: 1, x: 0 }}
exit={{ opacity: 0, x: '100%' }}
transition={{ type: 'tween', duration: 0.3 }}
className="fixed md:hidden top-0 right-0 bottom-0 w-[80%] max-w-sm bg-white dark:bg-gray-900 shadow-xl z-40
flex flex-col h-full"
className="fixed lg:hidden top-0 right-0 bottom-0 w-[80%] max-w-sm bg-white dark:bg-gray-900 shadow-xl z-40 flex flex-col h-full"
>
<div className="flex flex-col h-full">
{/* Space to avoid overlay with main header */}
Expand Down