
Kiri Dome Task Lamp
Spun aluminum dome lamp with a weighted travertine plinth and stepless 2700K touch dimmer.
Editorial storefront product gallery pairing a two-column collection header, segmented category filter, live bag counter with toast feedback, selectable finish swatches, edition badges, and a responsive 1:1 studio product grid.
Each piece is turned, kiln-fired, or milled in small Kyoto and Portland runs. Tactile finishes soften with daily use and bring stillness to the work surface.

Spun aluminum dome lamp with a weighted travertine plinth and stepless 2700K touch dimmer.

Asymmetric solid-milled light bar engineered to brighten notebooks without screen glare.

Hand-pleated Mino washi shade set on oiled hinoki struts for calm ambient evening light.

Wheel-thrown stoneware cylinder carved with sixteen flutes and finished in matte ash glaze.

Low-profile porcelain valet dish with a gently raised lip for keys, fountain pens, and tools.

Two-piece stoneware dripper and thermal server proportioned for a single unhurried morning pour.

Solid lathe-turned C360 brass monolith with a cork foot that builds a warm patina with use.

Folded powder-coated steel organizer paired with an etched 20 cm millimeter scale and walnut rest.
1npx stylexblocks add product-gallery123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924import * as stylex from "@stylexjs/stylex";import { useCallback, useMemo, useRef, useState } from "react";import { AspectRatio } from "#components/ui/ui-sdk/aspect-ratio.tsx";import { Badge } from "#components/ui/ui-sdk/badge.tsx";import { Button } from "#components/ui/ui-sdk/button.tsx";import { Card } from "#components/ui/ui-sdk/card.tsx";import { ColorSwatch } from "#components/ui/ui-sdk/color-swatch.tsx";import { Grid } from "#components/ui/ui-sdk/grid.tsx";import { Heading } from "#components/ui/ui-sdk/heading.tsx";import { Icon } from "#components/ui/ui-sdk/icon.tsx";import { Section } from "#components/ui/ui-sdk/section.tsx";import { SegmentGroup } from "#components/ui/ui-sdk/segment-group.tsx";import { Separator } from "#components/ui/ui-sdk/separator.tsx";import { HStack, VStack } from "#components/ui/ui-sdk/stack.tsx";import { Text } from "#components/ui/ui-sdk/text.tsx";import { Toast, Toaster } from "#components/ui/ui-sdk/toast.tsx";import { semanticColors } from "@stylexblocks/ui/semantic-tokens/colors.stylex.ts";import { semanticRadii } from "@stylexblocks/ui/semantic-tokens/radii.stylex.ts";import { semanticShadows } from "@stylexblocks/ui/semantic-tokens/shadows.stylex.ts";import { accentPalette, amberPalette, greenPalette,} from "@stylexblocks/ui/themes/palettes.ts";import { durations } from "@stylexblocks/ui/tokens/durations.stylex.ts";import { fonts } from "@stylexblocks/ui/tokens/fonts.stylex.ts";import { lineHeights } from "@stylexblocks/ui/tokens/line-heights.stylex.ts";import { radii } from "@stylexblocks/ui/tokens/radii.stylex.ts";import { spacing } from "@stylexblocks/ui/tokens/spacing.stylex.ts";import type { StyleOverrideProps } from "#lib/recipe-props.ts";
// ─── Types & Demo Data ──────────────────────────────────────────────────────
export type ProductGalleryCategory = "all" | "lighting" | "ceramics" | "desk-tools";
export type ProductGalleryFinishId = | "chalk" | "bronze" | "moss" | "graphite" | "silver" | "champagne" | "washi" | "hinoki" | "charcoal" | "sandstone" | "kuro" | "celadon" | "bone" | "terracotta" | "slate" | "oat" | "espresso" | "brass" | "steel";
export interface ProductGalleryFinish { id: ProductGalleryFinishId; label: string;}
export interface ProductGalleryItem { id: string; name: string; category: Exclude<ProductGalleryCategory, "all">; categoryLabel: string; description: string; price: number; editionBadge?: string; editionTone?: "accent" | "amber" | "green" | "neutral"; finishes: readonly ProductGalleryFinish[]; imageSrc: string; imageAlt: string;}
interface BagEntry { key: string; productId: string; name: string; finishLabel: string; price: number; quantity: number;}
const DEFAULT_PRODUCTS: readonly ProductGalleryItem[] = [ { id: "kiri-dome-lamp", name: "Kiri Dome Task Lamp", category: "lighting", categoryLabel: "Lighting", description: "Spun aluminum dome lamp with a weighted travertine plinth and stepless 2700K touch dimmer.", price: 240, editionBadge: "New", editionTone: "accent", finishes: [ { id: "chalk", label: "Chalk Aluminum" }, { id: "bronze", label: "Smoked Bronze" }, { id: "moss", label: "Moss Anodized" }, ], imageSrc: "/images/blocks/product-gallery/kiri-dome-lamp.webp", imageAlt: "Kiri Dome Task Lamp in spun chalk aluminum casting warm downward light onto a travertine base", }, { id: "sora-linear-bar", name: "Sora Linear Desk Bar", category: "lighting", categoryLabel: "Lighting", description: "Asymmetric solid-milled light bar engineered to brighten notebooks without screen glare.", price: 295, editionBadge: "Limited 50", editionTone: "amber", finishes: [ { id: "graphite", label: "Bead-Blasted Graphite" }, { id: "silver", label: "Raw Silver" }, { id: "champagne", label: "Warm Champagne" }, ], imageSrc: "/images/blocks/product-gallery/sora-linear-bar.webp", imageAlt: "Sora Linear Desk Bar suspended on twin graphite stanchions illuminating a desk plane", }, { id: "haku-paper-lantern", name: "Haku Paper Lantern", category: "lighting", categoryLabel: "Lighting", description: "Hand-pleated Mino washi shade set on oiled hinoki struts for calm ambient evening light.", price: 165, editionBadge: "Numbered", editionTone: "neutral", finishes: [ { id: "washi", label: "Unbleached Washi" }, { id: "hinoki", label: "Smoked Hinoki" }, { id: "charcoal", label: "Charcoal Rib" }, ], imageSrc: "/images/blocks/product-gallery/haku-paper-lantern.webp", imageAlt: "Haku Paper Lantern with hand-pleated warm washi shade resting on a minimalist timber tripod", }, { id: "nami-pen-vessel", name: "Nami Fluted Pen Vessel", category: "ceramics", categoryLabel: "Ceramics", description: "Wheel-thrown stoneware cylinder carved with sixteen flutes and finished in matte ash glaze.", price: 68, editionBadge: "Restocked", editionTone: "green", finishes: [ { id: "sandstone", label: "Raw Sandstone" }, { id: "kuro", label: "Kuro Iron" }, { id: "celadon", label: "Celadon Mist" }, ], imageSrc: "/images/blocks/product-gallery/nami-pen-vessel.webp", imageAlt: "Nami Fluted Pen Vessel in matte sandstone stoneware holding a turned brass drafting stylus", }, { id: "tani-catchall-dish", name: "Tani Catchall Dish", category: "ceramics", categoryLabel: "Ceramics", description: "Low-profile porcelain valet dish with a gently raised lip for keys, fountain pens, and tools.", price: 54, finishes: [ { id: "bone", label: "Bone Matte" }, { id: "terracotta", label: "Terracotta Clay" }, { id: "slate", label: "Slate Ash" }, ], imageSrc: "/images/blocks/product-gallery/tani-catchall-dish.webp", imageAlt: "Tani Catchall Dish in matte bone porcelain holding a brass key ring and minimalist fountain pen", }, { id: "kumo-pourover-carafe", name: "Kumo Pour-Over Carafe", category: "ceramics", categoryLabel: "Ceramics", description: "Two-piece stoneware dripper and thermal server proportioned for a single unhurried morning pour.", price: 92, editionBadge: "Studio Pair", editionTone: "accent", finishes: [ { id: "oat", label: "Oat Speckle" }, { id: "espresso", label: "Espresso Glaze" }, { id: "kuro", label: "Kuro Iron" }, ], imageSrc: "/images/blocks/product-gallery/kumo-carafe.webp", imageAlt: "Kumo Pour-Over Carafe and matching conical stoneware dripper in speckled oat glaze", }, { id: "moku-brass-paperweight", name: "Moku Brass Paperweight", category: "desk-tools", categoryLabel: "Desk Tools", description: "Solid lathe-turned C360 brass monolith with a cork foot that builds a warm patina with use.", price: 78, editionBadge: "Numbered", editionTone: "neutral", finishes: [ { id: "brass", label: "Brushed Brass" }, { id: "bronze", label: "Patinated Bronze" }, { id: "steel", label: "Bead-Blasted Steel" }, ], imageSrc: "/images/blocks/product-gallery/moku-paperweight.webp", imageAlt: "Moku Brass Paperweight shaped as a chamfered cylindrical brass monolith with cork foot", }, { id: "tetsu-tray-ruler-set", name: "Tetsu Tray & Ruler Set", category: "desk-tools", categoryLabel: "Desk Tools", description: "Folded powder-coated steel organizer paired with an etched 20 cm millimeter scale and walnut rest.", price: 115, editionBadge: "Limited 50", editionTone: "amber", finishes: [ { id: "charcoal", label: "Matte Charcoal" }, { id: "chalk", label: "Chalk Aluminum" }, { id: "moss", label: "Moss Anodized" }, ], imageSrc: "/images/blocks/product-gallery/tetsu-tray-set.webp", imageAlt: "Tetsu folded steel desk tray holding an etched millimeter ruler and oiled walnut pencil rest", },];
const CATEGORIES: readonly { id: ProductGalleryCategory; label: string }[] = [ { id: "all", label: "All" }, { id: "lighting", label: "Lighting" }, { id: "ceramics", label: "Ceramics" }, { id: "desk-tools", label: "Desk Tools" },];
function formatPrice(amount: number): string { return `$${amount.toFixed(0)}`;}
// ─── Inline Icons ───────────────────────────────────────────────────────────
function ArrowRightIcon() { return ( <Icon size="sm" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" > <path d="M4.5 10h11" /> <path d="M11 5.5 15.5 10 11 14.5" /> </Icon> );}
function BagIcon() { return ( <Icon size="sm" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.65" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" > <path d="M5 7h10l1 9.5a1 1 0 0 1-1 1.1H5a1 1 0 0 1-1-1.1L5 7Z" /> <path d="M7.5 7V5.5a2.5 2.5 0 0 1 5 0V7" /> </Icon> );}
function PlusIcon() { return ( <Icon size="xs" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" aria-hidden="true" > <path d="M8 3.25v9.5M3.25 8h9.5" /> </Icon> );}
// ─── Styles ─────────────────────────────────────────────────────────────────
const finishSwatchStyles = stylex.create({ chalk: { "--color": "#ece8e0" }, bronze: { "--color": "#7b624c" }, moss: { "--color": "#556859" }, graphite: { "--color": "#3d434b" }, silver: { "--color": "#c9cfd6" }, champagne: { "--color": "#d9ccb6" }, washi: { "--color": "#f4ead7" }, hinoki: { "--color": "#b48c64" }, charcoal: { "--color": "#2f3237" }, sandstone: { "--color": "#d4c5b0" }, kuro: { "--color": "#383533" }, celadon: { "--color": "#9db0a4" }, bone: { "--color": "#f0ebe3" }, terracotta: { "--color": "#ba6d4f" }, slate: { "--color": "#6b747e" }, oat: { "--color": "#dfd4c3" }, espresso: { "--color": "#4f3b2e" }, brass: { "--color": "#c8a452" }, steel: { "--color": "#9da5ae" },});
const styles = stylex.create({ root: { backgroundColor: semanticColors.bg, color: semanticColors.fg, fontFamily: fonts.body, minHeight: "100%", paddingBlock: { default: spacing._10, "@media (max-width: 640px)": spacing._6, }, paddingInline: { default: spacing._6, "@media (max-width: 640px)": spacing._4, }, width: "100%", }, content: { gap: spacing._7, marginInline: "auto", maxWidth: "78rem", width: "100%", }, headerGrid: { gap: { default: spacing._8, "@media (max-width: 820px)": spacing._5, }, gridTemplateColumns: { default: "minmax(0, 1.15fr) minmax(0, 0.85fr)", "@media (max-width: 820px)": "1fr", }, }, headerLeft: { gap: spacing._3_5, }, headline: { marginBlock: 0, maxWidth: "20ch", textWrap: "balance", }, description: { lineHeight: lineHeights.lg, maxWidth: "52ch", }, segmentScroll: { maxWidth: "100%", overflowX: "auto", }, gallerySection: { width: "100%", }, productGrid: { gridTemplateColumns: { default: "repeat(4, minmax(0, 1fr))", "@media (max-width: 1120px)": "repeat(3, minmax(0, 1fr))", "@media (max-width: 820px)": "repeat(2, minmax(0, 1fr))", "@media (max-width: 520px)": "1fr", }, width: "100%", }, mediaCard: { borderColor: { default: semanticColors.border, ":hover": semanticColors.borderEmphasized, }, borderRadius: semanticRadii.panelLg, borderStyle: "solid", boxShadow: { default: semanticShadows.xs, ":hover": semanticShadows.md, }, overflow: "hidden", position: "relative", transitionDuration: durations.moderate, transitionProperty: "border-color, box-shadow", }, aspectFrame: { backgroundColor: semanticColors.bgMuted, }, productImage: { display: "block", height: "100%", objectFit: "cover", width: "100%", }, editionBadgeOverlay: { insetInlineStart: spacing._3, position: "absolute", top: spacing._3, zIndex: 1, }, productDetails: { flexGrow: 1, }, productName: { marginBlock: 0, }, productDescription: { WebkitBoxOrient: "vertical", WebkitLineClamp: 2, display: "-webkit-box", lineHeight: lineHeights.md, overflow: "hidden", }, swatchRow: { paddingTop: spacing._0_5, }, swatchGroup: { flexShrink: 0, }, swatchButton: { alignItems: "center", appearance: "none", backgroundColor: "transparent", borderColor: { default: "transparent", ":hover": semanticColors.borderEmphasized, }, borderRadius: radii.full, borderStyle: "solid", borderWidth: "1.5px", cursor: "pointer", display: "inline-flex", justifyContent: "center", outlineColor: { default: null, ":focus-visible": semanticColors.accentFocusRing, }, outlineOffset: { default: null, ":focus-visible": "2px", }, outlineStyle: { default: null, ":focus-visible": "solid", }, outlineWidth: { default: null, ":focus-visible": "1.5px", }, paddingBlock: "2px", paddingInline: "2px", transitionDuration: durations.fast, transitionProperty: "border-color, transform", }, swatchButtonSelected: { borderColor: semanticColors.fg, }, finishLabel: { minWidth: 0, }, productFooter: { marginTop: "auto", paddingTop: spacing._1_5, },});
function editionPaletteFor(tone?: ProductGalleryItem["editionTone"]) { if (tone === "accent") return accentPalette; if (tone === "amber") return amberPalette; if (tone === "green") return greenPalette; return undefined;}
export interface ProductGalleryProps extends StyleOverrideProps { /** Collection eyebrow label above the primary headline. */ eyebrow?: string; /** Primary display headline for the gallery. */ title?: string; /** Supporting editorial description in the split header. */ description?: string; /** Label for the primary collection action button. */ ctaLabel?: string; /** Curated product catalog displayed in the responsive grid. */ items?: readonly ProductGalleryItem[]; /** Initial active category filter. */ initialCategory?: ProductGalleryCategory; /** Called when the primary header CTA is clicked. */ onExploreAction?: () => void; /** Called when a product is added to the bag with its selected finish. */ onAddToBag?: ( item: ProductGalleryItem, finish: ProductGalleryFinish, ) => void;}
/** * ProductGallery — editorial storefront product grid pairing a two-column * header, category segmented filter, live bag counter, finish swatches, and * square 1:1 studio product cards with instant add-to-bag toast feedback. */export function ProductGallery({ eyebrow = "Kōji Atelier · Desk Objects Collection", title = "Quiet tools for focused tables, cast in stone, brass, and warm light.", description = "Each piece is turned, kiln-fired, or milled in small Kyoto and Portland runs. Tactile finishes soften with daily use and bring stillness to the work surface.", ctaLabel = "Explore edition", items = DEFAULT_PRODUCTS, initialCategory = "all", onExploreAction, onAddToBag, palette, style,}: ProductGalleryProps) { const queue = useMemo(() => Toast.createToaster(), []); const gridRef = useRef<HTMLDivElement | null>(null);
const [category, setCategory] = useState<ProductGalleryCategory>(initialCategory); const [selectedFinishes, setSelectedFinishes] = useState< Record<string, ProductGalleryFinishId> >(() => { const initial: Record<string, ProductGalleryFinishId> = {}; for (const item of items) { const first = item.finishes[0]; if (first) initial[item.id] = first.id; } return initial; }); const [bagEntries, setBagEntries] = useState<readonly BagEntry[]>([]);
const categoryCounts = useMemo(() => { const counts: Record<ProductGalleryCategory, number> = { all: items.length, lighting: 0, ceramics: 0, "desk-tools": 0, }; for (const item of items) { counts[item.category] += 1; } return counts; }, [items]);
const visibleItems = useMemo( () => category === "all" ? items : items.filter((item) => item.category === category), [category, items], );
const bagCount = useMemo( () => bagEntries.reduce((sum, entry) => sum + entry.quantity, 0), [bagEntries], );
const bagSubtotal = useMemo( () => bagEntries.reduce((sum, entry) => sum + entry.price * entry.quantity, 0), [bagEntries], );
const quantityByProductId = useMemo(() => { const map: Record<string, number> = {}; for (const entry of bagEntries) { map[entry.productId] = (map[entry.productId] ?? 0) + entry.quantity; } return map; }, [bagEntries]);
const handleSelectFinish = useCallback( (productId: string, finishId: ProductGalleryFinishId) => { setSelectedFinishes((prev) => ({ ...prev, [productId]: finishId })); }, [], );
const handleAdd = useCallback( (item: ProductGalleryItem, finish: ProductGalleryFinish) => { const key = `${item.id}:${finish.id}`; setBagEntries((prev) => { const existing = prev.find((entry) => entry.key === key); if (existing) { return prev.map((entry) => entry.key === key ? { ...entry, quantity: entry.quantity + 1 } : entry, ); } return [ ...prev, { key, productId: item.id, name: item.name, finishLabel: finish.label, price: item.price, quantity: 1, }, ]; }); onAddToBag?.(item, finish); const nextCount = bagCount + 1; queue.success(`Added ${item.name} to bag`, { description: `${finish.label} · ${formatPrice(item.price)} · ${nextCount} ${nextCount === 1 ? "object" : "objects"} in bag`, }); }, [bagCount, onAddToBag, queue], );
const handleExplore = useCallback(() => { onExploreAction?.(); gridRef.current?.scrollIntoView({ behavior: "smooth", block: "start" }); queue.info("Kōji Atelier · Desk Objects Collection", { description: `${items.length} small-batch lighting, ceramic, and desk editions ready to inspect.`, }); }, [items.length, onExploreAction, queue]);
const handleBagSummary = useCallback(() => { if (bagEntries.length === 0) { queue.info("Your studio bag is empty", { description: "Choose a finish swatch and add any desk object from the gallery.", }); return; } const previewNames = bagEntries .slice(0, 2) .map((entry) => `${entry.quantity}× ${entry.name} (${entry.finishLabel})`) .join(", "); const remaining = bagEntries.length > 2 ? ` +${bagEntries.length - 2} more` : ""; queue.info( `Studio bag · ${bagCount} ${bagCount === 1 ? "object" : "objects"}`, { description: `${previewNames}${remaining} · Subtotal ${formatPrice(bagSubtotal)}`, }, ); }, [bagCount, bagEntries, bagSubtotal, queue]);
const handleClearBag = useCallback(() => { setBagEntries([]); queue.info("Studio bag cleared", { description: "All objects have been removed from your bag.", }); }, [queue]);
const activeCategoryLabel = CATEGORIES.find((entry) => entry.id === category)?.label ?? "All";
return ( <VStack gap="0" palette={palette} style={[styles.root, style]}> <VStack render={<main />} style={styles.content}> <Grid render={<header />} align="end" style={styles.headerGrid}> <VStack align="start" style={styles.headerLeft}> {eyebrow ? ( <Badge variant="subtle" size="md"> {eyebrow} </Badge> ) : null} <Heading render={<h1 />} size="5xl" style={styles.headline}> {title} </Heading> </VStack>
<VStack align="start" gap="4"> <Text variant="muted" size="md" style={styles.description}> {description} </Text> <HStack wrap="wrap" gap="2.5"> <Button variant="solid" size="md" palette={accentPalette} onClick={handleExplore} > {ctaLabel} <ArrowRightIcon /> </Button> <Button variant="surface" size="md" onClick={handleBagSummary} aria-label={`Studio bag with ${bagCount} ${bagCount === 1 ? "object" : "objects"}`} > <BagIcon /> <span>Bag</span> <Badge variant={bagCount > 0 ? "solid" : "subtle"} size="xs" palette={bagCount > 0 ? accentPalette : undefined} > {bagCount} </Badge> {bagCount > 0 ? ( <Text render={<span />} variant="muted" tabular="true"> · {formatPrice(bagSubtotal)} </Text> ) : null} </Button> </HStack> </VStack> </Grid>
<Separator />
<HStack wrap="wrap" gap="3" justify="between"> <div {...stylex.props(styles.segmentScroll)}> <SegmentGroup.Root size="sm" value={category} onValueChange={(next) => setCategory(next as ProductGalleryCategory) } aria-label="Filter collection by category" > {CATEGORIES.map((entry) => ( <SegmentGroup.Item key={entry.id} value={entry.id}> {entry.label} ({categoryCounts[entry.id]}) </SegmentGroup.Item> ))} </SegmentGroup.Root> </div>
<HStack wrap="wrap" gap="2.5"> <Text render={<span />} variant="muted" size="sm" tabular="true"> Showing {visibleItems.length}{" "} {visibleItems.length === 1 ? "object" : "objects"} {category === "all" ? "" : ` in ${activeCategoryLabel}`} </Text> {bagCount > 0 ? ( <Button variant="ghost" size="xs" onClick={handleClearBag}> Clear bag </Button> ) : null} </HStack> </HStack>
<Section.Root aria-label="Desk Objects Collection gallery" style={styles.gallerySection} > <Section.Body> <Grid ref={gridRef} gap="6" style={styles.productGrid}> {visibleItems.map((product) => { const activeFinishId = selectedFinishes[product.id] ?? product.finishes[0]?.id; const activeFinish = product.finishes.find((f) => f.id === activeFinishId) ?? product.finishes[0]; const inBagQty = quantityByProductId[product.id] ?? 0;
return ( <VStack key={product.id} render={<article />} gap="3" > <Card.Root variant="outline" size="sm" style={styles.mediaCard} > {product.editionBadge ? ( <div {...stylex.props(styles.editionBadgeOverlay)}> <Badge variant="surface" size="sm" palette={editionPaletteFor(product.editionTone)} > {product.editionBadge} </Badge> </div> ) : null} <AspectRatio ratio="square" rounded="none" style={styles.aspectFrame} > <img src={product.imageSrc} alt={product.imageAlt} {...stylex.props(styles.productImage)} /> </AspectRatio> </Card.Root>
<VStack gap="2" style={styles.productDetails}> <VStack gap="0.5"> <Text render={<span />} variant="subtle" size="xs" weight="medium" > {product.categoryLabel} </Text> <Heading render={<h2 />} size="lg" style={styles.productName} > {product.name} </Heading> </VStack>
<Text variant="muted" size="sm" style={styles.productDescription} > {product.description} </Text>
{activeFinish ? ( <HStack gap="2" style={styles.swatchRow}> <HStack role="radiogroup" aria-label={`${product.name} finish`} gap="1.5" style={styles.swatchGroup} > {product.finishes.map((finish) => { const isSelected = finish.id === activeFinish.id; return ( <button key={finish.id} type="button" role="radio" aria-checked={isSelected} aria-label={finish.label} title={finish.label} onClick={() => handleSelectFinish(product.id, finish.id) } {...stylex.props( styles.swatchButton, isSelected && styles.swatchButtonSelected, )} > <ColorSwatch size="xs" shape="circle" style={finishSwatchStyles[finish.id]} /> </button> ); })} </HStack> <Text render={<span />} variant="caption" truncate="true" style={styles.finishLabel} > {activeFinish.label} </Text> </HStack> ) : null}
<HStack gap="2" justify="between" style={styles.productFooter} > <Text render={<span />} size="lg" weight="semibold" tabular="true" > {formatPrice(product.price)} </Text> {activeFinish ? ( <Button variant="surface" size="sm" onClick={() => handleAdd(product, activeFinish)} aria-label={`Add ${product.name} in ${activeFinish.label} to bag`} > <PlusIcon /> <span>Add</span> {inBagQty > 0 ? ( <Badge variant="subtle" size="xs" palette={accentPalette} > {inBagQty} </Badge> ) : null} </Button> ) : null} </HStack> </VStack> </VStack> ); })} </Grid> </Section.Body> </Section.Root> </VStack>
<Toaster toaster={queue} /> </VStack> );}
Inspired by the Product Gallery template from Astryx (MIT License · Copyright (c) 2026 Meta Platforms, Inc.).