Prevent grid items from jumping after closing reader
Due to the reader and the "default" nav bar updating the same navbar width in the context, the grid item width calculation resulted in different grid item widths, which caused the items to "jump" after closing the reader
This commit is contained in:
@@ -17,7 +17,7 @@ import ChevronLeftIcon from '@mui/icons-material/ChevronLeft';
|
||||
import ChevronRightIcon from '@mui/icons-material/ChevronRight';
|
||||
import Divider from '@mui/material/Divider';
|
||||
import { styled, useTheme } from '@mui/material/styles';
|
||||
import { useCallback, useEffect, useMemo, useRef } from 'react';
|
||||
import { useCallback, useMemo, useRef } from 'react';
|
||||
import Box from '@mui/material/Box';
|
||||
import ListItem from '@mui/material/ListItem';
|
||||
import Tooltip from '@mui/material/Tooltip';
|
||||
@@ -92,7 +92,6 @@ export const DesktopSideBar = ({ navBarItems }: { navBarItems: NavbarItem[] }) =
|
||||
ref,
|
||||
useCallback(() => setNavBarWidth(ref.current?.clientWidth ?? 0), [ref.current]),
|
||||
);
|
||||
useEffect(() => () => setNavBarWidth(0), []);
|
||||
|
||||
return (
|
||||
<Drawer variant="permanent" sx={{ width: navBarWidth }}>
|
||||
|
||||
Reference in New Issue
Block a user