This commit is contained in:
Alex Holliday committed 2025-12-08 21:58:35 +00:00
1 parent a3f7ac8ae3
commit 50b734cf24
2 files changed
+20 -11

No files matched your search

+15 -7
View File
@@ -1,22 +1,30 @@
import { Outlet } from "react-router"; import { Outlet } from "react-router";
import Stack from "@mui/material/Stack"; import Stack from "@mui/material/Stack";
import { SideBar } from "@/components/layouts/sidebar"; import {
SideBar,
COLLAPSED_WIDTH,
EXPANDED_WIDTH,
} from "@/components/layouts/sidebar";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
import useMediaQuery from "@mui/material/useMediaQuery";
const RootLayout = () => { const RootLayout = () => {
const theme = useTheme(); const theme = useTheme();
const isSmall = useMediaQuery(theme.breakpoints.down("md"));
return ( return (
<Stack direction="row" minHeight="100vh"> <Stack direction="row" minHeight="100vh">
<SideBar /> <SideBar />
<Stack <Stack
flex={1} flex={1}
padding={theme.spacing(12)} padding={12}
overflow={"hidden"} overflow={"hidden"}
sx={{ sx={{
backgroundColor: theme.palette.mode === 'dark' pl: `${(isSmall ? COLLAPSED_WIDTH : 0) + 24}px`,
? 'rgba(255, 255, 255, 0.01)' backgroundColor:
: 'rgba(0, 0, 0, 0.01)', theme.palette.mode === "dark"
display: 'flex', ? "rgba(255, 255, 255, 0.01)"
alignItems: 'center' : "rgba(0, 0, 0, 0.01)",
display: "flex",
alignItems: "center",
}} }}
> >
<Stack maxWidth={1280} width="100%" paddingY={theme.spacing(6)}> <Stack maxWidth={1280} width="100%" paddingY={theme.spacing(6)}>
@@ -38,8 +38,9 @@ export const SideBar = () => {
return ( return (
<Stack <Stack
component="aside" component="aside"
position="sticky" position={isSmall ? "fixed" : "sticky"}
top={0} top={0}
left={0}
minHeight={"100vh"} minHeight={"100vh"}
maxHeight={"100vh"} maxHeight={"100vh"}
paddingTop={theme.spacing(6)} paddingTop={theme.spacing(6)}
@@ -49,6 +50,8 @@ export const SideBar = () => {
width={sideBarOpen ? EXPANDED_WIDTH : COLLAPSED_WIDTH} width={sideBarOpen ? EXPANDED_WIDTH : COLLAPSED_WIDTH}
sx={{ sx={{
transition: "width 650ms cubic-bezier(0.36, -0.01, 0, 0.77)", transition: "width 650ms cubic-bezier(0.36, -0.01, 0, 0.77)",
zIndex: isSmall ? (t) => t.zIndex.drawer : "auto",
backgroundColor: theme.palette.background.paper,
}} }}
> >
<CollapseButton sidebarOpen={sideBarOpen} /> <CollapseButton sidebarOpen={sideBarOpen} />
@@ -102,9 +105,7 @@ export const SideBar = () => {
); );
})} })}
</List> </List>
<Divider <Divider sx={{ mt: "auto", borderColor: theme.palette.divider }} />
sx={{ mt: "auto", borderColor: theme.palette.divider }}
/>
<BottomControls /> <BottomControls />
</Stack> </Stack>
); );