Skip to content

Commit

Permalink
Use Mui Grid for the anniversaries, birthdays, and kudos to allow the…
Browse files Browse the repository at this point in the history
… columns to rearrange themselves.
  • Loading branch information
ocielliottc committed Nov 5, 2024
1 parent f3e0745 commit d538fba
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions web-ui/src/pages/HomePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import MyBirthday from '../components/celebrations/MyBirthday';
import { AppContext } from '../context/AppContext';
import { selectCsrfToken, selectCurrentUser } from '../context/selectors';
import { sortAnniversaries, sortBirthdays } from '../context/util';
import { Button } from '@mui/material';
import { Button, Grid } from '@mui/material';

import './HomePage.css';

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

// This width matches the birthdays-card and anniversaries-card style.
// However, we do not want to set this width on the PublicKudos css as it is
// used elsewhere and does not need to have it's width restricted. This only
// applies if if we have birthdays or anniversaries to display on this page.
const kudosStyle = birthdays.length == 0 &&
anniversaries.length == 0 ? {} : { width: '450px' };

return (
<div className="home-page">
<div className="celebrations">
Expand All @@ -87,11 +94,19 @@ export default function HomePage() {
myAnniversary={myAnniversaryData}
/>
) : (
<>
{ anniversaries.length > 0 && (<Anniversaries anniversaries={anniversaries} />) }
{ birthdays.length > 0 && (<Birthdays birthdays={birthdays} />) }
<PublicKudos />
</>
<Grid container spacing={2} style={{ padding: '0 20px 0 20px' }}>
{ anniversaries.length > 0 && (
<Grid item>
<Anniversaries anniversaries={anniversaries} />
</Grid>) }
{ birthdays.length > 0 && (
<Grid item>
<Birthdays birthdays={birthdays} />
</Grid>) }
<Grid item style={kudosStyle}>
<PublicKudos />
</Grid>
</Grid>
)}
</div>
{checkForImpersonation() &&
Expand Down

0 comments on commit d538fba

Please sign in to comment.