Skip to content

Instantly share code, notes, and snippets.

@ryanflorence
Created January 29, 2019 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanflorence/ba46eb6d1cc32f36f2ff75c101337e6c to your computer and use it in GitHub Desktop.
Save ryanflorence/ba46eb6d1cc32f36f2ff75c101337e6c to your computer and use it in GitHub Desktop.
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