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>
115 lines
3.6 KiB
TypeScript
115 lines
3.6 KiB
TypeScript
/* ============================================================================
|
|
Card.Content - Figma 25:752 (360 x 372)
|
|
----------------------------------------------------------------------------
|
|
The news / blog / programme card: image, category badge, eyebrow, title,
|
|
excerpt and a "Read more" affordance. The whole card is one link.
|
|
|
|
USAGE
|
|
-----
|
|
<ul className="grid gap-lg sm:grid-cols-2 lg:grid-cols-3">
|
|
<Card.Content
|
|
as="li"
|
|
href="/en/news/civic-dialogue"
|
|
eyebrow="Programme"
|
|
badge="Rule of Law"
|
|
title="Strengthening Civic Dialogue"
|
|
excerpt="Supporting coordinated efforts among institutions, civil society,
|
|
and local actors to foster community resilience."
|
|
actionLabel="Read more"
|
|
image={{ src: "/media/dialogue.jpg", alt: "" }}
|
|
/>
|
|
</ul>
|
|
|
|
// Arabic - the copy is the only thing that changes, RTL mirrors itself.
|
|
<Card.Content
|
|
href="/ar/news/civic-dialogue"
|
|
title="تعزيز الحوار المدني"
|
|
actionLabel="اقرأ المزيد"
|
|
image={{ src: "/media/dialogue.jpg", alt: "" }}
|
|
/>
|
|
|
|
// Above the fold - skip lazy loading for the lead card only.
|
|
<Card.Content … image={{ src: "/media/lead.jpg", alt: "", priority: true }} />
|
|
========================================================================= */
|
|
|
|
import {
|
|
CardActionHint,
|
|
CardEyebrow,
|
|
CardLink,
|
|
CardMedia,
|
|
CardShell,
|
|
cx,
|
|
} from "./CardShell";
|
|
import type { CardElement, CardImage, CardTitleElement } from "./types";
|
|
|
|
export interface CardContentProps {
|
|
/** Where the whole card goes. */
|
|
href: string;
|
|
title: string;
|
|
/**
|
|
* Label of the "Read more" affordance. Required rather than defaulted so an
|
|
* Arabic page cannot silently ship the English string.
|
|
*/
|
|
actionLabel: string;
|
|
/** Accent kicker above the title, rendered uppercase. */
|
|
eyebrow?: string;
|
|
excerpt?: string;
|
|
/** Chip over the top-inline-start corner of the image ("Rule of Law"). */
|
|
badge?: string;
|
|
image?: CardImage;
|
|
as?: CardElement;
|
|
/** Heading level - match the surrounding page outline. */
|
|
titleAs?: CardTitleElement;
|
|
className?: string;
|
|
}
|
|
|
|
export function CardContent({
|
|
href,
|
|
title,
|
|
actionLabel,
|
|
eyebrow,
|
|
excerpt,
|
|
badge,
|
|
image,
|
|
as = "article",
|
|
titleAs = "h3",
|
|
className,
|
|
}: CardContentProps) {
|
|
const Title = titleAs;
|
|
|
|
return (
|
|
<CardShell as={as} linked className={cx("flex-col overflow-hidden", className)}>
|
|
{image ? (
|
|
<CardMedia image={image} className="aspect-[9/5] w-full">
|
|
{/* The chip sits on a scrim over the photo, so its label has to stay
|
|
light on both surfaces - text-on-accent is the only always-white
|
|
role, text-primary would go dark on the light surface. */}
|
|
{badge ? (
|
|
<span className="absolute start-md top-md rounded-chip bg-overlay-scrim px-xs py-2xs label-md text-text-on-accent backdrop-blur-[4px]">
|
|
{badge}
|
|
</span>
|
|
) : null}
|
|
</CardMedia>
|
|
) : null}
|
|
|
|
<div className="flex flex-col gap-md p-lg">
|
|
<div className="flex flex-col gap-xs">
|
|
{eyebrow ? <CardEyebrow>{eyebrow}</CardEyebrow> : null}
|
|
|
|
<Title className="sh-card-title body-lg-bold text-text-primary">
|
|
<CardLink href={href} className="sh-card-link">
|
|
{title}
|
|
</CardLink>
|
|
</Title>
|
|
|
|
{excerpt ? (
|
|
<p className="body-sm text-text-secondary line-clamp-3">{excerpt}</p>
|
|
) : null}
|
|
</div>
|
|
|
|
<CardActionHint label={actionLabel} />
|
|
</div>
|
|
</CardShell>
|
|
);
|
|
}
|