A month, and a range that grows from the first day you pick toward the second.
The prompt25,598 characters
Add the "Calendar" component from notboring to my project.
It is licensed for use in my projects — notboring.dev/license. Please:
1. Create the component at a sensible path for this
project, named Calendar, from the source below.
2. It needs nothing beyond React.
3. Add the CSS to the project's stylesheet.
4. THE PART THAT NEEDS YOUR JUDGMENT. The CSS reads
these custom properties and does not define them:
--card
--font-ui
--ink
--ink-3
--ink-4
--ink-5
--ink-rgb
They are notboring's design tokens. Map each one to
whatever this project already uses for the same
job — its own ink, ground, surface and UI font —
rather than defining them as new globals. If the
project has no equivalent, define it locally on
the component's own root so nothing leaks out.
Anything ending -rgb wants three bare numbers,
because the CSS builds rgba() from it.
Keep the comments. They say why the numbers are what
they are, and they are most of what makes this worth
copying rather than rewriting.
--- Calendar.tsx ---
import { useEffect, useRef, useState } from "react";
/* ══ Calendar ═════════════════════════════════════════════
A month, and a range drawn across it.
THE RANGE GROWS FROM THE FIRST DAY YOU PICK TOWARD THE
SECOND. Press a day and it is the start; move, and the span
is drawn out behind the pointer as a wash that reaches
from the start to wherever you are; press again and the
end is fixed and the wash settles between the two. The
range is never a thing you are shown after the fact — you
watch it being drawn, which is how a person marks days on
paper.
ONE WASH PER WEEK, NOT ONE PER DAY. The obvious build gives
every cell an "in range" class, and thirty cells lighting
up one after another read as a selection being counted.
Each week row here carries a single bar whose left and
width are ARITHMETIC on the start and the hovered day's
column, so a row's wash is one thing changing width, and a
range being drawn is what that looks like. Its ends are
round only where the span actually begins or ends; where
it continues into the next row it runs square to the edge,
because a bar that stops with a rounded cap at the end of
The rest — the source and its comments — is what you are buying.