close sidebar on click
This commit is contained in:
1 parent
07b08d0037
commit
660346d2bc
2 files changed
+13
-12
No files matched your search
@@ -10,14 +10,11 @@ interface BasePageProps extends StackProps {
|
|||||||
breadcrumbOverride?: string[];
|
breadcrumbOverride?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const BasePage: React.FC<BasePageProps> = ({
|
export const BasePage = ({
|
||||||
children,
|
children,
|
||||||
breadcrumbOverride,
|
breadcrumbOverride,
|
||||||
...props
|
...props
|
||||||
}: {
|
}: BasePageProps) => {
|
||||||
children: React.ReactNode;
|
|
||||||
breadcrumbOverride?: string[];
|
|
||||||
}) => {
|
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
return (
|
return (
|
||||||
<Stack spacing={theme.spacing(10)} {...props}>
|
<Stack spacing={theme.spacing(10)} {...props}>
|
||||||
@@ -38,7 +35,7 @@ interface BasePageWithStatesProps extends StackProps {
|
|||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const BasePageWithStates: React.FC<BasePageWithStatesProps> = ({
|
export const BasePageWithStates = ({
|
||||||
loading,
|
loading,
|
||||||
error,
|
error,
|
||||||
items,
|
items,
|
||||||
@@ -94,9 +91,7 @@ const isEmpty = (items: any[]) => {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const MonitorBasePageWithStates: React.FC<
|
export const MonitorBasePageWithStates = ({
|
||||||
MonitorBasePageWithStatesProps
|
|
||||||
> = ({
|
|
||||||
loading,
|
loading,
|
||||||
error,
|
error,
|
||||||
items,
|
items,
|
||||||
|
|||||||
@@ -53,8 +53,6 @@ export const SideBar = () => {
|
|||||||
backgroundColor: theme.palette.background.paper,
|
backgroundColor: theme.palette.background.paper,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{/* Sidebar collapse handled by Logo click */}
|
|
||||||
|
|
||||||
<List
|
<List
|
||||||
component="nav"
|
component="nav"
|
||||||
disablePadding
|
disablePadding
|
||||||
@@ -72,7 +70,12 @@ export const SideBar = () => {
|
|||||||
item={item}
|
item={item}
|
||||||
sidebarOpen={sideBarOpen}
|
sidebarOpen={sideBarOpen}
|
||||||
selected={selected}
|
selected={selected}
|
||||||
onClick={() => navigate(`/${item.path}`)}
|
onClick={() => {
|
||||||
|
navigate(`/${item.path}`);
|
||||||
|
if (isSmall) {
|
||||||
|
dispatch(setSidebarOpen(false));
|
||||||
|
}
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@@ -99,6 +102,9 @@ export const SideBar = () => {
|
|||||||
} else {
|
} else {
|
||||||
navigate(`/${item.path}`);
|
navigate(`/${item.path}`);
|
||||||
}
|
}
|
||||||
|
if (isSmall) {
|
||||||
|
dispatch(setSidebarOpen(false));
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in new issue
Block a user