Product Gallery 4
Lets the buyer count what ships: the kit's flat-lay beside a numbered receipt of every piece. Tapping a line zooms the photo into that piece, and the tally ends at the order button.
Use it in a prompt
Use offer/product-gallery-4 from the FunnelDNA library. Follow the skill and theme contract. Ask me for the copy, images, and brand details you need; do not invent proof.
Paste into Claude or ChatGPT with FunnelDNA connected (MCP setup), or alongside the skill.
Use it in code
- Save
component.tsx(Code tab) ascomponents/funneldna/offer/product-gallery-4.tsx. - Import it and pass your copy and images (Props tab):
import { ProductGallery4 } from "@/components/funneldna/offer/product-gallery-4"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/product-gallery-4/component.tsx 527 lines
// layout: ledger-receipt
// Lets the buyer count what ships: the kit's flat-lay beside a numbered receipt of every piece. Tapping a line zooms the photo into that piece, and the tally ends at the order button.
'use client'
import * as React from 'react'
import { ShieldCheck } from 'lucide-react'
import { FX_HOST, Texture } from '../fx/fx'
import linen from '../fx/textures/linen'
export type KitShot = {
/** Gallery photo URL (slots: product, item-n, scene). */
src: string
alt: string
/** Short name under the thumbnail, e.g. 'The full box'. */
label: string
}
export type KitItem = {
name: string
/** One short line about the piece. */
detail?: string
/** Value on the receipt line, e.g. '$32'. */
value?: string
/** Close-up of this piece (slot: item-n). */
image?: string
imageAlt?: string
/** Crop into the image, 1 to 4. Use with focus when the image is the flat-lay. */
zoom?: number
/** Point of the image to centre the crop on, in percent. */
focus?: { x: number; y: number }
}
export type ProductGallery4State = 'default' | 'hover' | 'active' | 'disabled'
const DEFAULT_COPY = {
thumbsLabel: 'Photos of the kit',
listLabel: 'Pieces in the box',
closeUp: 'up close',
itemAlt: '{name}, up close',
count: '{count} pieces',
countOne: '1 piece',
showing: 'Showing {label}',
}
export type ProductGallery4Copy = typeof DEFAULT_COPY
export type ProductGallery4Props = {
/** Section headline. A plain string can carry one marker-highlighted phrase. */
headline?: React.ReactNode
/** Exact phrase inside a string headline that gets the marker stroke. */
highlight?: string
lead?: React.ReactNode
/** Heading on the receipt card. */
receiptTitle?: string
/** Every piece in the box, in receipt order. Leave it empty for a plain gallery. */
items?: KitItem[]
/** Photos for the thumbnail row: flat-lay first, then packaged and in use. */
shots?: KitShot[]
/** {count} is replaced with the number of pieces. */
subtotalLabel?: string
subtotal?: string
discountLabel?: string
/** Value on the discount line, e.g. '−$50'. The line is hidden when this is empty. */
discount?: string
totalLabel?: string
/** Today’s price. The total line is hidden when this is empty. */
total?: string
/** Lead-in for the numbered reasons, e.g. 'Three reasons it’s $47 today:'. */
reasonsTitle?: string
reasons?: string[]
/** Delivery verb on the button. */
actionLabel?: string
/** One reassurance line under the button, e.g. the guarantee. */
reassurance?: string
href?: string
onAction?: (event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void
disabled?: boolean
/** Index of the thumbnail shown first. */
initialShot?: number
/** Interface copy. {name}, {count} and {label} are replaced as text. */
copy?: Partial<ProductGallery4Copy>
/** Called with what goes on stage: a thumbnail index or an item index. */
onSelect?: (kind: 'shot' | 'item', index: number) => void
/** Studio preview state. */
state?: ProductGallery4State
className?: string
style?: React.CSSProperties
}
export function ProductGallery4({
headline = 'Open the box and count what you get',
highlight = 'count what you get',
lead = 'Tap any piece on the receipt to see it up close. Everything here ships together in one box.',
receiptTitle = 'Everything that ships in your box',
items = [],
shots = [],
subtotalLabel = 'Bought one by one ({count} pieces)',
subtotal = '',
discountLabel = 'Kit discount',
discount = '',
totalLabel = 'Your total today',
total = '',
reasonsTitle = '',
reasons = [],
actionLabel = 'Send me the kit',
reassurance = '',
href,
onAction,
disabled = false,
initialShot = 0,
copy: copyIn,
onSelect,
state = 'default',
className = '',
style,
}: ProductGallery4Props) {
const copy: ProductGallery4Copy = { ...DEFAULT_COPY }
if (copyIn) for (const [k, v] of Object.entries(copyIn)) if (typeof v === 'string') (copy as Record<string, string>)[k] = v
const uid = 'pg4' + React.useId().replace(/[^a-zA-Z0-9]/g, '')
const nShots = shots.length
const nItems = items.length
const startItem = (s: ProductGallery4State): number | null =>
s === 'active' && nItems ? Math.min(1, nItems - 1) : null
const [shotIdx, setShotIdx] = React.useState(() => clampIndex(initialShot, nShots))
const [itemIdx, setItemIdx] = React.useState<number | null>(() => startItem(state))
const [touched, setTouched] = React.useState(false)
const rowRefs = React.useRef<Array<HTMLButtonElement | null>>([])
const thumbRefs = React.useRef<Array<HTMLButtonElement | null>>([])
React.useEffect(() => {
setShotIdx(clampIndex(initialShot, nShots))
setItemIdx(startItem(state))
setTouched(false)
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [state, nShots, nItems])
const layers: Layer[] = shots.map((s, i): Layer => ({ key: 's' + i, src: s.src, alt: s.alt, ...crop(1) }))
items.forEach((it, i) => {
if (it.image) layers.push({ key: 'i' + i, src: it.image, alt: it.imageAlt || fill(copy.itemAlt, { name: it.name }), ...crop(it.zoom, it.focus) })
})
if (!layers.length) return null
const chosen = itemIdx != null ? items[itemIdx] : undefined
const stageItem = chosen && chosen.image && itemIdx != null ? itemIdx : !nShots ? items.findIndex((it) => Boolean(it.image)) : -1
const activeKey = stageItem >= 0 ? 'i' + stageItem : 's' + shotIdx
const shot = shots[shotIdx]
const stageName = stageItem >= 0 ? items[stageItem].name : shot?.label ?? ''
const liveText = fill(copy.showing, { label: stageItem >= 0 ? stageName + ', ' + copy.closeUp : stageName })
const hasThumbs = nItems > 0 && items.every((it) => Boolean(it.image))
const hasTally = Boolean(subtotal || discount || total)
const hoverRow = state === 'hover' ? Math.min(1, nItems - 1) : -1
const locked = disabled || state === 'disabled'
const countText = nItems === 1 ? copy.countOne : fill(copy.count, { count: nItems })
const chooseItem = (i: number) => {
setTouched(true)
setItemIdx(i)
onSelect?.('item', i)
}
const toggleItem = (i: number) => {
setTouched(true)
if (itemIdx === i) {
setItemIdx(null)
onSelect?.('shot', shotIdx)
} else {
setItemIdx(i)
onSelect?.('item', i)
}
}
const chooseShot = (i: number) => {
setTouched(true)
setShotIdx(i)
setItemIdx(null)
onSelect?.('shot', i)
}
const onRowKey = (e: React.KeyboardEvent<HTMLButtonElement>, i: number) => {
const n = step(e.key, i, nItems, 'ArrowDown', 'ArrowUp')
if (n == null) return
e.preventDefault()
chooseItem(n)
rowRefs.current[n]?.focus()
}
const onThumbKey = (e: React.KeyboardEvent<HTMLButtonElement>, i: number) => {
const n = step(e.key, i, nShots, 'ArrowRight', 'ArrowLeft')
if (n == null) return
e.preventDefault()
chooseShot(n)
thumbRefs.current[n]?.focus()
}
const btnClass = 'pg4-btn' + (state === 'hover' && !locked ? ' is-hover' : '')
const action =
href && !locked ? (
<a className={btnClass} href={href} onClick={onAction}>
{actionLabel}
</a>
) : (
<button type='button' className={btnClass} disabled={locked} onClick={onAction}>
{actionLabel}
</button>
)
return (
<section className={('cf-product-gallery-4 ' + className).trim()} style={{ ...FX_HOST, ...style }} aria-labelledby={uid + '-h'}>
<style>{CSS}</style>
<Texture src={linen} tone='ink' />
<div className='pg4-inner'>
<header className='pg4-head pg4-rise'>
<h2 id={uid + '-h'} className='pg4-h'>
{mark(headline, highlight)}
</h2>
{lead ? <p className='pg4-lead'>{lead}</p> : null}
</header>
<div className='pg4-grid'>
<div className='pg4-gallery pg4-rise' style={{ animationDelay: '.07s' }}>
<div className='pg4-stage' id={uid + '-stage'}>
{layers.map((l, idx) => {
const on = l.key === activeKey
return (
<img
key={l.key}
className={'pg4-layer' + (on ? ' is-on' : '')}
src={l.src}
alt={on ? l.alt : ''}
aria-hidden={on ? undefined : true}
loading={idx === 0 ? 'eager' : 'lazy'}
decoding='async'
style={zoomStyle(l)}
/>
)
})}
</div>
{stageItem >= 0 || nShots < 2 ? (
<p className='pg4-cap'>
{stageItem >= 0 ? (
<>
<b>
{pad(stageItem + 1)} {stageName}
</b>{' '}
· {copy.closeUp}
</>
) : (
<b>{stageName}</b>
)}
</p>
) : null}
{nShots > 1 ? (
<div
className='pg4-thumbs'
role='group'
aria-label={copy.thumbsLabel}
style={{ ['--pg4-n' as string]: String(Math.min(nShots, 4)) } as React.CSSProperties}
>
{shots.map((s, i) => {
const pressed = stageItem < 0 && shotIdx === i
return (
<button
key={i}
ref={(el) => {
thumbRefs.current[i] = el
}}
type='button'
className='pg4-thumb'
aria-pressed={pressed}
aria-controls={uid + '-stage'}
onClick={() => chooseShot(i)}
onKeyDown={(e) => onThumbKey(e, i)}
>
<span className='pg4-thumb-img'>
<img src={s.src} alt='' loading='lazy' decoding='async' />
</span>
<span className='pg4-thumb-label'>{s.label}</span>
</button>
)
})}
</div>
) : null}
<p className='pg4-sr' aria-live='polite'>
{touched ? liveText : ''}
</p>
</div>
<div className='pg4-card pg4-rise' style={{ animationDelay: '.14s' }}>
{nItems ? (
<>
<div className='pg4-card-head'>
<h3 className='pg4-h3'>{receiptTitle}</h3>
<span className='pg4-chip'>{countText}</span>
</div>
<ol className={'pg4-list' + (hasThumbs ? '' : ' no-thumb')} aria-label={copy.listLabel}>
{items.map((it, i) => {
const pressed = itemIdx === i
return (
<li key={i}>
<button
ref={(el) => {
rowRefs.current[i] = el
}}
type='button'
className={'pg4-row' + (hoverRow === i && !pressed ? ' is-hover' : '')}
aria-pressed={pressed}
aria-controls={uid + '-stage'}
onClick={() => toggleItem(i)}
onKeyDown={(e) => onRowKey(e, i)}
>
<span className='pg4-num' aria-hidden='true'>
{pad(i + 1)}
</span>
{hasThumbs ? (
<span className='pg4-rthumb' aria-hidden='true'>
<img src={it.image} alt='' loading='lazy' decoding='async' style={zoomStyle(crop(thumbZoom(it.zoom), it.focus))} />
</span>
) : null}
<span className='pg4-body'>
<span className='pg4-name-line'>
<span className='pg4-name'>{it.name}</span>
{it.value ? (
<>
<span className='pg4-leader' aria-hidden='true' />
<span className='pg4-val'>{it.value}</span>
</>
) : null}
</span>
{it.detail ? <span className='pg4-detail'>{it.detail}</span> : null}
</span>
</button>
</li>
)
})}
</ol>
</>
) : null}
{hasTally ? (
<div className='pg4-tally'>
{subtotal ? (
<p className='pg4-line pg4-sub'>
<span className='pg4-line-l'>{fill(subtotalLabel, { count: nItems })}</span>
<span className='pg4-line-v'>{subtotal}</span>
</p>
) : null}
{discount ? (
<p className='pg4-line pg4-disc'>
<span className='pg4-line-l'>{discountLabel}</span>
<span className='pg4-line-v'>{discount}</span>
</p>
) : null}
{total ? (
<p className='pg4-line pg4-total'>
<span className='pg4-line-l'>{totalLabel}</span>
<span className='pg4-line-v'>{total}</span>
</p>
) : null}
</div>
) : null}
{reasons.length ? (
<div className='pg4-reasons'>
{reasonsTitle ? <p className='pg4-reasons-t'>{reasonsTitle}</p> : null}
<ol className='pg4-rlist'>
{reasons.map((r, i) => (
<li key={i}>
<span className='pg4-rn' aria-hidden='true'>
{i + 1}
</span>
<span>{r}</span>
</li>
))}
</ol>
</div>
) : null}
<div className='pg4-action'>
{action}
{reassurance ? (
<p className='pg4-reassure'>
<ShieldCheck size={16} strokeWidth={2.5} aria-hidden='true' />
{reassurance}
</p>
) : null}
</div>
</div>
</div>
</div>
</section>
)
}
export default ProductGallery4
type Crop = { z: number; origin: string }
type Layer = Crop & { key: string; src: string; alt: string }
function crop(zoom?: number, focus?: { x: number; y: number }): Crop {
const z = Math.min(4, Math.max(1, zoom ?? 1))
if (z === 1 || !focus) return { z, origin: '50% 50%' }
const o = (p: number) => Math.round(Math.min(100, Math.max(0, (z * p - 50) / (z - 1))) * 10) / 10
return { z, origin: o(focus.x) + '% ' + o(focus.y) + '%' }
}
/** Receipt thumbnails are tiny, so a flat-lay crop zooms a little further in than the stage does. */
function thumbZoom(zoom?: number) {
return zoom && zoom > 1 ? zoom * 1.3 : zoom
}
function zoomStyle(c: Crop): React.CSSProperties {
return { transformOrigin: c.origin, ['--z' as string]: String(c.z) } as React.CSSProperties
}
function step(key: string, i: number, n: number, next: string, prev: string): number | null {
if (n < 2) return null
if (key === next) return (i + 1) % n
if (key === prev) return (i - 1 + n) % n
if (key === 'Home') return 0
if (key === 'End') return n - 1
return null
}
function clampIndex(i: number, n: number) {
return n ? Math.min(n - 1, Math.max(0, Math.floor(i) || 0)) : 0
}
function pad(n: number) {
return String(n).padStart(2, '0')
}
function fill(t: string, vars: Record<string, string | number>) {
return Object.entries(vars).reduce((s, [k, v]) => s.split('{' + k + '}').join(String(v)), t)
}
function mark(text: React.ReactNode, phrase?: string): React.ReactNode {
if (typeof text !== 'string' || !phrase) return text
const at = text.indexOf(phrase)
if (at < 0) return text
return (
<>
{text.slice(0, at)}
<span className='pg4-mark'>{phrase}</span>
{text.slice(at + phrase.length)}
</>
)
}
const CSS = `
.cf-product-gallery-4{--pg4-bg:var(--button-bg,var(--cta,#d92d20));--pg4-bg2:var(--button-bg-2,var(--cta-2,#b42318));--pg4-sh:var(--shadow,oklch(0.22 0.03 260));--pg4-marker:color-mix(in oklch,var(--marker,#fae37c) 75%,transparent);--pg4-well:color-mix(in oklch,var(--ink,#101828) 4%,var(--card,#fff));position:relative;overflow-x:clip;background:var(--surface,#fff);color:var(--ink,#101828);font-family:var(--font-body,system-ui,sans-serif);padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) clamp(64px,8.5vw,120px)}
.cf-product-gallery-4 *,.cf-product-gallery-4 *::before,.cf-product-gallery-4 *::after{box-sizing:border-box}
.cf-product-gallery-4 .pg4-inner{position:relative;z-index:1;max-width:1120px;margin:0 auto}
.cf-product-gallery-4 .pg4-head{max-width:46rem;margin:0 0 clamp(32px,4vw,48px)}
.cf-product-gallery-4 .pg4-h{margin:0 0 16px;font-family:var(--font-display,inherit);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);text-wrap:balance;color:var(--ink,#101828)}
.cf-product-gallery-4 .pg4-mark{background:linear-gradient(transparent 46%,var(--pg4-marker) 46%,var(--pg4-marker) 94%,transparent 94%);-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:0 .1em;margin:0 -.04em;border-radius:.1em .3em .15em .25em}
.cf-product-gallery-4 .pg4-lead{margin:0;max-width:60ch;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--muted,#475467);text-wrap:pretty}
.cf-product-gallery-4 .pg4-grid{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,.9fr);gap:clamp(32px,5vw,72px);align-items:start}
.cf-product-gallery-4 .pg4-gallery{position:relative;min-width:0}
.cf-product-gallery-4 .pg4-stage{position:relative;aspect-ratio:1/1;border-radius:12px;overflow:hidden;background:color-mix(in oklch,var(--ink,#101828) 5%,var(--surface,#fff))}
.cf-product-gallery-4 .pg4-layer{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:cover;object-position:50% 50%;opacity:0;transform:scale(1);transition:opacity .4s cubic-bezier(.2,.7,.2,1),transform .7s cubic-bezier(.2,.7,.2,1)}
.cf-product-gallery-4 .pg4-layer.is-on{opacity:1;transform:scale(var(--z,1))}
.cf-product-gallery-4 .pg4-cap{margin:12px 0 0;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted,#475467);text-wrap:pretty}
.cf-product-gallery-4 .pg4-cap b{color:var(--ink,#101828);font-weight:800;font-variant-numeric:tabular-nums}
.cf-product-gallery-4 .pg4-thumbs{display:grid;grid-template-columns:repeat(var(--pg4-n,3),minmax(0,1fr));gap:16px;margin:16px 0 0}
.cf-product-gallery-4 .pg4-thumb{min-width:0;display:grid;gap:8px;align-content:start;padding:0;border:0;background:none;color:inherit;font:inherit;text-align:left;cursor:pointer;-webkit-tap-highlight-color:transparent}
.cf-product-gallery-4 .pg4-thumb:focus-visible{outline:none}
.cf-product-gallery-4 .pg4-thumb-img{display:block;aspect-ratio:4/3;border-radius:8px;overflow:hidden;background:color-mix(in oklch,var(--ink,#101828) 5%,var(--surface,#fff));outline:2px solid transparent;outline-offset:3px;transition:transform .16s ease,outline-color .16s ease}
.cf-product-gallery-4 .pg4-thumb-img img{display:block;width:100%;height:100%;object-fit:cover}
.cf-product-gallery-4 .pg4-thumb-label{font-size:.9375rem;line-height:1.3;font-weight:600;color:var(--muted,#475467);text-wrap:pretty}
.cf-product-gallery-4 .pg4-thumb:hover .pg4-thumb-img{transform:translateY(-2px)}
.cf-product-gallery-4 .pg4-thumb:active .pg4-thumb-img{transform:translateY(0)}
.cf-product-gallery-4 .pg4-thumb[aria-pressed='true'] .pg4-thumb-img{outline-color:var(--accent,#2563eb)}
.cf-product-gallery-4 .pg4-thumb[aria-pressed='true'] .pg4-thumb-label{color:var(--ink,#101828);font-weight:800}
.cf-product-gallery-4 .pg4-thumb:focus-visible .pg4-thumb-img{outline:3px solid var(--field-focus,var(--accent,#2563eb));outline-offset:3px}
.cf-product-gallery-4 .pg4-thumb:focus-visible .pg4-thumb-label{color:var(--ink,#101828);text-decoration:underline;text-underline-offset:.2em}
.cf-product-gallery-4 .pg4-card{min-width:0;background:var(--card,#fff);color:var(--ink,#101828);border:1px solid var(--card-border,oklch(from var(--ink,#101828) l c h / .12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(0.22 0.03 260 / .22),0 12px 24px -8px oklch(0.22 0.03 260 / .32)));padding:clamp(20px,3vw,32px)}
.cf-product-gallery-4 .pg4-card > :first-child{margin-top:0}
.cf-product-gallery-4 .pg4-card-head{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 16px}
.cf-product-gallery-4 .pg4-h3{margin:0;min-width:0;font-family:var(--font-display,inherit);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;font-weight:var(--display-weight,800);letter-spacing:-.01em;text-transform:var(--display-case,none);text-wrap:balance}
.cf-product-gallery-4 .pg4-chip{display:inline-flex;align-items:center;min-height:28px;padding:4px 12px;border-radius:999px;background:color-mix(in oklch,var(--ink,#101828) 6%,var(--card,#fff));color:var(--ink,#101828);font-size:.875rem;line-height:1.2;font-weight:800;font-variant-numeric:tabular-nums;white-space:nowrap}
.cf-product-gallery-4 .pg4-list{list-style:none;margin:16px 0 0;padding:0;display:grid;gap:4px}
.cf-product-gallery-4 .pg4-row{display:grid;grid-template-columns:2.25rem 48px minmax(0,1fr);gap:12px;align-items:start;width:100%;padding:12px;border:0;border-radius:10px;background:transparent;color:var(--ink,#101828);font:inherit;text-align:left;cursor:pointer;transition:background-color .16s ease;-webkit-tap-highlight-color:transparent}
.cf-product-gallery-4 .pg4-list.no-thumb .pg4-row{grid-template-columns:2.25rem minmax(0,1fr)}
.cf-product-gallery-4 .pg4-row:hover,.cf-product-gallery-4 .pg4-row.is-hover{background:color-mix(in oklch,var(--ink,#101828) 5%,var(--card,#fff))}
.cf-product-gallery-4 .pg4-row:active{background:color-mix(in oklch,var(--ink,#101828) 8%,var(--card,#fff))}
.cf-product-gallery-4 .pg4-row[aria-pressed='true']{background:color-mix(in oklch,var(--accent,#2563eb) 11%,var(--card,#fff))}
.cf-product-gallery-4 .pg4-row:focus-visible{outline:3px solid var(--field-focus,var(--accent,#2563eb));outline-offset:2px}
.cf-product-gallery-4 .pg4-num{padding-top:4px;font-family:var(--font-display,inherit);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1;font-weight:800;letter-spacing:-.02em;font-variant-numeric:tabular-nums;color:var(--accent,#2563eb)}
.cf-product-gallery-4 .pg4-rthumb{display:block;width:48px;height:48px;border-radius:8px;overflow:hidden;background:color-mix(in oklch,var(--ink,#101828) 5%,var(--card,#fff))}
.cf-product-gallery-4 .pg4-rthumb img{display:block;width:100%;height:100%;object-fit:cover;transform:scale(var(--z,1))}
.cf-product-gallery-4 .pg4-body{display:block;min-width:0;padding-top:2px}
.cf-product-gallery-4 .pg4-name-line{display:flex;align-items:baseline;justify-content:space-between;gap:8px}
.cf-product-gallery-4 .pg4-name{min-width:0;font-size:1.0625rem;line-height:1.3;font-weight:800;text-wrap:pretty}
.cf-product-gallery-4 .pg4-leader{flex:1 1 16px;min-width:16px;height:1px;background:oklch(from var(--ink,#101828) l c h / .22);transform:translateY(-.3em)}
.cf-product-gallery-4 .pg4-val{font-size:1.0625rem;line-height:1.3;font-weight:800;font-variant-numeric:tabular-nums;white-space:nowrap}
.cf-product-gallery-4 .pg4-detail{display:block;margin-top:4px;font-size:.9375rem;line-height:1.4;color:var(--muted,#475467);text-wrap:pretty}
.cf-product-gallery-4 .pg4-row[aria-pressed='true'] .pg4-detail{color:var(--ink,#101828);font-weight:500}
.cf-product-gallery-4 .pg4-tally{margin:16px 0 0;padding:16px;border-radius:10px;background:var(--pg4-well);display:grid;gap:8px}
.cf-product-gallery-4 .pg4-line{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin:0;font-size:1.0625rem;line-height:1.35}
.cf-product-gallery-4 .pg4-line-l{min-width:0;text-wrap:pretty}
.cf-product-gallery-4 .pg4-line-v{font-weight:700;font-variant-numeric:tabular-nums;white-space:nowrap}
.cf-product-gallery-4 .pg4-sub{color:var(--muted,#475467)}
.cf-product-gallery-4 .pg4-sub .pg4-line-v{text-decoration:line-through;text-decoration-thickness:2px;text-decoration-color:oklch(from var(--danger,#b42318) l c h / .85)}
.cf-product-gallery-4 .pg4-disc{color:var(--ink,#101828)}
.cf-product-gallery-4 .pg4-disc .pg4-line-v{color:var(--success,#15803d);font-weight:800}
.cf-product-gallery-4 .pg4-total{margin-top:4px;align-items:center}
.cf-product-gallery-4 .pg4-total .pg4-line-l{font-size:1.125rem;font-weight:800;color:var(--ink,#101828)}
.cf-product-gallery-4 .pg4-total .pg4-line-v{font-family:var(--font-display,inherit);font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1;font-weight:800;letter-spacing:-.03em;color:var(--ink,#101828)}
.cf-product-gallery-4 .pg4-reasons{margin:24px 0 0;color:var(--ink,#101828)}
.cf-product-gallery-4 .pg4-reasons-t{margin:0 0 12px;font-size:1.0625rem;line-height:1.35;font-weight:800;text-wrap:balance}
.cf-product-gallery-4 .pg4-rlist{list-style:none;margin:0;padding:0;display:grid;gap:8px}
.cf-product-gallery-4 .pg4-rlist li{display:grid;grid-template-columns:1.5rem minmax(0,1fr);gap:8px;align-items:baseline;font-size:1.0625rem;line-height:1.45;text-wrap:pretty}
.cf-product-gallery-4 .pg4-rn{font-family:var(--font-display,inherit);font-size:1.125rem;font-weight:800;font-variant-numeric:tabular-nums;color:var(--accent,#2563eb)}
.cf-product-gallery-4 .pg4-action{margin-top:24px}
.cf-product-gallery-4 .pg4-btn{display:flex;align-items:center;justify-content:center;width:100%;min-height:64px;padding:12px 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from var(--pg4-bg) calc(l + .04) c h),oklch(from var(--pg4-bg2) calc(l - .02) c h));color:var(--button-ink,var(--cta-ink,#fff));font-family:var(--button-font,var(--font-display,inherit));font-size:clamp(1.125rem,1.55vw,1.375rem);line-height:1.15;font-weight:var(--button-weight,800);text-transform:var(--button-case,none);text-align:center;text-decoration:none;text-shadow:var(--button-text-shadow,none);cursor:pointer;box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--pg4-bg) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--pg4-bg) calc(l - .16) c h),0 1px 2px oklch(from var(--pg4-sh) l c h / .3),0 8px 16px -6px oklch(from var(--pg4-sh) l c h / .45));transition:transform .16s ease,box-shadow .16s ease,background .16s ease;-webkit-tap-highlight-color:transparent}
.cf-product-gallery-4 .pg4-btn:not(:disabled):hover,.cf-product-gallery-4 .pg4-btn.is-hover{background:linear-gradient(oklch(from var(--pg4-bg) calc(l - .01) c h),oklch(from var(--pg4-bg2) calc(l - .07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--pg4-bg) calc(l + .1) c h / .7),inset 0 -3px 0 oklch(from var(--pg4-bg) calc(l - .2) c h),0 1px 2px oklch(from var(--pg4-sh) l c h / .32),0 10px 20px -6px oklch(from var(--pg4-sh) l c h / .55))}
.cf-product-gallery-4 .pg4-btn:not(:disabled):active{transform:translateY(1px);box-shadow:inset 0 2px 4px oklch(from var(--pg4-sh) l c h / .35),inset 0 -2px 0 oklch(from var(--pg4-bg) calc(l - .16) c h),0 1px 1px oklch(from var(--pg4-sh) l c h / .25)}
.cf-product-gallery-4 .pg4-btn:focus-visible{outline:3px solid var(--field-focus,var(--accent,#2563eb));outline-offset:3px}
.cf-product-gallery-4 .pg4-btn:disabled{cursor:not-allowed;transform:none;background:var(--button-2-bg,var(--secondary,#eef0f4));color:var(--button-2-ink,var(--secondary-ink,#101828));text-shadow:none;box-shadow:var(--button-2-shadow,var(--shadow-sm,0 1px 2px oklch(0.22 0.03 260 / .2)))}
.cf-product-gallery-4 .pg4-reassure{margin:12px 0 0;text-align:center;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted,#475467);text-wrap:pretty}
.cf-product-gallery-4 .pg4-reassure svg{display:inline-block;vertical-align:-.15em;margin-inline-end:.4em;color:var(--success,#15803d)}
.cf-product-gallery-4 .pg4-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
@keyframes pg4-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:no-preference){.cf-product-gallery-4 .pg4-rise{animation:pg4-rise .45s cubic-bezier(.2,.7,.2,1) both}}
@media (prefers-reduced-motion:reduce){.cf-product-gallery-4 .pg4-layer,.cf-product-gallery-4 .pg4-row,.cf-product-gallery-4 .pg4-thumb-img,.cf-product-gallery-4 .pg4-btn{transition:none}.cf-product-gallery-4 .pg4-thumb:hover .pg4-thumb-img,.cf-product-gallery-4 .pg4-btn:not(:disabled):active{transform:none}}
@media (min-width:901px){.cf-product-gallery-4 .pg4-gallery{position:sticky;top:24px}}
@media (max-width:900px){.cf-product-gallery-4 .pg4-grid{grid-template-columns:minmax(0,1fr)}.cf-product-gallery-4 .pg4-gallery,.cf-product-gallery-4 .pg4-card{width:100%;max-width:640px}}
@media (max-width:560px){.cf-product-gallery-4 .pg4-row{grid-template-columns:1.75rem 40px minmax(0,1fr);gap:10px;padding:10px 8px}.cf-product-gallery-4 .pg4-list.no-thumb .pg4-row{grid-template-columns:1.75rem minmax(0,1fr)}.cf-product-gallery-4 .pg4-rthumb{width:40px;height:40px}.cf-product-gallery-4 .pg4-row:not([aria-pressed='true']) .pg4-detail{display:none}.cf-product-gallery-4 .pg4-leader{display:none}.cf-product-gallery-4 .pg4-name-line{gap:12px}.cf-product-gallery-4 .pg4-thumbs{gap:8px}.cf-product-gallery-4 .pg4-thumb-label{font-size:.875rem}.cf-product-gallery-4 .pg4-tally{padding:14px}.cf-product-gallery-4 .pg4-rlist li{font-size:1rem}}
`
pieces/offer/product-gallery-4/specimen.tsx 55 lines
import __studioImageda2e8152 from "../assets/e25b8bb0c9d04999.webp";
import __studioImage6e382dcd from "../assets/d9c6db562d8d8c65.webp";
import __studioImaged2f7834c from "../assets/929fd859e1be3037.webp";
// Specimen: the Morning Ritual pour-over kit (fictional). Four pieces, one box, counted on a receipt.
import * as React from 'react'
import { ProductGallery4, type ProductGallery4State } from '../product-gallery-4'
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
const flatlay = __studioImageda2e8152
const packaged = __studioImage6e382dcd
const inUse = __studioImaged2f7834c
export const states = ['default', 'hover', 'active', 'disabled']
export default function ProductGallery4Specimen({ state = 'default' }: { state?: ProductGallery4State }) {
const sample = defaults.sample
const box = slot('product', flatlay)
const piece = (n: number, x: number, y: number) => {
const src = slot('item-' + n, box)
return src === box ? { image: src, zoom: 2.1, focus: { x, y } } : { image: src }
}
return (
<ProductGallery4
state={state}
headline='Open the box and count what you get'
highlight='count what you get'
lead='Tap any piece on the receipt to see it up close. All four ship together in one Morning Ritual box.'
receiptTitle='Everything in your Morning Ritual box'
items={[
{ name: 'Glass dripper', detail: 'Heat-proof glass cone that sits on any mug or carafe.', value: '$32', imageAlt: 'The glass cone dripper, up close', ...piece(1, 25, 25) },
{ name: 'Gooseneck kettle', detail: 'A slow, steady spout you can aim exactly where you want it.', value: '$38', imageAlt: 'The matte black gooseneck kettle, up close', ...piece(2, 75, 25) },
{ name: 'Brew scale', detail: 'Weighs coffee and water to the gram, with a built-in timer.', value: '$19', imageAlt: 'The slim digital brew scale, up close', ...piece(3, 25, 75) },
{ name: '100 paper filters', detail: 'Cut to fit the dripper, so there is nothing to fold.', value: '$8', imageAlt: 'The stack of paper filters, up close', ...piece(4, 75, 75) },
]}
shots={[
{ src: box, alt: 'The Morning Ritual pour-over kit laid out from above: glass dripper, gooseneck kettle, brew scale and paper filters', label: 'The full box' },
{ src: slot('item-5', packaged), alt: 'The kit packed in its white gift box with fitted inserts', label: 'Gift-ready packaging' },
{ src: slot('scene', inUse), alt: 'Pouring water from the gooseneck kettle into the glass dripper on the scale', label: 'Brewing at home' },
]}
subtotal={sample.regularPrice}
discount='−$50'
total={sample.price}
reasonsTitle={'Three reasons it’s ' + sample.price + ' today:'}
reasons={[
'One box ships instead of four separate orders.',
'Every piece is matched, so the filters fit the dripper.',
'You’re covered by a ' + sample.guarantee + '.',
]}
actionLabel='Send me the kit'
reassurance={sample.guarantee + ' · Ships in one box'}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalProductGallery4 |
React.ReactNode |
Default 'Open the box and count what you get'
|
highlight OptionalProductGallery4 |
string |
Default 'count what you get'
|
lead OptionalProductGallery4 |
React.ReactNode |
Default 'Tap any piece on the receipt to see it up close. Everything here ships together in one box.'
|
receiptTitle OptionalProductGallery4 |
string |
Default 'Everything that ships in your box'
|
items OptionalProductGallery4 |
KitItem[] |
Default []
|
shots OptionalProductGallery4 |
KitShot[] |
Default []
|
subtotalLabel OptionalProductGallery4 |
string |
Default 'Bought one by one ({count} pieces)'
|
subtotal OptionalProductGallery4 |
string |
Default ''
|
discountLabel OptionalProductGallery4 |
string |
Default 'Kit discount'
|
discount OptionalProductGallery4 |
string |
Default ''
|
totalLabel OptionalProductGallery4 |
string |
Default 'Your total today'
|
total OptionalProductGallery4 |
string |
Default ''
|
reasonsTitle OptionalProductGallery4 |
string |
Default ''
|
reasons OptionalProductGallery4 |
string[] |
Default []
|
actionLabel OptionalProductGallery4 |
string |
Default 'Send me the kit'
|
reassurance OptionalProductGallery4 |
string |
Default ''
|
href OptionalProductGallery4 |
string |
|
onAction OptionalProductGallery4 |
(event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void |
|
disabled OptionalProductGallery4 |
boolean |
Default false
|
initialShot OptionalProductGallery4 |
number |
Default 0
|
copy OptionalProductGallery4 |
Partial<ProductGallery4Copy> |
|
onSelect OptionalProductGallery4 |
(kind: 'shot' | 'item', index: number) => void |
|
state OptionalProductGallery4 |
ProductGallery4State |
Default 'default'
|
className OptionalProductGallery4 |
string |
Default ''
|
style OptionalProductGallery4 |
React.CSSProperties |
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-ink--button-2-shadow- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field-focus- Form inputs: background, ink, border, radius and focus colour.
--marker- The highlighter colour behind key phrases.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
item-5- One image per offer item (item-1, item-2…), shown in stacks and lists.
product- The main product shot or cover (ebook, kit, bottle).
scene- A wide atmosphere photo behind or beside the copy.
-
2c539f422023a290.webp
image/webp · 115 KB
-
929fd859e1be3037.webp
image/webp · 59.7 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
d9c6db562d8d8c65.webp
image/webp · 26.1 KB
-
e25b8bb0c9d04999.webp
image/webp · 20.9 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB