-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 56-make-it-clear-that-it-is-italy-only-for-now
- Loading branch information
Showing
9 changed files
with
99 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { ArrowLeft, ArrowRight } from "@mui/icons-material"; | ||
import { Stack, Typography, alpha, styled } from "@mui/material"; | ||
import { t } from "i18next"; | ||
import { Fragment } from "react"; | ||
import { Link, useParams } from "react-router-dom"; | ||
|
||
const MonthBar = () => { | ||
const { selectedMonthNum } = useParams(); | ||
const monthNum = Number(selectedMonthNum) - 1; | ||
|
||
//variables to change month when pressing the arrows | ||
const prevMonth = monthNum != 0 ? monthNum - 1 : 11; | ||
const nextMonth = monthNum != 11 ? monthNum + 1 : 0; | ||
|
||
//styled MUI arrows | ||
const ArrowButton = styled(Link)(({ theme }) => ({ | ||
color: alpha(theme.palette.primary.light, 0.75), | ||
"&:hover": { | ||
color: alpha(theme.palette.primary.light, 0.95), | ||
}, | ||
display: "flex", | ||
alignItems: "center", | ||
margin: theme.spacing(1), | ||
width: "auto", | ||
})); | ||
|
||
const ShadowBox = styled(Stack)(({ theme }) => ({ | ||
boxShadow: `0 2px 4px ${theme.palette.secondary}`, | ||
})); | ||
|
||
return ( | ||
<ShadowBox | ||
direction="row" | ||
alignItems="center" | ||
justifyContent="space-between" | ||
bgcolor="secondary.main" | ||
color="primary.light" | ||
boxShadow="0 2px 4px #332323" | ||
> | ||
{selectedMonthNum ? ( | ||
<Fragment> | ||
<ArrowButton to={`/month/${prevMonth + 1}`}> | ||
<ArrowLeft /> | ||
</ArrowButton> | ||
<Link to={`/month/${selectedMonthNum}`}> | ||
<Typography variant="h6" display="flex" alignItems="center"> | ||
{t(`month_${monthNum}`)} | ||
</Typography> | ||
</Link> | ||
<ArrowButton to={`/month/${nextMonth + 1}`}> | ||
<ArrowRight /> | ||
</ArrowButton> | ||
</Fragment> | ||
) : ( | ||
<Fragment> | ||
<ArrowButton to={`/`}> | ||
<ArrowLeft /> | ||
<Typography>Return to current month</Typography> | ||
</ArrowButton> | ||
</Fragment> | ||
)} | ||
</ShadowBox> | ||
); | ||
}; | ||
|
||
export default MonthBar; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters