Skip to content

Commit d1b3060

Browse files
committed
#1480: Shortened title on smaller screens
1 parent c50f78b commit d1b3060

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/frontend/src/layouts/NavTopBar/NavTopBar.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,24 @@ import { LayoutProps } from '../LayoutProps';
1515
import { IconButton } from '@mui/material';
1616
import { GridMenuIcon } from '@mui/x-data-grid';
1717
import { useCurrentUser } from '../../hooks/users.hooks';
18+
import React from 'react';
1819

1920
const textColor = 'white';
2021
const background = '#ef4345';
22+
const mobileWidthThreshold = 550;
2123

2224
interface NavTopBarProps extends LayoutProps {
2325
handleDrawerOpen: () => void;
2426
}
2527

2628
const 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

Comments
 (0)