Skip to content

Commit 82f90fa

Browse files
committed
close mobile navbar and disable scroll lock on navigation
1 parent b438b3b commit 82f90fa

File tree

2 files changed

+11
-159
lines changed

2 files changed

+11
-159
lines changed

app/root.res

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,17 @@ open ReactRouter
3333

3434
@react.component
3535
let default = () => {
36+
let {pathname} = ReactRouter.useLocation()
3637
let (isOverlayOpen, setOverlayOpen) = React.useState(_ => false)
3738
let (isScrollLockEnabled, setIsScrollLockEnabled) = React.useState(_ => false)
3839

40+
React.useEffect(() => {
41+
// When the path changes close the sidebar and disable scroll lock
42+
setOverlayOpen(_ => false)
43+
setIsScrollLockEnabled(_ => false)
44+
None
45+
}, [pathname])
46+
3947
<html>
4048
<head>
4149
<style> {React.string("html {opacity:0;}")} </style>

0 commit comments

Comments
 (0)