docs: close mobile menu on viewport resize past lg breakpoint (#8513)

This commit is contained in:
Taesu
2026-03-09 14:49:17 +09:00
committed by GitHub
parent b5282633a1
commit b8b8b1379e

View File

@@ -130,6 +130,17 @@ export function StaggeredNavFiles() {
};
}, [mobileMenuOpen]);
useEffect(() => {
const mql = window.matchMedia("(min-width: 1024px)");
const handler = () => {
if (mql.matches) {
setMobileMenuOpen(false);
}
};
mql.addEventListener("change", handler);
return () => mql.removeEventListener("change", handler);
}, []);
const openProducts = () => {
clearTimeout(productsTimeout.current);
setProductsOpen(true);