File tree Expand file tree Collapse file tree
src/frontend/src/layouts/NavTopBar Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import { LayoutProps } from '../LayoutProps';
1515import { IconButton } from '@mui/material' ;
1616import { GridMenuIcon } from '@mui/x-data-grid' ;
1717import { useCurrentUser } from '../../hooks/users.hooks' ;
18- import React from 'react' ;
18+ import { useEffect , useState } from 'react' ;
1919
2020const textColor = 'white' ;
2121const background = '#ef4345' ;
@@ -26,12 +26,11 @@ interface NavTopBarProps extends LayoutProps {
2626}
2727
2828const NavTopBar : React . FC < NavTopBarProps > = ( { open, handleDrawerOpen } ) => {
29- const [ width , setWidth ] = React . useState ( window . innerWidth ) ;
30- React . useEffect ( ( ) => {
31- function handleResize ( ) {
29+ const [ width , setWidth ] = useState ( window . innerWidth ) ;
30+ useEffect ( ( ) => {
31+ window . addEventListener ( 'resize' , ( ) => {
3232 setWidth ( window . innerWidth ) ;
33- }
34- window . addEventListener ( 'resize' , handleResize ) ;
33+ } ) ;
3534 } ) ;
3635 const user = useCurrentUser ( ) ;
3736 return (
You can’t perform that action at this time.
0 commit comments