Properly update chapter list window scroll

Once the window scroller was set, resizing the window to increase the width did not remove the window scroller again
This commit is contained in:
schroda
2024-08-30 15:50:17 +02:00
parent 825fd46ed4
commit bf8aecfc42
3 changed files with 43 additions and 22 deletions

View File

@@ -7,6 +7,7 @@
*/
import useMediaQuery from '@mui/material/useMediaQuery';
import { Breakpoint } from '@mui/material/styles';
import { getCurrentTheme } from '@/theme.ts';
export class MediaQuery {
@@ -14,7 +15,11 @@ export class MediaQuery {
return useMediaQuery('not (pointer: fine)');
}
static useIsBelowWidth(breakpoint: Breakpoint): boolean {
return useMediaQuery(getCurrentTheme().breakpoints.down(breakpoint));
}
static useIsMobileWidth(): boolean {
return useMediaQuery(getCurrentTheme().breakpoints.down('sm'));
return this.useIsBelowWidth('sm');
}
}