mirror of
https://github.com/better-auth/better-auth.git
synced 2026-05-23 07:18:56 -05:00
docs: close mobile menu on viewport resize past lg breakpoint (#8513)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user