Skip to content

Commit

Permalink
fix: sidebar closed width
Browse files Browse the repository at this point in the history
  • Loading branch information
pranavkparti committed Aug 25, 2024
1 parent 767265f commit f9753b2
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions src/components/layout/Menu/MenuStyled.js
Original file line number Diff line number Diff line change
@@ -1,59 +1,59 @@
import MuiDrawer from "@mui/material/Drawer";
import { styled } from "@mui/system";
import MuiDrawer from '@mui/material/Drawer';
import { styled } from '@mui/system';

const drawerWidth = 240;
const mobileDrawerWidth = 140;

const openedMixin = (theme) => ({
width: mobileDrawerWidth,
[theme.breakpoints.up("sm")]: {
[theme.breakpoints.up('sm')]: {
width: drawerWidth,
},
transition: theme.transitions.create("width", {
transition: theme.transitions.create('width', {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.enteringScreen,
}),
overflowX: "hidden",
overflowX: 'hidden',
});

const closedMixin = (theme) => ({
transition: theme.transitions.create("width", {
transition: theme.transitions.create('width', {
easing: theme.transitions.easing.sharp,
duration: theme.transitions.duration.leavingScreen,
}),
overflowX: "hidden",
width: `calc(${theme.spacing(8)} + 1px)`,
[theme.breakpoints.up("sm")]: {
width: `calc(${theme.spacing(8)} + 1px)`,
overflowX: 'hidden',
width: `calc(${theme.spacing(12)} + 1px)`,
[theme.breakpoints.up('sm')]: {
width: `calc(${theme.spacing(12)} + 1px)`,
},
});

const DrawerHeaderStyled = styled("div")(({ theme }) => ({
display: "flex",
alignItems: "center",
justifyContent: "flex-end",
const DrawerHeaderStyled = styled('div')(({ theme }) => ({
display: 'flex',
alignItems: 'center',
justifyContent: 'flex-end',
padding: theme.spacing(0, 1),
// necessary for content to be below app bar
...theme.mixins.toolbar,
}));

const DrawerStyled = styled(MuiDrawer, {
shouldForwardProp: (prop) => prop !== "open",
shouldForwardProp: (prop) => prop !== 'open',
})(({ theme, open }) => ({
width: mobileDrawerWidth,
[theme.breakpoints.up("sm")]: {
[theme.breakpoints.up('sm')]: {
width: drawerWidth,
},
flexShrink: 0,
whiteSpace: "nowrap",
boxSizing: "border-box",
whiteSpace: 'nowrap',
boxSizing: 'border-box',
...(open && {
...openedMixin(theme),
"& .MuiDrawer-paper": openedMixin(theme),
'& .MuiDrawer-paper': openedMixin(theme),
}),
...(!open && {
...closedMixin(theme),
"& .MuiDrawer-paper": closedMixin(theme),
'& .MuiDrawer-paper': closedMixin(theme),
}),
}));

Expand Down

0 comments on commit f9753b2

Please sign in to comment.