An email field whose button becomes the confirmation.
The prompt19,060 characters
Add the "Newsletter" 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 Newsletter, 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-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.
--- Newsletter.tsx ---
import { useEffect, useId, useRef, useState } from "react";
/* ══ Newsletter ═══════════════════════════════════════════
A title, a line, a field, and the button inside it.
THE BUTTON BECOMES THE CONFIRMATION. The usual build swaps
the whole form for a thank-you card — the field vanishes,
a box appears, and the person who just typed their address
has to find their bearings on a new surface. Here nothing
appears. The button they pressed grows leftward until it
fills the well it was sitting in, and the word on it
changes to the answer. One object, the one they were
already looking at, saying "done" by taking up the room the
question used to.
THE RIGHT EDGE NEVER MOVES. The pill is placed by its width
alone: the left edge is the well's right inset less the
width, so growing it leftward is one number moving and the
right end is stationary by arithmetic rather than by two
animations agreeing — the slide-to-confirm rule. An `x` and
a `width` on separate springs start a frame apart and
drift, and the far end wobbles; a width read once cannot.
And it goes back. Two and a half seconds of "You're in" and
The rest — the source and its comments — is what you are buying.