Files
IllusionandClaude Opus 5 19fab4a783 Match the shipped styling to the Claude Design drafts
An audit of all twelve draft files against the build turned up a set of
mismatches, most of them in the tier-2 token layer rather than in any one
component. Tier 1 is untouched throughout - only the meanings moved.

SHAPE. The drafts draw three corners, not five: 2px for a tag, thumbnail,
flag or checkbox, 4px for anything with a box, and fully round for a filter
chip or status pill. Nothing in any draft is 8px or 12px. --radius-card and
--radius-surface therefore come down to radius/sm, a --radius-chip is added
for the 2px tier, and --radius-control-lg - a quirk of the Figma Button
frame's ghost cells - is retired along with its four consumers.

ELEVATION. A shadow is a fraction of the ground it falls on, and the ramp
was tuned for a white page: on the drafts' near-black ground a 12-28% black
is invisible. Tier 1 gains the two deep steps the drafts actually draw
(--shadow-dark-lg/xl), and --elevation-card/-popover/-modal move into the
per-surface blocks so the dark surface can take them while the light one
keeps the soft ramp. A resting card now has no shadow at all - the drafts
separate with a hairline - and the black is spent on what floats.

CARDS. The hover was a white-24% hairline and a faint glow; the drafts turn
the hairline accent green, lift the card 6px and land a deep black under it.
The lift is pointer-only and is dropped under prefers-reduced-motion.

GHOST IS A TEXT LINK. The drafts never fill a ghost control - every
"All updates ->" is plain text that turns green while the label-to-arrow gap
opens. The tokens carry no fill in any state and the variant opts out of the
3px lift, which also retires the WCAG workaround the old Figma hover forced
(green label on a green fill, 1.40:1).

NAVIGATION. A nav label rests in text/secondary and brightens to primary;
the current section stays primary and is marked by the accent rule, not by
green text.

HERO STRIPE. The middle block was painted near-black against a comment
claiming the redesign had dropped white; the drafts paint it #F8F9FA. Back
to background/inverse, and to the drafts' 390 : 495 : 363 split.

styles/README.md is updated to match, including a contrast table that still
described --surface-raised as the retired #2e2e2c.

Not changed, because each is a decision rather than a defect: the drafts set
every eyebrow, tag and meta line in IBM Plex Mono at 10-11px with 1.2-1.4px
tracking (a third typeface, and no Arabic counterpart); draft headings are
weight 800, which needs a font file we do not have; and the EU badge
statement stays at --text-primary, since the visibility lockup is
contractual.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-20 11:14:15 +02:00

101 lines
3.3 KiB
TypeScript

/* ============================================================================
Card.CTA - Figma 25:802 (720 x 141)
----------------------------------------------------------------------------
A call to action on the accent fill: eyebrow, headline, supporting line and
one outlined action. The action is the only interactive element, so this
card is never stretched over a link.
The panel carries data-surface="dark" because it is a dark green field
whatever the page around it is doing: inside it the focus ring, the hover
veil and every text role resolve for a dark background, on a light page too.
USAGE
-----
<Card.CTA
eyebrow="Ready to join us?"
headline="Empower your local community"
body="Apply now to join the upcoming civil dialogue summit and help draft public policies."
action={{ href: "/en/opportunities", label: "Learn more" }}
/>
// Arabic
<Card.CTA
headline="مكّن مجتمعك المحلي"
action={{ href: "/ar/opportunities", label: "اعرف المزيد" }}
/>
// External application form
<Card.CTA
headline="Call for expression of interest"
action={{ href: "https://forms.example.org/eoi", label: "Apply" }}
/>
========================================================================= */
import { Button } from "../Button";
import { CardLink, cx } from "./CardShell";
import type { CardLinkTarget, CardTitleElement } from "./types";
export interface CardCTAAction extends CardLinkTarget {
label: string;
}
export interface CardCTAProps {
headline: string;
action: CardCTAAction;
/** Small line above the headline ("Ready to join us?"). */
eyebrow?: string;
body?: string;
headlineAs?: CardTitleElement;
className?: string;
}
export function CardCTA({
headline,
action,
eyebrow,
body,
headlineAs = "h2",
className,
}: CardCTAProps) {
const Headline = headlineAs;
const { label, ...destination } = action;
return (
<section
data-surface="dark"
className={cx(
"sh-card relative flex flex-col gap-lg rounded-surface p-10",
/* The drafts rest nothing on a shadow - a panel is a fill and an edge,
and the black is spent on what floats. --elevation-card is that
resting step: none on the dark surface, soft on the light one. */
"bg-surface-accent text-text-on-accent shadow-[var(--elevation-card)]",
"sm:flex-row sm:items-center",
className,
)}
>
<div className="flex flex-1 flex-col gap-xs">
{eyebrow ? <p className="label-md">{eyebrow}</p> : null}
<Headline className="heading-h3">{headline}</Headline>
{/* Figma dims this line to 90%; left at full strength because white on
the accent green is already close to the AA floor. */}
{body ? <p className="body-md">{body}</p> : null}
</div>
{/* The outlined action is the project Button, not a look-alike: inside
this dark subtree its secondary variant already resolves to the white
stroke and white label the design asks for. CardLink keeps internal
hrefs routing client-side and external ones a plain anchor. */}
<Button
as={CardLink}
variant="secondary"
className="sh-card-cta-action shrink-0"
{...destination}
>
{label}
</Button>
</section>
);
}