@@ -15,15 +15,24 @@ 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' ;
1819
1920const textColor = 'white' ;
2021const background = '#ef4345' ;
22+ const mobileWidthThreshold = 550 ;
2123
2224interface NavTopBarProps extends LayoutProps {
2325 handleDrawerOpen : ( ) => void ;
2426}
2527
2628const NavTopBar : React . FC < NavTopBarProps > = ( { open, handleDrawerOpen } ) => {
29+ const [ width , setWidth ] = React . useState ( window . innerWidth ) ;
30+ React . useEffect ( ( ) => {
31+ function handleResize ( ) {
32+ setWidth ( window . innerWidth ) ;
33+ }
34+ window . addEventListener ( 'resize' , handleResize ) ;
35+ } ) ;
2736 const user = useCurrentUser ( ) ;
2837 return (
2938 < NERAppBar position = "fixed" open = { open } >
@@ -50,7 +59,7 @@ const NavTopBar: React.FC<NavTopBarProps> = ({ open, handleDrawerOpen }) => {
5059 src = "/NER-Logo-App-Icon.png"
5160 />
5261 < Typography variant = "h4" fontSize = { 30 } component = "div" sx = { { flexGrow : 1 , paddingLeft : 2 , color : textColor } } >
53- { window . innerWidth > 550 ? 'FinishLine by NER' : 'FinishLine' }
62+ { width > mobileWidthThreshold ? 'FinishLine by NER' : 'FinishLine' }
5463 </ Typography >
5564 </ Box >
5665 </ Link >
0 commit comments