Skip to content

Commit 5575092

Browse files
author
Megan Liu
committed
#1312: fixed WP cards being cut off under 'upcoming deadlines'
1 parent e405190 commit 5575092

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

src/frontend/src/pages/HomePage/UpcomingDeadlines.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,22 @@ const UpcomingDeadlines: React.FC = () => {
2626
return <ErrorPage message={workPackages.error.message} error={workPackages.error} />;
2727
}
2828

29+
window.addEventListener('load', checkOverflow);
30+
window.addEventListener('resize', checkOverflow);
31+
32+
const container = document.getElementById('container');
33+
const content = container?.querySelector('.content');
34+
35+
function checkOverflow() {
36+
if (container !== null && container !== undefined && content !== null && content !== undefined) {
37+
const hasOverflow = content.scrollHeight > container.clientHeight || content.scrollWidth > container.scrollWidth;
38+
container.style.overflow = hasOverflow ? 'scroll' : 'auto';
39+
}
40+
}
41+
2942
const fullDisplay = (
3043
<Box
44+
id="container"
3145
sx={{
3246
display: 'flex',
3347
flexDirection: 'row',
@@ -78,7 +92,7 @@ const UpcomingDeadlines: React.FC = () => {
7892
</FormControl>
7993
}
8094
>
81-
<Grid container>{workPackages.isLoading ? <LoadingIndicator /> : fullDisplay}</Grid>
95+
{workPackages.isLoading ? <LoadingIndicator /> : fullDisplay}
8296
</PageBlock>
8397
);
8498
};

0 commit comments

Comments
 (0)