Skip to content

Commit d538fba

Browse files
committed
Use Mui Grid for the anniversaries, birthdays, and kudos to allow the columns to rearrange themselves.
1 parent f3e0745 commit d538fba

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

web-ui/src/pages/HomePage.jsx

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import MyBirthday from '../components/celebrations/MyBirthday';
99
import { AppContext } from '../context/AppContext';
1010
import { selectCsrfToken, selectCurrentUser } from '../context/selectors';
1111
import { sortAnniversaries, sortBirthdays } from '../context/util';
12-
import { Button } from '@mui/material';
12+
import { Button, Grid } from '@mui/material';
1313

1414
import './HomePage.css';
1515

@@ -76,6 +76,13 @@ export default function HomePage() {
7676
return document.cookie.indexOf("OJWT=") != -1;
7777
}
7878

79+
// This width matches the birthdays-card and anniversaries-card style.
80+
// However, we do not want to set this width on the PublicKudos css as it is
81+
// used elsewhere and does not need to have it's width restricted. This only
82+
// applies if if we have birthdays or anniversaries to display on this page.
83+
const kudosStyle = birthdays.length == 0 &&
84+
anniversaries.length == 0 ? {} : { width: '450px' };
85+
7986
return (
8087
<div className="home-page">
8188
<div className="celebrations">
@@ -87,11 +94,19 @@ export default function HomePage() {
8794
myAnniversary={myAnniversaryData}
8895
/>
8996
) : (
90-
<>
91-
{ anniversaries.length > 0 && (<Anniversaries anniversaries={anniversaries} />) }
92-
{ birthdays.length > 0 && (<Birthdays birthdays={birthdays} />) }
93-
<PublicKudos />
94-
</>
97+
<Grid container spacing={2} style={{ padding: '0 20px 0 20px' }}>
98+
{ anniversaries.length > 0 && (
99+
<Grid item>
100+
<Anniversaries anniversaries={anniversaries} />
101+
</Grid>) }
102+
{ birthdays.length > 0 && (
103+
<Grid item>
104+
<Birthdays birthdays={birthdays} />
105+
</Grid>) }
106+
<Grid item style={kudosStyle}>
107+
<PublicKudos />
108+
</Grid>
109+
</Grid>
95110
)}
96111
</div>
97112
{checkForImpersonation() &&

0 commit comments

Comments
 (0)