Heatmap CalendarLoading saved progress…

Heatmap Calendar

A heatmap calendar places one activity cell per day and uses color intensity to show relative volume. Build a deterministic 84-day React calendar whose 7 rows represent weekdays and whose 12 columns represent weeks, then reveal exact counts through a shared status line.

Signature

Implement the interaction in App.tsx. The root App component receives no props; the starter already builds the fixed days array and renders the full calendar, legend, and live status region.

Examples

  • On load, all 84 cells appear in 7 rows and 12 columns, the five-step LessMore legend is visible, and the status reads Hover a day.
  • Hovering day index 45 shows 6 contributions — day 45.
  • Focusing the same day button with the keyboard shows the same text.
  • Moving to or focusing another day replaces the status text; the cells and their colors do not change.

Notes

  • Fixed data. For each index i from 0 through 83, use level = (i * 3 + (i % 7)) % 5 and count = level * 2 + (i % 3). Build this array once outside App.
  • Five intensities. Apply cell l${level} so levels 0 through 4 map to the five existing CSS colors.
  • Column-major layout. Keep one flat array. Seven explicit grid rows and grid-auto-flow: column place indices 0–6 in week one, 7–13 in week two, and so on.
  • One active index. Store number | null with useState. Both onMouseEnter and onFocus set the same index, and the status is derived from it.
  • Accessible cells. Preserve each day as a focusable button with its count in aria-label; keep the result in the existing polite live region.
  • Fixed status, not a popup. This exercise uses the line below the legend rather than a floating tooltip. Do not add positioning logic.
WE’RE LISTENING

Help make UIReady better

Found a bug or have an idea? Tell us about it.

Up to 3 files · 5 MiB each · JPG, PNG, WebP, MP4, WebM, MP3, M4A or WAV