Created
January 29, 2019 18:30
-
-
Save ryanflorence/ba46eb6d1cc32f36f2ff75c101337e6c to your computer and use it in GitHub Desktop.
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
const MiniCalendar = ({ date }) => { | |
const days = getSessionDaysOfWeek(date) | |
return ( | |
<div css={{ display: "flex" }}> | |
{["S", "M", "T", "W", "Th", "F", "S"].map((dayText, day) => { | |
const isActive = day >= days.start && day <= days.end | |
return ( | |
<div | |
key={day} | |
css={{ | |
textAlign: "center", | |
marginTop: "0.25em", | |
marginRight: "0.5em", | |
opacity: isActive ? 1 : 0.25, | |
fontSize: "75%", | |
fontWeight: "bold" | |
}} | |
> | |
{dayText} | |
</div> | |
) | |
})} | |
</div> | |
) | |
} | |
// Usage | |
<MiniCalendar data="2019-05-01"/> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment