Skip to content

Commit 582e43a

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

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ 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';
18+
import { useEffect, useState } from 'react';
1919

2020
const textColor = 'white';
2121
const background = '#ef4345';
@@ -26,12 +26,11 @@ interface NavTopBarProps extends LayoutProps {
2626
}
2727

2828
const 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 (

0 commit comments

Comments
 (0)