diff --git a/src/layout/AppLayout.tsx b/src/layout/AppLayout.tsx index 0669b02..8ab2d05 100644 --- a/src/layout/AppLayout.tsx +++ b/src/layout/AppLayout.tsx @@ -26,7 +26,10 @@ /> - + {/* Fade out the background when the sidebar is open on mobile */} {!bps.md &&
>; +} + +export function Sidebar({ + collapsed, + setCollapsed +}: Props): JSX.Element { const { t } = useTranslation(); const location = useLocation(); @@ -65,6 +73,11 @@ : location.pathname.startsWith(i.to))?.to); }, [location]); + useEffect(() => { + // Close the sidebar if we switch page + setCollapsed(true); + }, [setCollapsed, location.pathname]); + return