Update responsive drawer breakpoint

This commit is contained in:
Bill Thornton 2024-01-07 02:48:29 -05:00
parent 81192057e6
commit 09b80ba151
4 changed files with 11 additions and 11 deletions

View file

@ -26,7 +26,7 @@ const AppLayout: FC<AppLayoutProps> = ({
const location = useLocation();
const { user } = useApi();
const isSmallScreen = useMediaQuery((t: Theme) => t.breakpoints.up('sm'));
const isMediumScreen = useMediaQuery((t: Theme) => t.breakpoints.up('md'));
const isDrawerAvailable = Boolean(user)
&& !drawerlessPaths.some(path => location.pathname.startsWith(`/${path}`));
const isDrawerOpen = isDrawerActive && isDrawerAvailable;
@ -43,16 +43,16 @@ const AppLayout: FC<AppLayoutProps> = ({
sx={{
width: {
xs: '100%',
sm: isDrawerAvailable ? `calc(100% - ${DRAWER_WIDTH}px)` : '100%'
md: isDrawerAvailable ? `calc(100% - ${DRAWER_WIDTH}px)` : '100%'
},
ml: {
xs: 0,
sm: isDrawerAvailable ? DRAWER_WIDTH : 0
md: isDrawerAvailable ? DRAWER_WIDTH : 0
}
}}
>
<AppToolbar
isDrawerAvailable={!isSmallScreen && isDrawerAvailable}
isDrawerAvailable={!isMediumScreen && isDrawerAvailable}
isDrawerOpen={isDrawerOpen}
onDrawerButtonClick={onToggleDrawer}
/>

View file

@ -20,7 +20,7 @@ const AppLayout = () => {
const { user } = useApi();
const location = useLocation();
const isSmallScreen = useMediaQuery((t: Theme) => t.breakpoints.up('sm'));
const isMediumScreen = useMediaQuery((t: Theme) => t.breakpoints.up('md'));
const isDrawerAvailable = isDrawerPath(location.pathname) && Boolean(user);
const isDrawerOpen = isDrawerActive && isDrawerAvailable;
@ -36,16 +36,16 @@ const AppLayout = () => {
sx={{
width: {
xs: '100%',
sm: isDrawerAvailable ? `calc(100% - ${DRAWER_WIDTH}px)` : '100%'
md: isDrawerAvailable ? `calc(100% - ${DRAWER_WIDTH}px)` : '100%'
},
ml: {
xs: 0,
sm: isDrawerAvailable ? DRAWER_WIDTH : 0
md: isDrawerAvailable ? DRAWER_WIDTH : 0
}
}}
>
<AppToolbar
isDrawerAvailable={!isSmallScreen && isDrawerAvailable}
isDrawerAvailable={!isMediumScreen && isDrawerAvailable}
isDrawerOpen={isDrawerOpen}
onDrawerButtonClick={onToggleDrawer}
/>

View file

@ -14,7 +14,7 @@ const Backdrop = () => {
className='backdropContainer'
sx={{
left: {
sm: DRAWER_WIDTH
md: DRAWER_WIDTH
}
}}
/>

View file

@ -21,9 +21,9 @@ const ResponsiveDrawer: FC<ResponsiveDrawerProps> = ({
onClose,
onOpen
}) => {
const isSmallScreen = useMediaQuery((theme: Theme) => theme.breakpoints.up('sm'));
const isMediumScreen = useMediaQuery((theme: Theme) => theme.breakpoints.up('md'));
return ( isSmallScreen ? (
return ( isMediumScreen ? (
/* DESKTOP DRAWER */
<Drawer
sx={{