From 2be04f9d1d601b8514dcf701af053aaa69ef0375 Mon Sep 17 00:00:00 2001 From: Amiram_se Date: Wed, 7 Oct 2026 23:02:58 +0400 Subject: [PATCH] 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 --- .../island/src/atoms/typography/variants.ts | 9 ++- packages/island/src/index.ts | 9 +++ .../src/molecules/fact-card/FactCard.tsx | 48 ++++++++++++++++ .../island/src/molecules/fact-card/index.ts | 2 + .../island/src/molecules/fact-card/types.ts | 12 ++++ .../molecules/sample-frame/SampleFrame.tsx | 54 ++++++++++++++++++ .../src/molecules/sample-frame/index.ts | 3 + .../src/molecules/sample-frame/types.ts | 14 +++++ .../src/molecules/sample-frame/variants.ts | 15 +++++ .../section-heading/SectionHeading.tsx | 57 +++++++++++++++++++ .../src/molecules/section-heading/index.ts | 3 + .../src/molecules/section-heading/types.ts | 18 ++++++ .../src/molecules/section-heading/variants.ts | 11 ++++ packages/island/src/styles/theme.css | 28 ++++++++- packages/island/src/tools/cn/constants.ts | 13 ++++- 15 files changed, 292 insertions(+), 4 deletions(-) create mode 100644 packages/island/src/molecules/fact-card/FactCard.tsx create mode 100644 packages/island/src/molecules/fact-card/index.ts create mode 100644 packages/island/src/molecules/fact-card/types.ts create mode 100644 packages/island/src/molecules/sample-frame/SampleFrame.tsx create mode 100644 packages/island/src/molecules/sample-frame/index.ts create mode 100644 packages/island/src/molecules/sample-frame/types.ts create mode 100644 packages/island/src/molecules/sample-frame/variants.ts create mode 100644 packages/island/src/molecules/section-heading/SectionHeading.tsx create mode 100644 packages/island/src/molecules/section-heading/index.ts create mode 100644 packages/island/src/molecules/section-heading/types.ts create mode 100644 packages/island/src/molecules/section-heading/variants.ts diff --git a/packages/island/src/atoms/typography/variants.ts b/packages/island/src/atoms/typography/variants.ts index 86479ab..77584d4 100644 --- a/packages/island/src/atoms/typography/variants.ts +++ b/packages/island/src/atoms/typography/variants.ts @@ -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: { diff --git a/packages/island/src/index.ts b/packages/island/src/index.ts index 0e460f3..b71177a 100644 --- a/packages/island/src/index.ts +++ b/packages/island/src/index.ts @@ -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, diff --git a/packages/island/src/molecules/fact-card/FactCard.tsx b/packages/island/src/molecules/fact-card/FactCard.tsx new file mode 100644 index 0000000..bae6d6f --- /dev/null +++ b/packages/island/src/molecules/fact-card/FactCard.tsx @@ -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 ( + + + + + + + {title} + + + {description} + + + + ); +} diff --git a/packages/island/src/molecules/fact-card/index.ts b/packages/island/src/molecules/fact-card/index.ts new file mode 100644 index 0000000..c8599b2 --- /dev/null +++ b/packages/island/src/molecules/fact-card/index.ts @@ -0,0 +1,2 @@ +export { FactCard } from './FactCard'; +export type { FactCardProps } from './types'; diff --git a/packages/island/src/molecules/fact-card/types.ts b/packages/island/src/molecules/fact-card/types.ts new file mode 100644 index 0000000..df248e5 --- /dev/null +++ b/packages/island/src/molecules/fact-card/types.ts @@ -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; +}; diff --git a/packages/island/src/molecules/sample-frame/SampleFrame.tsx b/packages/island/src/molecules/sample-frame/SampleFrame.tsx new file mode 100644 index 0000000..af6a112 --- /dev/null +++ b/packages/island/src/molecules/sample-frame/SampleFrame.tsx @@ -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 ( + + + + + {tag} + + + + {children} + + + {caption} + + + ); +} diff --git a/packages/island/src/molecules/sample-frame/index.ts b/packages/island/src/molecules/sample-frame/index.ts new file mode 100644 index 0000000..37cb54d --- /dev/null +++ b/packages/island/src/molecules/sample-frame/index.ts @@ -0,0 +1,3 @@ +export { SampleFrame } from './SampleFrame'; +export type { SampleFrameProps } from './types'; +export { sampleTagVariants } from './variants'; diff --git a/packages/island/src/molecules/sample-frame/types.ts b/packages/island/src/molecules/sample-frame/types.ts new file mode 100644 index 0000000..9fb4044 --- /dev/null +++ b/packages/island/src/molecules/sample-frame/types.ts @@ -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 & { + /** 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; +}; diff --git a/packages/island/src/molecules/sample-frame/variants.ts b/packages/island/src/molecules/sample-frame/variants.ts new file mode 100644 index 0000000..dfb4b35 --- /dev/null +++ b/packages/island/src/molecules/sample-frame/variants.ts @@ -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' }, + }, +); diff --git a/packages/island/src/molecules/section-heading/SectionHeading.tsx b/packages/island/src/molecules/section-heading/SectionHeading.tsx new file mode 100644 index 0000000..a48b103 --- /dev/null +++ b/packages/island/src/molecules/section-heading/SectionHeading.tsx @@ -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 ( + + {kicker && ( + + {kickerIcon && } + + {kicker} + + + )} + + {title} + + {lead && ( + + {lead} + + )} + + ); +} diff --git a/packages/island/src/molecules/section-heading/index.ts b/packages/island/src/molecules/section-heading/index.ts new file mode 100644 index 0000000..c9aa1c9 --- /dev/null +++ b/packages/island/src/molecules/section-heading/index.ts @@ -0,0 +1,3 @@ +export { SectionHeading } from './SectionHeading'; +export type { SectionHeadingProps } from './types'; +export { sectionHeadingVariants } from './variants'; diff --git a/packages/island/src/molecules/section-heading/types.ts b/packages/island/src/molecules/section-heading/types.ts new file mode 100644 index 0000000..d2fedf9 --- /dev/null +++ b/packages/island/src/molecules/section-heading/types.ts @@ -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; +}; diff --git a/packages/island/src/molecules/section-heading/variants.ts b/packages/island/src/molecules/section-heading/variants.ts new file mode 100644 index 0000000..82e68ce --- /dev/null +++ b/packages/island/src/molecules/section-heading/variants.ts @@ -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' }, +}); diff --git a/packages/island/src/styles/theme.css b/packages/island/src/styles/theme.css index 179f222..92750d5 100644 --- a/packages/island/src/styles/theme.css +++ b/packages/island/src/styles/theme.css @@ -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); diff --git a/packages/island/src/tools/cn/constants.ts b/packages/island/src/tools/cn/constants.ts index 470ec01..d765a90 100644 --- a/packages/island/src/tools/cn/constants.ts +++ b/packages/island/src/tools/cn/constants.ts @@ -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 = [