diff --git a/components/Layout.tsx b/components/Layout.tsx index aa895a1af..5245b7f47 100644 --- a/components/Layout.tsx +++ b/components/Layout.tsx @@ -35,6 +35,17 @@ export default function Layout({ const mobileNavRef = useRef(null); + useEffect(() => { + if (showMobileNav) { + document.body.style.overflow = 'hidden'; + } else { + document.body.style.overflow = 'unset'; + } + return () => { + document.body.style.overflow = 'unset'; + }; + }, [showMobileNav]); + React.useEffect( () => useStore.setState({ overlayNavigation: null }), [router.asPath], @@ -103,7 +114,13 @@ export default function Layout({ -
+
{showMobileNav && } {children}
@@ -293,29 +310,40 @@ const MobileNav = () => { const section = useContext(SectionContext); return ( -
- - +
+
+ + - - - + + + +
); };