Product Gallery 2
A bento proof board for a product page. The photos show how big it is, how well it is made and how it looks in use before the buyer asks. The price and the one action sit on the same board.
Use it in a prompt
Use offer/product-gallery-2 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-2.tsx. - Import it and pass your copy and images (Props tab):
import { ProductGallery2 } from "@/components/funneldna/offer/product-gallery-2"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/product-gallery-2/component.tsx 753 lines
// layout: bento-grid
// A bento proof board for a product page. The photos show how big it is, how well it is made and how it looks in use before the buyer asks. The price and the one action sit on the same board.
'use client'
import * as React from 'react'
import { motion, MotionConfig } from 'motion/react'
import { ChevronLeft, ChevronRight, ImageOff, Maximize2, ShieldCheck, X, ZoomIn } from 'lucide-react'
import { FX_HOST, Texture } from '../fx/fx'
import topo from '../fx/textures/topo'
export type BentoShot = {
/** Product photo URL (slots: product, item-1, scene). */
src: string
alt: string
/** The buyer's question this photo answers, e.g. 'How big is it?'. Shown in bold before the caption. */
question?: string
/** One short supplied line under the photo. */
caption?: string
/** Focal point as a CSS position, e.g. '50% 60%'. */
focus?: string
/** Crop into the focal point, 1 to 3, to get a detail macro from a wider shot. */
zoom?: number
}
export type ProductGallery2State = 'default' | 'hover' | 'active' | 'disabled'
const DEFAULT_COPY = {
promote: 'Show in the large photo: {alt}',
open: 'Open full screen: {alt}',
zoomHint: 'Tap to zoom in',
reasonsTitle: 'Why it’s {price} today',
reasonsTitleNoPrice: 'Why it’s worth it',
status: 'Now showing in the large photo: {label}',
dialogLabel: '{productName} photos',
count: '{index} / {count}',
close: 'Close photos',
prev: 'Previous photo',
next: 'Next photo',
zoomIn: 'Zoom in: {alt}',
zoomOut: 'Zoom back out',
thumb: 'Show photo {index} of {count}: {label}',
failed: 'This photo didn’t load.',
}
export type ProductGallery2Copy = typeof DEFAULT_COPY
export type ProductGallery2Props = {
/** 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
/** Product name in the price tile and in the lightbox. */
productName?: string
/** Up to 4 photos: hero angle first, then in hand, detail and in use. */
shots?: BentoShot[]
/** Heading over the numbered reasons. Defaults to copy.reasonsTitle with the price. */
reasonsHeading?: string
/** Numbered reasons the price makes sense. An empty list hides the tile. */
reasons?: React.ReactNode[]
/** Today's price. An empty value hides the price line. */
price?: string
/** The supplied alternative it is weighed against, e.g. 'vs. replacing a pack every spring'. */
alternative?: React.ReactNode
/** The action is the outcome, e.g. 'Get me on the trail'. */
actionLabel?: string
/** One reassurance line under the button, e.g. the guarantee. */
reassurance?: React.ReactNode
href?: string
onAction?: (event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void
disabled?: boolean
/** Background texture from the fx kit (an imported texture module, e.g. topo). Pass null for a flat band. */
texture?: React.ComponentProps<typeof Texture>['src'] | null
/** Interface copy. {alt}, {label}, {price}, {productName}, {index} and {count} are replaced as text. */
copy?: Partial<ProductGallery2Copy>
/** Which photo starts in the large tile. */
initialIndex?: number
/** Called with the photo index when a photo moves into the large tile. */
onChange?: (index: number) => void
/** Studio preview state. */
state?: ProductGallery2State
className?: string
style?: React.CSSProperties
}
const SWAP = { duration: 0.5, ease: [0.2, 0.7, 0.2, 1] as const }
export function ProductGallery2({
headline = 'See it up close before you buy',
highlight = 'up close',
lead = 'Tap any photo to bring it up front. Tap the big one to zoom in.',
productName = 'This product',
shots = [],
reasonsHeading,
reasons = [],
price = '',
alternative,
actionLabel = 'Send me mine',
reassurance,
href,
onAction,
disabled = false,
texture = topo,
copy: copyIn,
initialIndex = 0,
onChange,
state = 'default',
className = '',
style,
}: ProductGallery2Props) {
const copy: ProductGallery2Copy = { ...DEFAULT_COPY }
if (copyIn) for (const [k, v] of Object.entries(copyIn)) if (typeof v === 'string') (copy as Record<string, string>)[k] = v
const list = shots.slice(0, 4)
const count = list.length
const uid = 'pg2' + React.useId().replace(/[^a-zA-Z0-9]/g, '')
const leadFor = (s: ProductGallery2State) => (s === 'active' ? 1 : initialIndex)
const [order, setOrder] = React.useState<number[]>(() => startOrder(count, leadFor(state)))
const [failed, setFailed] = React.useState<Record<number, boolean>>({})
const [status, setStatus] = React.useState('')
const [lb, setLb] = React.useState<number | null>(null)
const [zoomed, setZoomed] = React.useState(false)
const [origin, setOrigin] = React.useState({ x: 50, y: 50 })
const dialogRef = React.useRef<HTMLDialogElement>(null)
const closeRef = React.useRef<HTMLButtonElement>(null)
const mainRef = React.useRef<HTMLButtonElement>(null)
const swipe = React.useRef<{ x: number; y: number } | null>(null)
const swiped = React.useRef(false)
const open = lb !== null
React.useEffect(() => {
setOrder(startOrder(count, leadFor(state)))
setStatus('')
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [state, count, initialIndex])
React.useEffect(() => {
const d = dialogRef.current
if (!d) return
if (open) {
if (!d.open) {
try {
d.showModal()
} catch {
d.setAttribute('open', '')
}
}
closeRef.current?.focus()
const html = document.documentElement
const prev = html.style.overflow
html.style.overflow = 'hidden'
return () => {
html.style.overflow = prev
}
}
if (d.open) d.close()
return undefined
}, [open])
if (!count) return null
const ord = order.length === count ? order : startOrder(count, 0)
const locked = disabled || state === 'disabled'
const hasWhy = reasons.length > 0
const labelOf = (i: number) => list[i]?.question || list[i]?.alt || ''
const whyTitle = reasonsHeading || (price ? fill(copy.reasonsTitle, { price }) : copy.reasonsTitleNoPrice)
const promote = (shot: number) => {
setOrder((o) => promoteIn(o.length === count ? o : startOrder(count, 0), shot))
onChange?.(shot)
setStatus(fill(copy.status, { label: labelOf(shot) }))
}
const openLb = (shot: number) => {
setZoomed(false)
setOrigin({ x: 50, y: 50 })
setLb(shot)
}
const closeLb = () => {
const d = dialogRef.current
if (d?.open) d.close()
else setLb(null)
}
const lbShot = lb ?? ord[0]
const go = (step: number) => {
if (count < 2) return
const n = wrap(lbShot + step, count)
setLb(n)
setZoomed(false)
promote(n)
}
const onDialogKey = (e: React.KeyboardEvent<HTMLDialogElement>) => {
if (e.key === 'Tab') {
const d = dialogRef.current
if (!d) return
const els = Array.from(d.querySelectorAll<HTMLElement>('button:not([disabled]), [href], [tabindex]:not([tabindex="-1"])'))
if (!els.length) return
const first = els[0]
const last = els[els.length - 1]
const a = document.activeElement
if (e.shiftKey && (a === first || !d.contains(a))) {
e.preventDefault()
last.focus()
} else if (!e.shiftKey && (a === last || !d.contains(a))) {
e.preventDefault()
first.focus()
}
return
}
const pan: Record<string, [number, number]> = { ArrowLeft: [-10, 0], ArrowRight: [10, 0], ArrowUp: [0, -10], ArrowDown: [0, 10] }
if (zoomed && pan[e.key]) {
e.preventDefault()
const [mx, my] = pan[e.key]
setOrigin((o) => ({ x: pct(o.x + mx), y: pct(o.y + my) }))
return
}
if (e.key === 'ArrowRight') {
e.preventDefault()
go(1)
} else if (e.key === 'ArrowLeft') {
e.preventDefault()
go(-1)
}
}
const onCancel = (e: React.SyntheticEvent<HTMLDialogElement>) => {
if (zoomed) {
e.preventDefault()
setZoomed(false)
}
}
const onClose = () => {
setLb(null)
setZoomed(false)
mainRef.current?.focus()
}
const onPhotoClick = (e: React.MouseEvent<HTMLButtonElement>) => {
if (swiped.current) {
swiped.current = false
return
}
if (failed[lbShot]) return
if (zoomed) {
setZoomed(false)
return
}
setOrigin(e.detail > 0 ? pointIn(e.currentTarget, e.clientX, e.clientY) : { x: 50, y: 50 })
setZoomed(true)
}
const onPhotoDown = (e: React.PointerEvent<HTMLButtonElement>) => {
swipe.current = e.pointerType !== 'mouse' && !zoomed ? { x: e.clientX, y: e.clientY } : null
}
const onPhotoMove = (e: React.PointerEvent<HTMLButtonElement>) => {
if (zoomed) setOrigin(pointIn(e.currentTarget, e.clientX, e.clientY))
}
const onPhotoUp = (e: React.PointerEvent<HTMLButtonElement>) => {
const s = swipe.current
swipe.current = null
if (!s) return
const dx = e.clientX - s.x
const dy = e.clientY - s.y
if (Math.abs(dx) > 48 && Math.abs(dx) > Math.abs(dy)) {
swiped.current = true
go(dx < 0 ? 1 : -1)
}
}
const imgStyle = (shot: number) => {
const s = list[shot]
const focus = s?.focus || '50% 50%'
return { objectPosition: focus, transformOrigin: focus, '--z': String(clampZoom(s?.zoom)) } as React.CSSProperties
}
const frame = (shot: number) => {
const s = list[shot]
return (
<motion.span key={shot} layoutId={uid + '-f' + shot} className="pg2-frame" style={{ borderRadius: 12 }}>
<motion.span layout className="pg2-fill">
{failed[shot] ? (
<span className="pg2-miss">
<ImageOff size={24} strokeWidth={2.5} aria-hidden="true" />
<span>{copy.failed}</span>
</span>
) : (
<img
className="pg2-img"
src={s.src}
alt={s.alt}
draggable={false}
decoding="async"
style={imgStyle(shot)}
onError={() => setFailed((f) => ({ ...f, [shot]: true }))}
/>
)}
</motion.span>
</motion.span>
)
}
const caption = (shot: number) => {
const s = list[shot]
if (!s.question && !s.caption) return null
return (
<span key={'c' + shot} className="pg2-cap-text pg2-cap-in">
{s.question ? <strong className="pg2-q">{s.question}</strong> : null}
{s.question && s.caption ? ' ' : null}
{s.caption}
</span>
)
}
const actionClick = (e: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => {
if (locked) {
e.preventDefault()
return
}
onAction?.(e)
}
const action = href ? (
<a
className="pg2-cta"
href={href}
aria-disabled={locked || undefined}
tabIndex={locked ? -1 : undefined}
onClick={actionClick}
>
{actionLabel}
</a>
) : (
<button type="button" className="pg2-cta" disabled={locked} onClick={actionClick}>
{actionLabel}
</button>
)
const lbItem = list[lbShot]
const lbFocus = lbItem?.focus || '50% 50%'
const lbBase = clampZoom(lbItem?.zoom)
const lbStyle: React.CSSProperties = {
transform: 'scale(' + lbBase * (zoomed ? 2.2 : 1) + ')',
transformOrigin: zoomed ? origin.x + '% ' + origin.y + '%' : lbFocus,
}
return (
<section
className={('cf-pg2 ' + className).trim()}
style={{ ...FX_HOST, ...style }}
aria-labelledby={uid + '-h'}
>
<style>{CSS}</style>
{texture ? <Texture src={texture} tone="ink" /> : null}
<div className="pg2-in">
<header className="pg2-head pg2-rise">
<h2 className="pg2-h" id={uid + '-h'}>
{renderHeadline(headline, highlight)}
</h2>
{lead ? <p className="pg2-lead">{lead}</p> : null}
</header>
<MotionConfig reducedMotion="user" transition={SWAP}>
<div className={'pg2-bento pg2-n' + count + (hasWhy ? '' : ' pg2-nowhy')}>
<figure className="pg2-tile pg2-main pg2-rise" style={{ '--d': '.07s' } as React.CSSProperties}>
<button
ref={mainRef}
type="button"
className="pg2-shot is-main"
aria-haspopup="dialog"
aria-label={fill(copy.open, { alt: list[ord[0]].alt })}
onClick={() => openLb(ord[0])}
>
{frame(ord[0])}
<span className="pg2-zoom" aria-hidden="true">
<Maximize2 size={20} strokeWidth={2.5} />
</span>
</button>
<figcaption className="pg2-cap">
{caption(ord[0]) ?? <span className="pg2-cap-text" />}
{copy.zoomHint ? (
<span className="pg2-hint">
<ZoomIn size={16} strokeWidth={2.5} className="pg2-inl" aria-hidden="true" />
{copy.zoomHint}
</span>
) : null}
</figcaption>
</figure>
{count > 1 ? (
<motion.div layoutScroll className="pg2-rail">
{ord.slice(1).map((shot, k) => (
<figure
key={'p' + k}
className={'pg2-tile pg2-p' + (k + 1) + ' pg2-rise' + (state === 'hover' && k === 0 ? ' is-hover' : '')}
style={{ '--d': Math.min(0.28, 0.14 + k * 0.07) + 's' } as React.CSSProperties}
>
<button
type="button"
className="pg2-shot"
aria-label={fill(copy.promote, { alt: list[shot].alt })}
onClick={() => promote(shot)}
>
{frame(shot)}
</button>
{caption(shot) ? <figcaption className="pg2-cap">{caption(shot)}</figcaption> : null}
</figure>
))}
</motion.div>
) : null}
{hasWhy ? (
<div className="pg2-why pg2-rise" style={{ '--d': '.28s' } as React.CSSProperties}>
<h3 className="pg2-h3">{whyTitle}</h3>
<ol className="pg2-reasons">
{reasons.map((r, i) => (
<li key={i}>
<span className="pg2-num" aria-hidden="true">{i + 1}</span>
<span>{r}</span>
</li>
))}
</ol>
</div>
) : null}
<div className="pg2-buy pg2-rise" style={{ '--d': '.28s' } as React.CSSProperties}>
<div className="pg2-buy-in">
<div>
{productName ? <p className="pg2-buy-name">{productName}</p> : null}
{price ? (
<p className="pg2-price">
<span className="pg2-price-num">{price}</span>
{alternative ? <span className="pg2-price-vs">{alternative}</span> : null}
</p>
) : null}
</div>
<div>
{action}
{reassurance ? (
<p className="pg2-reass">
<ShieldCheck size={16} strokeWidth={2.5} className="pg2-inl" aria-hidden="true" />
{reassurance}
</p>
) : null}
</div>
</div>
</div>
</div>
</MotionConfig>
<p className="pg2-sr" aria-live="polite">
{status}
</p>
</div>
<dialog
ref={dialogRef}
className="pg2-lb"
id={uid + '-lb'}
aria-label={fill(copy.dialogLabel, { productName })}
onKeyDown={onDialogKey}
onCancel={onCancel}
onClose={onClose}
>
{open && lbItem ? (
<div className="pg2-lb-in">
<div className="pg2-lb-top">
<p className="pg2-lb-title">
{productName}
<span className="pg2-lb-count">{fill(copy.count, { index: lbShot + 1, count })}</span>
</p>
<button ref={closeRef} type="button" className="pg2-chip" aria-label={copy.close} onClick={closeLb}>
<X size={20} strokeWidth={2.5} aria-hidden="true" />
</button>
</div>
<div className="pg2-lb-stage">
{count > 1 ? (
<button type="button" className="pg2-chip pg2-lb-nav is-prev" aria-label={copy.prev} onClick={() => go(-1)}>
<ChevronLeft size={24} strokeWidth={2.5} aria-hidden="true" />
</button>
) : null}
<button
type="button"
className={'pg2-lb-photo' + (zoomed ? ' is-zoomed' : '')}
aria-label={zoomed ? copy.zoomOut : fill(copy.zoomIn, { alt: lbItem.alt })}
aria-pressed={zoomed}
onClick={onPhotoClick}
onPointerDown={onPhotoDown}
onPointerMove={onPhotoMove}
onPointerUp={onPhotoUp}
onPointerCancel={() => (swipe.current = null)}
>
{failed[lbShot] ? (
<span className="pg2-lb-miss">
<ImageOff size={24} strokeWidth={2.5} aria-hidden="true" />
<span>{copy.failed}</span>
</span>
) : (
<img
key={lbShot}
className="pg2-lb-img"
src={lbItem.src}
alt={lbItem.alt}
draggable={false}
style={lbStyle}
onError={() => setFailed((f) => ({ ...f, [lbShot]: true }))}
/>
)}
</button>
{count > 1 ? (
<button type="button" className="pg2-chip pg2-lb-nav is-next" aria-label={copy.next} onClick={() => go(1)}>
<ChevronRight size={24} strokeWidth={2.5} aria-hidden="true" />
</button>
) : null}
</div>
{lbItem.question || lbItem.caption ? (
<p className="pg2-lb-cap">
{lbItem.question ? <strong>{lbItem.question}</strong> : null}
{lbItem.question && lbItem.caption ? ' ' : null}
{lbItem.caption}
</p>
) : (
<span />
)}
{count > 1 ? (
<div className="pg2-lb-thumbs">
{list.map((s, i) => (
<button
key={i}
type="button"
className="pg2-lb-thumb"
aria-current={i === lbShot ? 'true' : undefined}
aria-label={fill(copy.thumb, { index: i + 1, count, label: labelOf(i) })}
onClick={() => {
setLb(i)
setZoomed(false)
promote(i)
}}
>
{failed[i] ? <ImageOff size={18} strokeWidth={2.5} aria-hidden="true" /> : <img src={s.src} alt="" style={imgStyle(i)} />}
</button>
))}
</div>
) : (
<span />
)}
</div>
) : null}
</dialog>
</section>
)
}
export default ProductGallery2
const fill = (t: string, vars: Record<string, string | number>) =>
Object.entries(vars).reduce((s, [k, v]) => s.split('{' + k + '}').join(String(v)), t)
const wrap = (n: number, c: number) => (c ? ((n % c) + c) % c : 0)
const pct = (n: number) => Math.min(100, Math.max(0, n))
const clampZoom = (z?: number) => Math.min(3, Math.max(1, z || 1))
function promoteIn(order: number[], shot: number) {
const p = order.indexOf(shot)
if (p <= 0) return order
const next = order.slice()
next[p] = next[0]
next[0] = shot
return next
}
function startOrder(count: number, lead: number) {
const base = Array.from({ length: count }, (_, i) => i)
return count ? promoteIn(base, wrap(lead, count)) : base
}
function pointIn(el: HTMLElement, x: number, y: number) {
const r = el.getBoundingClientRect()
if (!r.width || !r.height) return { x: 50, y: 50 }
return { x: pct(((x - r.left) / r.width) * 100), y: pct(((y - r.top) / r.height) * 100) }
}
function renderHeadline(h: React.ReactNode, phrase?: string) {
if (typeof h !== 'string' || !phrase) return h
const i = h.indexOf(phrase)
if (i < 0) return h
return (
<>
{h.slice(0, i)}
<span className="pg2-mark">{phrase}</span>
{h.slice(i + phrase.length)}
</>
)
}
const SHADOW = 'oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h'
const CSS = `
.cf-pg2{--pg2-gutter:clamp(16px,5vw,48px);--pg2-marker:var(--marker,#fae37c);position:relative;overflow-x:clip;background:var(--surface);color:var(--ink);font-family:var(--font-body);padding:clamp(56px,8vw,112px) var(--pg2-gutter) clamp(64px,8.5vw,120px)}
.cf-pg2 *,.cf-pg2 *::before,.cf-pg2 *::after{box-sizing:border-box}
.cf-pg2 :is(h2,h3,p,figure,ol){margin:0}
.cf-pg2 .pg2-in{position:relative;z-index:1;max-width:1120px;margin:0 auto}
.cf-pg2 .pg2-head{max-width:46rem;margin-bottom:clamp(32px,4vw,48px)}
.cf-pg2 .pg2-h{font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;text-wrap:balance;color:var(--ink)}
.cf-pg2 .pg2-mark{background:linear-gradient(var(--pg2-marker),var(--pg2-marker)) 0 88%/100% .46em no-repeat;-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:0 .06em;border-radius:.14em}
.cf-pg2 .pg2-lead{margin-top:16px;max-width:60ch;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
.cf-pg2 .pg2-bento{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:24px 16px}
.cf-pg2 .pg2-rail{display:contents}
.cf-pg2 .pg2-tile{display:flex;flex-direction:column;gap:12px;min-width:0}
.cf-pg2 .pg2-shot{position:relative;display:flex;flex-direction:column;flex:1 1 auto;min-height:0;width:100%;padding:0;border:0;background:none;color:inherit;font:inherit;text-align:left;border-radius:12px;cursor:pointer;-webkit-tap-highlight-color:transparent;transition:transform .16s ease}
.cf-pg2 .pg2-shot.is-main{cursor:zoom-in}
.cf-pg2 .pg2-shot:active{transform:scale(.985)}
.cf-pg2 .pg2-shot:focus-visible{outline:3px solid var(--accent);outline-offset:3px}
.cf-pg2 .pg2-frame{position:relative;display:block;width:100%;overflow:hidden;border-radius:12px;background:color-mix(in oklch,var(--ink) 6%,var(--surface))}
.cf-pg2 .pg2-fill{position:absolute;inset:0;display:block}
.cf-pg2 .pg2-img{display:block;width:100%;height:100%;object-fit:cover;transform:scale(var(--z,1));user-select:none}
.cf-pg2 .pg2-shot:hover .pg2-img,.cf-pg2 .is-hover .pg2-img{transform:scale(calc(var(--z,1) * 1.04))}
.cf-pg2 .pg2-tile:hover .pg2-q,.cf-pg2 .is-hover .pg2-q{color:var(--accent)}
.cf-pg2 .pg2-miss{display:flex;height:100%;flex-direction:column;align-items:center;justify-content:center;gap:8px;padding:16px;text-align:center;font-size:.9375rem;font-weight:600;color:var(--muted)}
.cf-pg2 .pg2-zoom{position:absolute;top:12px;right:12px;z-index:2;display:grid;place-items:center;width:40px;height:40px;border-radius:999px;background:var(--card);color:var(--ink);box-shadow:var(--shadow-sm,0 1px 1px ${SHADOW} / .18),0 1px 3px ${SHADOW} / .14));transition:transform .16s ease}
.cf-pg2 .pg2-shot.is-main:hover .pg2-zoom{transform:scale(1.06)}
.cf-pg2 .pg2-cap{font-size:.9375rem;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-pg2 .pg2-q{color:var(--ink);font-weight:700;transition:color .16s ease}
.cf-pg2 .pg2-main .pg2-cap{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:8px 24px;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5}
.cf-pg2 .pg2-cap-text{display:block;flex:1 1 22rem;min-width:0}
.cf-pg2 .pg2-hint{font-size:.9375rem;font-weight:600;color:var(--muted);white-space:nowrap}
.cf-pg2 .pg2-inl{display:inline-block;vertical-align:-.15em;margin-inline-end:.4em}
.cf-pg2 .pg2-why{display:flex;flex-direction:column;min-width:0;padding:clamp(20px,3vw,28px);background:var(--card);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--ink) l c h / .12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-md,0 1px 2px ${SHADOW} / .22),0 4px 10px -2px ${SHADOW} / .2)))}
.cf-pg2 .pg2-h3{margin-bottom:16px;font-family:var(--font-display);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-.01em;text-wrap:balance}
.cf-pg2 .pg2-reasons{list-style:none;padding:0;display:grid;gap:16px}
.cf-pg2 .pg2-reasons li{display:grid;grid-template-columns:1.25em minmax(0,1fr);gap:12px;align-items:baseline;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.45;text-wrap:pretty}
.cf-pg2 .pg2-num{font-family:var(--font-display);font-weight:800;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1;color:var(--accent);font-variant-numeric:tabular-nums}
.cf-pg2 .pg2-buy{container-type:inline-size;min-width:0;padding:clamp(20px,3vw,28px);background:var(--band);color:var(--band-ink);border:1px solid oklch(from var(--band-ink) l c h / .14);border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--shadow-lg,0 2px 4px ${SHADOW} / .22),0 12px 24px -8px ${SHADOW} / .32))}
.cf-pg2 .pg2-buy-in{display:flex;flex-direction:column;justify-content:center;gap:24px;height:100%}
.cf-pg2 .pg2-buy-name{font-size:.9375rem;font-weight:700;line-height:1.4}
.cf-pg2 .pg2-price{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;margin-top:12px}
.cf-pg2 .pg2-price-num{font-family:var(--font-display);font-weight:800;font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1;letter-spacing:-.03em;font-variant-numeric:tabular-nums}
.cf-pg2 .pg2-price-vs{flex:1 1 9rem;min-width:0;font-size:.9375rem;font-weight:600;line-height:1.35;text-wrap:pretty}
.cf-pg2 .pg2-reass{margin-top:16px;text-align:center;font-size:.9375rem;font-weight:600;line-height:1.4;text-wrap:pretty}
@container (min-width:600px){.cf-pg2 .pg2-buy-in{display:grid;grid-template-columns:minmax(0,1fr) minmax(16rem,22rem);align-items:center;gap:16px 40px}}
.cf-pg2 .pg2-cta{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));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:clamp(1.125rem,1.45vw,1.25rem);line-height:1.15;text-align:center;text-wrap:balance;text-decoration:none;color:var(--button-ink,var(--cta-ink));text-shadow:var(--button-text-shadow,none);background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l + .04) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .02) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta)) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - .16) c h),0 1px 2px ${SHADOW} / .4),0 8px 16px -6px ${SHADOW} / .5));cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
.cf-pg2 .pg2-cta:hover{background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l - .01) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta)) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - .16) c h),0 1px 2px ${SHADOW} / .45),0 10px 18px -6px ${SHADOW} / .6))}
.cf-pg2 .pg2-cta:active{transform:translateY(1px);box-shadow:inset 0 2px 4px oklch(from var(--button-bg,var(--cta)) calc(l - .2) c h / .6),inset 0 -2px 0 oklch(from var(--button-bg,var(--cta)) calc(l - .16) c h)}
.cf-pg2 .pg2-cta:focus-visible{outline:3px solid var(--band-ink);outline-offset:3px}
.cf-pg2 .pg2-cta:disabled,.cf-pg2 .pg2-cta[aria-disabled="true"]{background:var(--secondary);color:var(--secondary-ink);text-shadow:none;box-shadow:none;cursor:not-allowed;transform:none}
.cf-pg2 .pg2-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
@media (min-width:1024px){
.cf-pg2 .pg2-main{grid-column:1/9;grid-row:1/3}
.cf-pg2 .pg2-main .pg2-frame{flex:1 1 auto;min-height:320px}
.cf-pg2 .pg2-p1{grid-column:9/13;grid-row:1}
.cf-pg2 .pg2-p2{grid-column:9/13;grid-row:2}
.cf-pg2 .pg2-p1 .pg2-frame,.cf-pg2 .pg2-p2 .pg2-frame{aspect-ratio:4/3}
.cf-pg2 .pg2-p3{grid-column:1/5;grid-row:3}
.cf-pg2 .pg2-p3 .pg2-frame{flex:1 1 auto;min-height:200px}
.cf-pg2 .pg2-why{grid-column:5/9;grid-row:3}
.cf-pg2 .pg2-buy{grid-column:9/13;grid-row:3}
.cf-pg2 .pg2-n3 .pg2-why,.cf-pg2 .pg2-n2 .pg2-why,.cf-pg2 .pg2-n1 .pg2-why{grid-column:1/7}
.cf-pg2 .pg2-n3 .pg2-buy,.cf-pg2 .pg2-n2 .pg2-buy,.cf-pg2 .pg2-n1 .pg2-buy{grid-column:7/13}
.cf-pg2 .pg2-n2 .pg2-p1{grid-row:1/3}
.cf-pg2 .pg2-n2 .pg2-p1 .pg2-frame{aspect-ratio:auto;flex:1 1 auto;min-height:480px}
.cf-pg2 .pg2-n1 .pg2-main{grid-column:1/13;grid-row:1}
.cf-pg2 .pg2-n1 .pg2-main .pg2-frame{flex:none;min-height:0;aspect-ratio:16/9}
.cf-pg2 .pg2-nowhy .pg2-buy{grid-column:5/13}
.cf-pg2 .pg2-nowhy.pg2-n3 .pg2-buy,.cf-pg2 .pg2-nowhy.pg2-n2 .pg2-buy,.cf-pg2 .pg2-nowhy.pg2-n1 .pg2-buy{grid-column:1/13}
}
@media (min-width:641px) and (max-width:1023.98px){
.cf-pg2 .pg2-bento{grid-template-columns:repeat(6,minmax(0,1fr))}
.cf-pg2 .pg2-main{grid-column:1/7;grid-row:1}
.cf-pg2 .pg2-frame{aspect-ratio:4/3}
.cf-pg2 .pg2-main .pg2-frame{aspect-ratio:16/10}
.cf-pg2 .pg2-p1{grid-column:1/3;grid-row:2}
.cf-pg2 .pg2-p2{grid-column:3/5;grid-row:2}
.cf-pg2 .pg2-p3{grid-column:5/7;grid-row:2}
.cf-pg2 .pg2-n3 .pg2-p1{grid-column:1/4}
.cf-pg2 .pg2-n3 .pg2-p2{grid-column:4/7}
.cf-pg2 .pg2-n2 .pg2-p1{grid-column:1/7}
.cf-pg2 .pg2-n2 .pg2-p1 .pg2-frame{aspect-ratio:16/9}
.cf-pg2 .pg2-why{grid-column:1/4;grid-row:3}
.cf-pg2 .pg2-buy{grid-column:4/7;grid-row:3}
.cf-pg2 .pg2-nowhy .pg2-buy{grid-column:1/7}
}
@media (max-width:640px){
.cf-pg2 .pg2-bento{display:flex;flex-direction:column;gap:24px}
.cf-pg2 .pg2-main .pg2-frame{aspect-ratio:1/1}
.cf-pg2 .pg2-rail{display:flex;gap:12px;overflow-x:auto;scroll-snap-type:x mandatory;margin:-8px calc(-1 * var(--pg2-gutter));padding:8px var(--pg2-gutter);scroll-padding-inline:var(--pg2-gutter);scrollbar-width:none;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
.cf-pg2 .pg2-rail::-webkit-scrollbar{display:none}
.cf-pg2 .pg2-rail>.pg2-tile{flex:0 0 min(74%,300px);scroll-snap-align:start}
.cf-pg2 .pg2-rail .pg2-frame{aspect-ratio:4/3}
.cf-pg2 .pg2-zoom{top:8px;right:8px}
}
.cf-pg2 .pg2-lb{position:fixed;inset:0;width:100%;height:100%;max-width:none;max-height:none;margin:0;padding:0;border:0;overflow:hidden;background:oklch(from var(--band) calc(l - .08) c h / .97);color:var(--band-ink);font-family:var(--font-body)}
.cf-pg2 .pg2-lb::backdrop{background:transparent}
.cf-pg2 .pg2-lb-in{display:grid;grid-template-rows:auto minmax(0,1fr) auto auto;gap:16px;height:100%;padding:16px clamp(16px,4vw,40px) clamp(16px,3vw,28px)}
.cf-pg2 .pg2-lb-top{display:flex;align-items:center;justify-content:space-between;gap:16px}
.cf-pg2 .pg2-lb-title{min-width:0;font-size:.9375rem;font-weight:700;line-height:1.4}
.cf-pg2 .pg2-lb-count{margin-inline-start:12px;font-size:.875rem;font-weight:800;font-variant-numeric:tabular-nums}
.cf-pg2 .pg2-chip{display:grid;place-items:center;flex:none;width:48px;height:48px;padding:0;border-radius:999px;border:1px solid oklch(from var(--band-ink) l c h / .22);background:oklch(from var(--band-ink) l c h / .1);color:var(--band-ink);cursor:pointer;transition:background .16s ease,transform .16s ease}
.cf-pg2 .pg2-chip:hover{background:oklch(from var(--band-ink) l c h / .2)}
.cf-pg2 .pg2-chip:active{transform:scale(.96)}
.cf-pg2 .pg2-lb :focus-visible{outline:3px solid var(--band-ink);outline-offset:3px}
.cf-pg2 .pg2-lb-stage{position:relative;display:flex;align-items:center;justify-content:center;min-height:0;padding:0 72px}
.cf-pg2 .pg2-lb-nav{position:absolute;top:50%;transform:translateY(-50%)}
.cf-pg2 .pg2-lb-nav:active{transform:translateY(-50%) scale(.96)}
.cf-pg2 .pg2-lb-nav.is-prev{left:0}
.cf-pg2 .pg2-lb-nav.is-next{right:0}
.cf-pg2 .pg2-lb-photo{display:block;max-width:100%;padding:0;border:0;border-radius:12px;overflow:hidden;background:oklch(from var(--band-ink) l c h / .06);color:inherit;cursor:zoom-in;touch-action:pan-y}
.cf-pg2 .pg2-lb-photo.is-zoomed{cursor:zoom-out;touch-action:none}
.cf-pg2 .pg2-lb-img{display:block;width:auto;height:auto;max-width:100%;max-height:calc(100dvh - 252px);user-select:none;transition:transform .3s cubic-bezier(.2,.7,.2,1)}
.cf-pg2 .pg2-lb-miss{display:flex;flex-direction:column;align-items:center;gap:8px;padding:48px 32px;font-size:.9375rem;font-weight:600}
.cf-pg2 .pg2-lb-cap{max-width:60ch;margin:0 auto;text-align:center;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;text-wrap:pretty}
.cf-pg2 .pg2-lb-thumbs{display:flex;flex-wrap:wrap;justify-content:center;gap:8px}
.cf-pg2 .pg2-lb-thumb{display:grid;place-items:center;width:56px;height:56px;padding:0;border:0;border-radius:8px;overflow:hidden;background:oklch(from var(--band-ink) l c h / .1);color:var(--band-ink);cursor:pointer;opacity:.72;transition:opacity .16s ease}
.cf-pg2 .pg2-lb-thumb:hover,.cf-pg2 .pg2-lb-thumb[aria-current="true"]{opacity:1}
.cf-pg2 .pg2-lb-thumb[aria-current="true"]{outline:2px solid var(--band-ink);outline-offset:2px}
.cf-pg2 .pg2-lb-thumb img{display:block;width:100%;height:100%;object-fit:cover;transform:scale(var(--z,1))}
@media (max-width:640px){
.cf-pg2 .pg2-lb-stage{padding:0 0 64px}
.cf-pg2 .pg2-lb-nav{top:auto;bottom:0;transform:none}
.cf-pg2 .pg2-lb-nav:active{transform:scale(.96)}
.cf-pg2 .pg2-lb-img{max-height:calc(100dvh - 310px)}
.cf-pg2 .pg2-lb-thumb{width:48px;height:48px}
}
@keyframes pg2-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes pg2-pop{from{opacity:.82;transform:scale(.98)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:no-preference){
.cf-pg2 .pg2-rise{animation:pg2-rise .45s cubic-bezier(.2,.7,.2,1) both;animation-delay:var(--d,0s)}
.cf-pg2 .pg2-cap-in{animation:pg2-rise .45s cubic-bezier(.2,.7,.2,1) both}
.cf-pg2 .pg2-img{transition:transform .45s cubic-bezier(.2,.7,.2,1)}
.cf-pg2 .pg2-lb[open] .pg2-lb-in{animation:pg2-pop .3s cubic-bezier(.2,.7,.2,1) both}
}
@media (prefers-reduced-motion:reduce){
.cf-pg2 *,.cf-pg2 *::before,.cf-pg2 *::after{animation:none!important;transition:none!important}
}
`
pieces/offer/product-gallery-2/specimen.tsx 73 lines
import __studioImagec3497a0e from "../assets/bc3a54b057c3aed0.webp";
import __studioImagedbbfab62 from "../assets/2155d465de262445.webp";
import __studioImage59ddb254 from "../assets/29baf2d7da9af53a.webp";
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
import { ProductGallery2, type ProductGallery2State } from '../product-gallery-2'
export const states = ['default', 'hover', 'active', 'disabled']
export default function ProductGallery2Specimen({ state = 'default' }: { state?: ProductGallery2State }) {
const hero = slot(
'product',
__studioImagec3497a0e,
)
const inHand = slot(
'item-1',
__studioImagedbbfab62,
)
const onTrail = slot(
'scene',
__studioImage59ddb254,
)
return (
<ProductGallery2
state={state}
headline="See how it carries before you buy it"
highlight="before you buy it"
lead="How big is it? How well is it made? How does it look on the trail? These photos show you. Tap any one to bring it up front."
productName="Trailhead 20L daypack"
shots={[
{
src: hero,
alt: 'Trailhead 20L daypack in forest green, front three-quarter view',
question: 'What do you get?',
caption: 'One 20-litre pack: two zip pockets up front, padded straps behind.',
},
{
src: inHand,
alt: 'A hand carrying the Trailhead 20L daypack by its top loop',
question: 'How big is it?',
caption: 'Carries one-handed by the top loop, packed for a full day.',
focus: '50% 45%',
},
{
src: hero,
alt: 'Close-up of the daypack’s ripstop fabric and stitching',
question: 'How well is it made?',
caption: 'Up close: ripstop fabric and double-stitched seams.',
focus: '50% 58%',
zoom: 2,
},
{
src: onTrail,
alt: 'A hiker wearing the Trailhead 20L daypack on a forest trail at golden hour',
question: 'How does it look on the trail?',
caption: 'Sits high and snug, so it doesn’t bounce on the climb.',
focus: '50% 40%',
},
]}
reasonsHeading="Three reasons it’s $89 today"
reasons={[
'You buy straight from us, so there’s no store markup on top.',
'One pack, one price, and the rain cover is already in the box.',
'It’s built to outlast the cheap pack you’d replace every spring.',
]}
price="$89"
alternative="vs. $35 every spring for a pack that wears out"
actionLabel="Get me on the trail"
reassurance={defaults.sample.guarantee}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalProductGallery2 |
React.ReactNode |
Default 'See it up close before you buy'
|
highlight OptionalProductGallery2 |
string |
Default 'up close'
|
lead OptionalProductGallery2 |
React.ReactNode |
Default 'Tap any photo to bring it up front. Tap the big one to zoom in.'
|
productName OptionalProductGallery2 |
string |
Default 'This product'
|
shots OptionalProductGallery2 |
BentoShot[] |
Default []
|
reasonsHeading OptionalProductGallery2 |
string |
|
reasons OptionalProductGallery2 |
React.ReactNode[] |
Default []
|
price OptionalProductGallery2 |
string |
Default ''
|
alternative OptionalProductGallery2 |
React.ReactNode |
|
actionLabel OptionalProductGallery2 |
string |
Default 'Send me mine'
|
reassurance OptionalProductGallery2 |
React.ReactNode |
|
href OptionalProductGallery2 |
string |
|
onAction OptionalProductGallery2 |
(event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void |
|
disabled OptionalProductGallery2 |
boolean |
Default false
|
texture OptionalProductGallery2 |
React.ComponentProps<typeof Texture>['src'] | null |
Default topo
|
copy OptionalProductGallery2 |
Partial<ProductGallery2Copy> |
|
initialIndex OptionalProductGallery2 |
number |
Default 0
|
onChange OptionalProductGallery2 |
(index: number) => void |
|
state OptionalProductGallery2 |
ProductGallery2State |
Default 'default'
|
className OptionalProductGallery2 |
string |
Default ''
|
style OptionalProductGallery2 |
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.
--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.
--marker- The highlighter colour behind key phrases.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
item-1- 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.
-
2155d465de262445.webp
image/webp · 20.5 KB
-
29baf2d7da9af53a.webp
image/webp · 58.9 KB
-
a57ca5c86a05001f.webp
image/webp · 108 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
bc3a54b057c3aed0.webp
image/webp · 43.8 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB