feat(island): landing type, tokens, section heading, sample frame, fact card

Add the landing's own display type (hero and section Typography variants),
a page container, an image shade and a 720px tablet breakpoint used only by
the landing's grids (0028). Add three domain-free molecules the landing
shares: SectionHeading, SampleFrame (real components with made-up data,
inert and labelled) and FactCard.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Amiram_se 2026-10-07 23:02:58 +04:00
parent 9877d7bf14
commit 2be04f9d1d
15 changed files with 292 additions and 4 deletions

View File

@ -2,7 +2,10 @@ import { cva } from 'class-variance-authority';
export const typographyVariants = cva('', {
variants: {
/** The design system's ten text styles; each sets size, line height and weight. */
/**
* The design system's ten text styles; each sets size, line height and weight. `hero` and
* `section` are the landing's own display type.
*/
variant: {
/** Takes size and weight from the parent, such as a label inside a button. */
inherit: '',
@ -16,6 +19,10 @@ export const typographyVariants = cva('', {
label: 'text-label',
caption: 'text-caption',
micro: 'text-micro',
/** The landing's h1 only: larger from the tablet and desktop widths. */
hero: 'text-hero text-balance tablet:text-hero-md desktop:text-hero-lg',
/** The landing's section titles. */
section: 'text-section text-balance tablet:text-section-lg',
},
/** Semantic text colours. Status hues use their `-text` shade, which passes 4.5:1. */
color: {

View File

@ -117,6 +117,8 @@ export { EmptyState } from './molecules/empty-state';
export type { EmptyStateProps, EmptyStateTone } from './molecules/empty-state';
export { ERROR_KIND_STYLES, ErrorState } from './molecules/error-state';
export type { ErrorKind, ErrorStateProps } from './molecules/error-state';
export { FactCard } from './molecules/fact-card';
export type { FactCardProps } from './molecules/fact-card';
export { FormSection } from './molecules/form-section';
export type { FormSectionProps } from './molecules/form-section';
export { LockedTeaser } from './molecules/locked-teaser';
@ -141,6 +143,13 @@ export type {
ResendCodeProps,
ResendStatus,
} from './molecules/resend-code';
export { SampleFrame, sampleTagVariants } from './molecules/sample-frame';
export type { SampleFrameProps } from './molecules/sample-frame';
export {
SectionHeading,
sectionHeadingVariants,
} from './molecules/section-heading';
export type { SectionHeadingProps } from './molecules/section-heading';
export {
SegmentedChoice,
segmentedChoiceOptionVariants,

View File

@ -0,0 +1,48 @@
import { FlexBox } from '../../atoms/flex-box';
import { GridBox } from '../../atoms/grid-box';
import { Icon } from '../../atoms/icon';
import { Typography } from '../../atoms/typography';
import { cn } from '../../tools/cn';
import type { FactCardProps } from './types';
/** One product fact on its own card, so each reads alone: an icon tile, a bold title and a line. */
export function FactCard({
icon,
title,
description,
tag = 'div',
className,
}: FactCardProps) {
return (
<FlexBox
tag={tag}
alignItems="items-start"
gap="gap-3"
className={cn(
'rounded-lg border border-border-subtle bg-surface px-4 py-3',
className,
)}
>
<GridBox
justifyItems="justify-items-center"
alignItems="items-center"
className="size-10 flex-none rounded-md bg-action-primary-subtle text-action-primary"
>
<Icon name={icon} />
</GridBox>
<FlexBox direction="flex-col" className="min-w-0">
<Typography tag="span" variant="label" className="font-bold">
{title}
</Typography>
<Typography
tag="span"
variant="body-sm"
color="secondary"
className="text-pretty"
>
{description}
</Typography>
</FlexBox>
</FlexBox>
);
}

View File

@ -0,0 +1,2 @@
export { FactCard } from './FactCard';
export type { FactCardProps } from './types';

View File

@ -0,0 +1,12 @@
import type { ReactNode } from 'react';
import type { IconName } from '../../atoms/icon';
export type FactCardProps = {
icon: IconName;
title: ReactNode;
description: ReactNode;
/** `li` inside a list of facts. */
tag?: 'div' | 'li';
className?: string;
};

View File

@ -0,0 +1,54 @@
import { FlexBox } from '../../atoms/flex-box';
import { Icon } from '../../atoms/icon';
import { Typography } from '../../atoms/typography';
import type { SampleFrameProps } from './types';
import { sampleTagVariants } from './variants';
/**
* A picture of the product made of its real components with made-up data: labelled «نمونه», never
* focusable or clickable, and hidden from screen readers, which read the caption instead.
*/
export function SampleFrame({
tag,
caption,
tone,
children,
className,
}: SampleFrameProps) {
return (
<FlexBox
tag="figure"
direction="flex-col"
gap="gap-2"
className={className}
>
<FlexBox
alignItems="items-center"
gap="gap-1"
className={sampleTagVariants({ tone })}
>
<Icon name="eye" size={16} />
<Typography
tag="span"
variant="caption"
color="inherit"
className="font-semibold"
>
{tag}
</Typography>
</FlexBox>
<FlexBox
direction="flex-col"
gap="gap-3"
inert
aria-hidden
className="pointer-events-none select-none"
>
{children}
</FlexBox>
<Typography tag="figcaption" variant="caption" color="secondary">
{caption}
</Typography>
</FlexBox>
);
}

View File

@ -0,0 +1,3 @@
export { SampleFrame } from './SampleFrame';
export type { SampleFrameProps } from './types';
export { sampleTagVariants } from './variants';

View File

@ -0,0 +1,14 @@
import type { ReactNode } from 'react';
import type { sampleTagVariants } from './variants';
import type { VariantProps } from 'class-variance-authority';
export type SampleFrameProps = VariantProps<typeof sampleTagVariants> & {
/** The label over the sample: «نمونه». */
tag: ReactNode;
/** Says the data is made up; screen readers read it in place of the sample. */
caption: ReactNode;
/** Real components fed with fixed sample data. */
children: ReactNode;
className?: string;
};

View File

@ -0,0 +1,15 @@
import { cva } from 'class-variance-authority';
/** The «نمونه» label: sunken on a page ground, white on a tinted panel. */
export const sampleTagVariants = cva(
'self-start rounded-sm px-2 text-text-secondary',
{
variants: {
tone: {
sunken: 'bg-surface-sunken',
surface: 'bg-surface',
},
},
defaultVariants: { tone: 'sunken' },
},
);

View File

@ -0,0 +1,57 @@
import { FlexBox } from '../../atoms/flex-box';
import { Icon } from '../../atoms/icon';
import { Typography } from '../../atoms/typography';
import { cn } from '../../tools/cn';
import type { SectionHeadingProps } from './types';
import { sectionHeadingVariants } from './variants';
/**
* A marketing section's heading: an optional kicker in the brand colour, the `h2` and a lead. The
* section labels itself with the title through `titleId`.
*/
export function SectionHeading({
titleId,
kicker,
kickerIcon,
title,
lead,
align,
className,
}: SectionHeadingProps) {
return (
<FlexBox
direction="flex-col"
gap="gap-2"
className={cn(sectionHeadingVariants({ align }), className)}
>
{kicker && (
<FlexBox
alignItems="items-center"
gap="gap-1"
className="text-action-primary-text"
>
{kickerIcon && <Icon name={kickerIcon} size={16} />}
<Typography
tag="span"
variant="caption"
color="brand"
className="font-bold"
>
{kicker}
</Typography>
</FlexBox>
)}
<Typography tag="h2" id={titleId} variant="section">
{title}
</Typography>
{lead && (
<Typography
color="secondary"
className="text-pretty tablet:text-body-lg"
>
{lead}
</Typography>
)}
</FlexBox>
);
}

View File

@ -0,0 +1,3 @@
export { SectionHeading } from './SectionHeading';
export type { SectionHeadingProps } from './types';
export { sectionHeadingVariants } from './variants';

View File

@ -0,0 +1,18 @@
import type { ReactNode } from 'react';
import type { IconName } from '../../atoms/icon';
export type SectionHeadingProps = {
/** The `h2`'s id, for its section's `aria-labelledby`. */
titleId: string;
/** A short line over the title in the brand colour, such as «بازارها». */
kicker?: ReactNode;
/** An icon before the kicker. */
kickerIcon?: IconName;
title: ReactNode;
/** One or two sentences under the title. */
lead?: ReactNode;
/** `center` for a section that is centred as a whole (the markets, the FAQ). */
align?: 'start' | 'center';
className?: string;
};

View File

@ -0,0 +1,11 @@
import { cva } from 'class-variance-authority';
export const sectionHeadingVariants = cva('max-w-170', {
variants: {
align: {
start: '',
center: 'mx-auto items-center text-center',
},
},
defaultVariants: { align: 'start' },
});

View File

@ -50,6 +50,23 @@
--text-micro: 0.6875rem;
--text-micro--line-height: 1.125rem;
--text-micro--font-weight: 500;
/* The landing's own display type (/), a step above `display`: its h1 and its section titles.
Typography's `hero` and `section` variants step them up at the tablet and desktop widths. */
--text-hero: 1.75rem;
--text-hero--line-height: 2.5rem;
--text-hero--font-weight: 800;
--text-hero-md: 2.125rem;
--text-hero-md--line-height: 3.125rem;
--text-hero-md--font-weight: 800;
--text-hero-lg: 2.875rem;
--text-hero-lg--line-height: 4.125rem;
--text-hero-lg--font-weight: 800;
--text-section: 1.5rem;
--text-section--line-height: 2.25rem;
--text-section--font-weight: 700;
--text-section-lg: 1.875rem;
--text-section-lg--line-height: 2.75rem;
--text-section-lg--font-weight: 700;
/* 4px grid: space-1 … space-16 map to Tailwind's numeric spacing (p-4 = 1rem = 16px). */
--spacing: 0.25rem;
@ -62,6 +79,8 @@
--container-checkout: 30rem;
--container-form: 35rem;
--container-content: 40rem;
/* The landing's sections: wide content with its own gutters. */
--container-page: 74rem;
--radius-xs: 4px;
--radius-sm: 6px;
--radius-md: 8px;
@ -76,8 +95,10 @@
--shadow-3:
0 24px 48px -12px rgba(12, 16, 24, 0.28),
0 8px 16px -8px rgba(12, 16, 24, 0.16);
/* No `tablet` (768px) breakpoint: bull keeps the bottom navigation up to 1024px,
and bear starts at 1024px, so layout never switches below that. */
/* Not the design system's 768px tablet switch: bull keeps the bottom navigation up to 1024px,
and bear starts at 1024px, so app layout never switches below that. Only the landing (/)
uses `tablet`, for its wider grids in bull from 720px; never navigation. */
--breakpoint-tablet: 720px;
--breakpoint-desktop: 1024px;
--breakpoint-wide: 1280px;
--ease-standard: cubic-bezier(0.2, 0, 0, 1);
@ -214,6 +235,8 @@
--surface-inverse: var(--slate-900);
--scrim: rgba(12, 16, 24, 0.48);
--lightbox: #000000;
/* The gradient that keeps white text readable on an image (the landing hero on mobile). */
--image-shade: #000000;
--text-primary: var(--slate-900);
--text-secondary: var(--slate-600);
--text-tertiary: var(--slate-500);
@ -285,6 +308,7 @@
--color-surface-inverse: var(--surface-inverse);
--color-scrim: var(--scrim);
--color-lightbox: var(--lightbox);
--color-image-shade: var(--image-shade);
--color-text-primary: var(--text-primary);
--color-text-secondary: var(--text-secondary);
--color-text-tertiary: var(--text-tertiary);

View File

@ -10,6 +10,11 @@ export const TEXT_SIZES = [
'label',
'caption',
'micro',
'hero',
'hero-md',
'hero-lg',
'section',
'section-lg',
] as const;
export const SHADOWS = [
@ -32,7 +37,13 @@ export const NAMED_SPACING = [
] as const;
/** Container widths from theme.css, used as `w-*` and `max-w-*`. */
export const CONTAINERS = ['mobile', 'checkout', 'form', 'content'] as const;
export const CONTAINERS = [
'mobile',
'checkout',
'form',
'content',
'page',
] as const;
/** z-index layers from utilities.css, so `z-overlay` replaces `z-sticky`. */
export const Z_LAYERS = [