Commit dc7dc132 by Arjun Jhukal

updated the mobile menu close on redirection

parent ff4a7580
......@@ -11,11 +11,18 @@ import Breadcrumb from '../molecules/Breadcrumb';
export default function DashboardLayout({ children }: { children: React.ReactNode }) {
const [open, setOpen] = React.useState(true);
const [openMobile, setOpenMobile] = React.useState(false);
const pathname = usePathname();
const handleDrawerOpen = () => {
setOpen((prev) => !prev);
};
React.useEffect(() => {
// Close menu when route changes
if (openMobile) {
setOpenMobile(false);
}
}, [pathname]);
const handleMobileMenuToggle = () => {
setOpenMobile((prev) => !prev);
}
......@@ -31,7 +38,6 @@ export default function DashboardLayout({ children }: { children: React.ReactNod
...theme.mixins.toolbar,
}));
const pathname = usePathname();
return (
<Box sx={{ display: 'flex' }}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment