Product Gallery 3
Before/after product gallery: the visitor drags one line across two photos of the same thing, the numbered path beside it lights up, and the path ends at the order button.
Use it in a prompt
Use offer/product-gallery-3 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-3.tsx. - Import it and pass your copy and images (Props tab):
import { ProductGallery3 } from "@/components/funneldna/offer/product-gallery-3"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/product-gallery-3/component.tsx 567 lines
// layout: path-to-action
// Before/after product gallery: the visitor drags one line across two photos of the same thing, the numbered path beside it lights up, and the path ends at the order button.
'use client'
import * as React from 'react'
import { ChevronsLeftRight, Info, ShieldCheck } from 'lucide-react'
import { FX_HOST, Pattern } from '../fx/fx'
export type GalleryShot = {
/** Real product photo URL (slot: product). */
src: string
alt: string
/** Short name under the thumbnail, e.g. The bar. */
label: string
}
export type ProductGallery3State = 'default' | 'hover' | 'active' | 'disabled'
export type ProductGallery3Copy = {
/** Accessible name of the divider. */
sliderLabel: string
/** {before} and {after} are replaced with percentages. */
sliderValue: string
stripLabel: string
/** {label} is replaced with the photo on stage. */
viewing: string
/** {label} is replaced: accessible name of the Before / After buttons. */
showSide: string
}
const DEFAULT_COPY: ProductGallery3Copy = {
sliderLabel: 'Before and after divider',
sliderValue: '{before}% before, {after}% after',
stripLabel: 'Choose a photo',
viewing: 'Showing {label}',
showSide: 'Show the full {label} photo',
}
export type ProductGallery3Props = {
/** Main promise. A plain string can carry one marker-highlighted phrase. */
headline?: React.ReactNode
/** Exact phrase inside a string headline to swipe with the marker. */
highlight?: string
lead?: React.ReactNode
/** Stop 2 heading while the comparison is on stage. */
compareHeading?: string
/** Stop 2 heading while a single photo is on stage. */
photoHeading?: string
/** Stop 3 heading above the action. */
actionHeading?: string
/** The thing before (slot: before). Both photos are needed for the comparison. */
beforeImage?: string
/** The same thing after, same framing (slot: after). */
afterImage?: string
beforeAlt?: string
afterAlt?: string
beforeLabel?: string
afterLabel?: string
/** One short line under the Before label. */
beforeCaption?: string
afterCaption?: string
/** object-position for both comparison photos, so they stay aligned. */
imagePosition?: string
compareThumbLabel?: string
/** Normal product photos in the strip under the stage. */
shots?: GalleryShot[]
/** Small print under the strip, e.g. that the photos are illustrative. */
note?: string
investmentLabel?: string
/** Price in the investment line; the line is hidden when empty. */
price?: string
/** Rest of the investment sentence after the price. */
offerLine?: string
actionLabel?: string
/** One reassurance line under the button, e.g. the guarantee. */
reassurance?: string
href?: string
onAction?: () => void
disabled?: boolean
/** Divider start, 0 (all after) to 100 (all before). */
initialPosition?: number
state?: ProductGallery3State
copy?: Partial<ProductGallery3Copy>
/** Called with the strip index when the stage changes. */
onSelect?: (index: number) => void
className?: string
style?: React.CSSProperties
}
export function ProductGallery3({
headline = 'Don’t take our word for it. Drag the line.',
highlight = 'Drag the line.',
lead = 'Two photos of the same thing, side by side. Slide across to compare them, then decide.',
compareHeading = 'Drag the line across the photo',
photoHeading = 'Take a closer look',
actionHeading = 'Get yours on the way',
beforeImage,
afterImage,
beforeAlt = 'Before',
afterAlt = 'After',
beforeLabel = 'Before',
afterLabel = 'After',
beforeCaption = '',
afterCaption = '',
imagePosition = '50% 50%',
compareThumbLabel = 'Before & after',
shots = [],
note = '',
investmentLabel = 'Your investment:',
price = '',
offerLine = '',
actionLabel = 'Send me mine',
reassurance = '',
href,
onAction,
disabled = false,
initialPosition = 50,
state = 'default',
copy: copyIn,
onSelect,
className = '',
style,
}: ProductGallery3Props) {
const copy: ProductGallery3Copy = { ...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 = 'pg3' + React.useId().replace(/[^a-zA-Z0-9]/g, '')
const hasCompare = Boolean(beforeImage && afterImage)
const offset = hasCompare ? 1 : 0
const count = shots.length + offset
const startPos = (s: ProductGallery3State) => (s === 'active' ? 22 : clampPct(initialPosition))
const [active, setActive] = React.useState(0)
const [pos, setPos] = React.useState(() => startPos(state))
const [dragging, setDragging] = React.useState(false)
const [seen, setSeen] = React.useState<Record<number, boolean>>({ 0: true })
const stageRef = React.useRef<HTMLDivElement>(null)
const handleRef = React.useRef<HTMLDivElement>(null)
const gesture = React.useRef<Gesture | null>(null)
React.useEffect(() => {
setActive(0)
setPos(startPos(state))
setDragging(false)
setSeen({ 0: true })
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [state, hasCompare, shots.length])
if (!count) return null
const isCompare = hasCompare && active === 0
const shot = isCompare ? null : shots[active - offset] ?? shots[0]
const labelOf = (i: number) => (hasCompare && i === 0 ? compareThumbLabel : shots[i - offset]?.label ?? '')
const locked = disabled || state === 'disabled'
const fillPct = hasCompare ? 100 - pos : count > 1 ? (Object.keys(seen).length / count) * 100 : 100
const reached = fillPct >= 99
const beforeOn = isCompare && pos >= 60
const afterOn = isCompare && pos <= 40
const previewThumb = state === 'hover' ? (active === 0 ? 1 : 0) : -1
const select = (i: number) => {
const n = Math.min(count - 1, Math.max(0, i))
setActive(n)
setSeen((s) => (s[n] ? s : { ...s, [n]: true }))
onSelect?.(n)
}
const snap = (to: number) => {
if (!isCompare) select(0)
setPos(to)
}
const posAt = (clientX: number) => {
const r = stageRef.current?.getBoundingClientRect()
if (!r || !r.width) return pos
return clampPct(((clientX - r.left) / r.width) * 100)
}
const focusHandle = () => handleRef.current?.focus({ preventScroll: true })
const onDown = (e: React.PointerEvent<HTMLDivElement>) => {
if (!isCompare || e.button > 0) return
const mouse = e.pointerType === 'mouse'
gesture.current = { id: e.pointerId, x: e.clientX, y: e.clientY, engaged: mouse }
if (!mouse) return
e.preventDefault()
e.currentTarget.setPointerCapture?.(e.pointerId)
setDragging(true)
setPos(posAt(e.clientX))
focusHandle()
}
const onMove = (e: React.PointerEvent<HTMLDivElement>) => {
const g = gesture.current
if (!g || g.id !== e.pointerId) return
if (!g.engaged) {
const dx = e.clientX - g.x
const dy = e.clientY - g.y
if (Math.abs(dy) > 10 && Math.abs(dy) > Math.abs(dx)) {
gesture.current = null
return
}
if (Math.abs(dx) < 6) return
g.engaged = true
e.currentTarget.setPointerCapture?.(e.pointerId)
setDragging(true)
focusHandle()
}
setPos(posAt(e.clientX))
}
const onUp = (e: React.PointerEvent<HTMLDivElement>) => {
const g = gesture.current
gesture.current = null
if (!g || g.id !== e.pointerId) return
if (!g.engaged) {
setPos(posAt(e.clientX))
focusHandle()
}
setDragging(false)
}
const onCancel = () => {
gesture.current = null
setDragging(false)
}
const onKey = (e: React.KeyboardEvent<HTMLDivElement>) => {
const step = e.shiftKey ? 10 : 5
const moves: Record<string, number> = { ArrowLeft: -step, ArrowDown: -step, ArrowRight: step, ArrowUp: step, PageDown: -20, PageUp: 20 }
let next: number | null = null
if (e.key in moves) next = pos + moves[e.key]
else if (e.key === 'Home') next = 0
else if (e.key === 'End') next = 100
if (next === null) return
e.preventDefault()
setPos(clampPct(next))
}
let head: React.ReactNode = headline
if (typeof headline === 'string' && highlight && headline.includes(highlight)) {
const at = headline.indexOf(highlight)
head = (
<>
{headline.slice(0, at)}
<span className='cf-pg3__mark'>{highlight}</span>
{headline.slice(at + highlight.length)}
</>
)
}
const action =
href && !locked ? (
<a className='cf-pg3__cta' href={href} onClick={onAction ? () => onAction() : undefined}>
{actionLabel}
</a>
) : (
<button type='button' className='cf-pg3__cta' disabled={locked} onClick={() => onAction?.()}>
{actionLabel}
</button>
)
const roundPos = Math.round(pos)
const stageClass = [
'cf-pg3__stage',
isCompare ? '' : 'is-photo',
dragging || state === 'active' ? 'is-dragging' : '',
state === 'hover' ? 'is-hover' : '',
]
.filter(Boolean)
.join(' ')
return (
<section className={`cf-pg3 ${className}`.trim()} style={{ ...FX_HOST, ...style }} aria-labelledby={`${uid}-h`} data-state={state}>
<style>{CSS}</style>
<Pattern name='grid' fade='corner' />
<div className='cf-pg3__wrap'>
<div className='cf-pg3__stop is-lit' style={{ '--i': 0 } as React.CSSProperties}>
<div className='cf-pg3__rail' aria-hidden='true'>
<span className='cf-pg3__num cf-pg3__num--first'>01</span>
<span className='cf-pg3__line'>
<i style={{ height: '100%' }} />
</span>
</div>
<div className='cf-pg3__body'>
<h2 id={`${uid}-h`} className='cf-pg3__h2'>
{head}
</h2>
{lead ? <p className='cf-pg3__lead'>{lead}</p> : null}
</div>
</div>
<div className='cf-pg3__stop is-lit' style={{ '--i': 1 } as React.CSSProperties}>
<div className='cf-pg3__rail' aria-hidden='true'>
<span className='cf-pg3__num'>02</span>
<span className='cf-pg3__line'>
<i style={{ height: `${fillPct}%` }} />
</span>
</div>
<div className='cf-pg3__body'>
<h3 className='cf-pg3__h3'>{isCompare ? compareHeading : photoHeading}</h3>
<div className='cf-pg3__viewer'>
<div className={`cf-pg3__deck${hasCompare ? '' : ' is-plain'}`}>
{hasCompare ? (
<button
type='button'
className={`cf-pg3__side cf-pg3__side--before${beforeOn ? ' is-on' : ''}`}
aria-label={fmt(copy.showSide, { label: beforeLabel })}
onClick={() => snap(100)}
>
<span className='cf-pg3__side-word'>{beforeLabel}</span>
{beforeCaption ? <span className='cf-pg3__side-cap'>{beforeCaption}</span> : null}
</button>
) : null}
<div
ref={stageRef}
className={stageClass}
style={{ '--pos': `${pos}%` } as React.CSSProperties}
onPointerDown={onDown}
onPointerMove={onMove}
onPointerUp={onUp}
onPointerCancel={onCancel}
>
{isCompare ? (
<>
<img className='cf-pg3__img' src={beforeImage} alt={beforeAlt} draggable={false} style={{ objectPosition: imagePosition }} />
<img
className='cf-pg3__img cf-pg3__img--after'
src={afterImage}
alt={afterAlt}
draggable={false}
style={{ objectPosition: imagePosition }}
/>
<span className='cf-pg3__divider' aria-hidden='true' />
<div
ref={handleRef}
className='cf-pg3__handle'
role='slider'
tabIndex={0}
aria-label={copy.sliderLabel}
aria-orientation='horizontal'
aria-valuemin={0}
aria-valuemax={100}
aria-valuenow={roundPos}
aria-valuetext={fmt(copy.sliderValue, { before: roundPos, after: 100 - roundPos })}
onKeyDown={onKey}
>
<ChevronsLeftRight size={24} strokeWidth={2.5} aria-hidden='true' />
</div>
</>
) : shot ? (
<img key={shot.src} className='cf-pg3__img cf-pg3__img--single' src={shot.src} alt={shot.alt} draggable={false} />
) : null}
</div>
{hasCompare ? (
<button
type='button'
className={`cf-pg3__side cf-pg3__side--after${afterOn ? ' is-on' : ''}`}
aria-label={fmt(copy.showSide, { label: afterLabel })}
onClick={() => snap(0)}
>
<span className='cf-pg3__side-word'>{afterLabel}</span>
{afterCaption ? <span className='cf-pg3__side-cap'>{afterCaption}</span> : null}
</button>
) : null}
{count > 1 ? (
<ul className='cf-pg3__strip' aria-label={copy.stripLabel}>
{Array.from({ length: count }, (_, i) => {
const isCmp = hasCompare && i === 0
const s = isCmp ? null : shots[i - offset]
return (
<li key={i} className='cf-pg3__tile'>
<button
type='button'
className={`cf-pg3__thumb${i === previewThumb ? ' is-hover' : ''}`}
aria-pressed={i === active}
onClick={() => select(i)}
>
<span className='cf-pg3__thumb-frame'>
{isCmp ? (
<>
<img src={beforeImage} alt='' draggable={false} style={{ objectPosition: imagePosition }} />
<img className='cf-pg3__thumb-after' src={afterImage} alt='' draggable={false} style={{ objectPosition: imagePosition }} />
<span className='cf-pg3__thumb-split' aria-hidden='true' />
</>
) : s ? (
<img src={s.src} alt='' draggable={false} />
) : null}
</span>
<span className='cf-pg3__thumb-label'>{labelOf(i)}</span>
</button>
</li>
)
})}
</ul>
) : null}
{note ? (
<p className='cf-pg3__note'>
<Info className='cf-pg3__ic' size={16} strokeWidth={2.5} aria-hidden='true' />
{note}
</p>
) : null}
</div>
</div>
</div>
</div>
<div className={`cf-pg3__stop cf-pg3__stop--act${reached ? ' is-lit' : ''}`} style={{ '--i': 2 } as React.CSSProperties}>
<div className='cf-pg3__rail' aria-hidden='true'>
<span className='cf-pg3__num'>03</span>
</div>
<div className='cf-pg3__body'>
<h3 className='cf-pg3__h3'>{actionHeading}</h3>
<div className={`cf-pg3__close${price ? '' : ' is-solo'}`}>
{price ? (
<p className='cf-pg3__invest'>
<span className='cf-pg3__invest-label'>{investmentLabel}</span>{' '}
<strong className='cf-pg3__price'>{price}</strong>{' '}
{offerLine ? <span className='cf-pg3__invest-line'>{offerLine}</span> : null}
</p>
) : null}
<div className='cf-pg3__act'>
{action}
{reassurance ? (
<p className='cf-pg3__reassure'>
<ShieldCheck className='cf-pg3__ic cf-pg3__ic--ok' size={16} strokeWidth={2.5} aria-hidden='true' />
{reassurance}
</p>
) : null}
</div>
</div>
</div>
</div>
<p className='cf-pg3__sr' aria-live='polite'>
{fmt(copy.viewing, { label: labelOf(active) })}
</p>
</div>
</section>
)
}
export default ProductGallery3
type Gesture = { id: number; x: number; y: number; engaged: boolean }
const clampPct = (n: number) => Math.min(100, Math.max(0, Number.isFinite(n) ? n : 50))
const fmt = (t: string, vars: Record<string, string | number>) =>
Object.entries(vars).reduce((s, [k, v]) => s.split('{' + k + '}').join(String(v)), t)
const CSS = `
.cf-pg3{--g:clamp(16px,5vw,48px);--rail-w:56px;--rail-gap:20px;--pg3-sh:var(--shadow,oklch(0.22 0.03 260));position:relative;overflow-x:clip;background:var(--surface);color:var(--ink);font-family:var(--font-body);padding:clamp(56px,8vw,112px) var(--g) clamp(64px,8.5vw,120px)}
.cf-pg3 *,.cf-pg3 *::before,.cf-pg3 *::after{box-sizing:border-box}
.cf-pg3 :where(h2,h3,p,ul,li){margin:0}
.cf-pg3__wrap{position:relative;z-index:1;max-width:1120px;margin-inline:auto}
.cf-pg3__stop{display:grid;grid-template-columns:var(--rail-w) minmax(0,1fr);column-gap:var(--rail-gap)}
.cf-pg3__rail{position:relative;display:flex;flex-direction:column;align-items:center}
.cf-pg3__num{display:block;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-0.01em;font-variant-numeric:tabular-nums;color:var(--muted)}
.cf-pg3__num--first{margin-top:clamp(4px,0.9vw,13px)}
.cf-pg3__stop.is-lit .cf-pg3__num{color:var(--accent)}
.cf-pg3__line{position:relative;flex:1;width:3px;min-height:24px;margin:12px 0;border-radius:999px;background:oklch(from var(--ink) l c h / 0.14);overflow:hidden}
.cf-pg3__line>i{position:absolute;left:0;right:0;top:0;border-radius:inherit;background:var(--accent-fill,var(--accent))}
.cf-pg3__body{min-width:0;padding-bottom:clamp(40px,5vw,64px)}
.cf-pg3__stop--act .cf-pg3__body{padding-bottom:0}
.cf-pg3__h2{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-pg3__mark{color:inherit;background:linear-gradient(180deg,transparent 0 44%,color-mix(in oklch,var(--marker,#fae37c) 72%,transparent) 44% 94%,transparent 94%);-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:0 0.1em;margin:0 -0.04em;border-radius:0.2em 0.45em 0.3em 0.55em}
.cf-pg3__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-pg3__h3{margin-bottom:16px;font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:-0.01em;text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;text-wrap:balance;color:var(--ink)}
.cf-pg3__viewer{position:relative;z-index:2;background:var(--card);border:1px solid var(--card-border,oklch(from var(--ink) l c h / 0.12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(from var(--pg3-sh) l c h / 0.22),0 12px 24px -8px oklch(from var(--pg3-sh) l c h / 0.32)));padding:clamp(16px,2.2vw,24px)}
.cf-pg3__deck{display:grid;gap:12px;grid-template-columns:minmax(0,1fr) minmax(0,1fr);grid-template-areas:'before after' 'stage stage' 'strip strip' 'note note'}
.cf-pg3__deck.is-plain{grid-template-columns:minmax(0,1fr);grid-template-areas:'stage' 'strip' 'note'}
.cf-pg3__side{grid-area:before;appearance:none;margin:0;font:inherit;cursor:pointer;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;gap:4px;min-height:64px;padding:12px 16px;border:1px solid var(--button-2-border,transparent);border-radius:var(--button-radius,var(--radius,12px));background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink,var(--ink)));box-shadow:var(--button-2-shadow,var(--shadow-sm));text-align:left}
.cf-pg3__side--after{grid-area:after}
.cf-pg3__side-word{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-0.01em}
.cf-pg3__side-cap{font-size:15px;line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
.cf-pg3__side:hover{background:oklch(from var(--button-2-bg,var(--secondary)) calc(l - 0.03) c h)}
.cf-pg3__side:active{transform:translateY(1px);box-shadow:none}
.cf-pg3__side.is-on{background:color-mix(in oklch,var(--accent) 12%,var(--card));border-color:oklch(from var(--accent) l c h / 0.4)}
.cf-pg3__side.is-on .cf-pg3__side-word{color:var(--accent)}
.cf-pg3__side.is-on .cf-pg3__side-cap{color:var(--ink)}
.cf-pg3__side:focus-visible{outline:3px solid oklch(from var(--field-focus,var(--accent)) l c h / 0.6);outline-offset:2px}
.cf-pg3__stage{grid-area:stage;position:relative;aspect-ratio:3/2;border-radius:12px;overflow:hidden;background:color-mix(in oklch,var(--ink) 6%,var(--card));touch-action:pan-y;-webkit-user-select:none;user-select:none;cursor:ew-resize}
.cf-pg3__stage.is-photo{cursor:default;touch-action:auto}
.cf-pg3__img{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:cover;pointer-events:none;-webkit-user-drag:none}
.cf-pg3__img--after{clip-path:inset(0 0 0 var(--pos,50%))}
.cf-pg3__divider{position:absolute;top:0;bottom:0;left:var(--pos,50%);width:0;pointer-events:none}
.cf-pg3__divider::before{content:'';position:absolute;top:0;bottom:0;left:-1.5px;width:3px;background:var(--band-ink);box-shadow:0 0 0 1px oklch(from var(--pg3-sh) l c h / 0.3),0 2px 6px -1px oklch(from var(--pg3-sh) l c h / 0.4)}
.cf-pg3__handle{position:absolute;top:50%;left:var(--pos,50%);width:56px;height:56px;margin:-28px 0 0 -28px;display:grid;place-items:center;border-radius:999px;background:var(--band);color:var(--band-ink);cursor:grab;outline:none;box-shadow:inset 0 0 0 2px oklch(from var(--band-ink) l c h / 0.9),var(--shadow-md,0 1px 2px oklch(from var(--pg3-sh) l c h / 0.22),0 4px 10px -2px oklch(from var(--pg3-sh) l c h / 0.2))}
.cf-pg3__stage:not(.is-photo):hover .cf-pg3__handle,.cf-pg3__stage.is-hover .cf-pg3__handle{transform:scale(1.06);box-shadow:inset 0 0 0 2px oklch(from var(--band-ink) l c h / 0.9),var(--shadow-lg,0 2px 4px oklch(from var(--pg3-sh) l c h / 0.22),0 12px 24px -8px oklch(from var(--pg3-sh) l c h / 0.32))}
.cf-pg3__stage.is-dragging .cf-pg3__handle{transform:scale(0.94);cursor:grabbing}
.cf-pg3__stage.is-dragging{cursor:grabbing}
.cf-pg3__handle:focus-visible{box-shadow:0 0 0 3px var(--band-ink),0 0 0 6px var(--field-focus,var(--accent)),var(--shadow-md,0 1px 2px oklch(from var(--pg3-sh) l c h / 0.22),0 4px 10px -2px oklch(from var(--pg3-sh) l c h / 0.2))}
.cf-pg3__strip{grid-area:strip;display:flex;gap:8px;padding:6px;margin:0 -6px;list-style:none;overflow-x:auto;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch;scrollbar-width:none}
.cf-pg3__strip::-webkit-scrollbar{display:none}
.cf-pg3__tile{flex:0 0 auto;scroll-snap-align:start}
.cf-pg3__thumb{appearance:none;border:0;margin:0;font:inherit;cursor:pointer;display:flex;flex-direction:column;gap:8px;width:128px;padding:6px 6px 8px;border-radius:var(--button-radius,var(--radius,12px));background:transparent;color:var(--ink);text-align:left}
.cf-pg3__thumb-frame{position:relative;display:block;aspect-ratio:4/3;border-radius:8px;overflow:hidden;background:color-mix(in oklch,var(--ink) 6%,var(--card))}
.cf-pg3__thumb-frame img{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:cover}
.cf-pg3__thumb-frame .cf-pg3__thumb-after{clip-path:inset(0 0 0 50%)}
.cf-pg3__thumb-split{position:absolute;top:0;bottom:0;left:50%;width:2px;margin-left:-1px;background:var(--band-ink)}
.cf-pg3__thumb-label{padding-inline:2px;font-size:14px;line-height:1.2;font-weight:800;text-wrap:balance}
.cf-pg3__thumb:hover,.cf-pg3__thumb.is-hover{background:color-mix(in oklch,var(--button-2-bg,var(--secondary)) 70%,var(--card))}
.cf-pg3__thumb:hover .cf-pg3__thumb-frame,.cf-pg3__thumb.is-hover .cf-pg3__thumb-frame{transform:translateY(-2px)}
.cf-pg3__thumb[aria-pressed='true']{background:color-mix(in oklch,var(--accent) 12%,var(--card))}
.cf-pg3__thumb[aria-pressed='true'] .cf-pg3__thumb-label{color:var(--ink)}
.cf-pg3__thumb[aria-pressed='true'] .cf-pg3__thumb-frame{outline:2px solid var(--accent);outline-offset:2px;transform:none}
.cf-pg3__thumb:focus-visible{outline:3px solid oklch(from var(--field-focus,var(--accent)) l c h / 0.6);outline-offset:1px}
.cf-pg3__note{grid-area:note;font-size:15px;line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
.cf-pg3__ic{display:inline-block;vertical-align:-0.15em;margin-inline-end:0.4em}
.cf-pg3__ic--ok{color:var(--success)}
.cf-pg3__close{display:grid;gap:24px;padding:clamp(20px,3vw,32px);border:1px solid oklch(from var(--ink) l c h / 0.08);border-radius:var(--card-radius,var(--radius,14px));background:color-mix(in oklch,var(--ink) 4%,var(--surface))}
.cf-pg3__close.is-solo{grid-template-columns:auto;justify-content:start}
.cf-pg3__invest{display:grid;grid-template-columns:auto minmax(0,1fr);grid-template-areas:'price label' 'price line';column-gap:16px;row-gap:4px;align-items:center;max-width:56ch;color:var(--ink)}
.cf-pg3__invest-label{grid-area:label;align-self:end;font-size:14px;line-height:1.2;font-weight:800;letter-spacing:0.08em;text-transform:uppercase;color:var(--muted)}
.cf-pg3__price{grid-area:price;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums;color:var(--ink)}
.cf-pg3__invest-line{grid-area:line;align-self:start;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.4;font-weight:500;color:var(--ink);text-wrap:pretty}
.cf-pg3__act{display:flex;flex-direction:column;align-items:center;gap:12px}
.cf-pg3__cta{--pg3-b1:var(--button-bg,var(--cta));--pg3-b2:var(--button-bg-2,var(--cta-2));display:inline-flex;align-items:center;justify-content:center;min-height:72px;padding:0 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.55vw,1.375rem);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);cursor:pointer;background:linear-gradient(oklch(from var(--pg3-b1) calc(l + 0.04) c h),oklch(from var(--pg3-b2) calc(l - 0.02) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--pg3-b1) calc(l + 0.14) c h / 0.7),inset 0 -3px 0 oklch(from var(--pg3-b1) calc(l - 0.16) c h),0 1px 2px oklch(from var(--pg3-sh) l c h / 0.3),0 8px 16px -6px oklch(from var(--pg3-sh) l c h / 0.4))}
.cf-pg3__cta:hover{background:linear-gradient(oklch(from var(--pg3-b1) calc(l - 0.01) c h),oklch(from var(--pg3-b2) calc(l - 0.07) c h));box-shadow:inset 0 1px 0 oklch(from var(--pg3-b1) calc(l + 0.1) c h / 0.7),inset 0 -3px 0 oklch(from var(--pg3-b1) calc(l - 0.2) c h),0 1px 2px oklch(from var(--pg3-sh) l c h / 0.32),0 10px 18px -6px oklch(from var(--pg3-sh) l c h / 0.48)}
.cf-pg3__cta:active{transform:translateY(1px);box-shadow:inset 0 2px 3px oklch(from var(--pg3-b1) calc(l - 0.22) c h / 0.55),inset 0 -2px 0 oklch(from var(--pg3-b1) calc(l - 0.16) c h),0 1px 2px oklch(from var(--pg3-sh) l c h / 0.3)}
.cf-pg3__cta:focus-visible{outline:3px solid oklch(from var(--field-focus,var(--accent)) l c h / 0.6);outline-offset:3px}
.cf-pg3__cta:disabled{cursor:not-allowed;transform:none;background:var(--secondary,oklch(0.93 0.015 263));color:var(--secondary-ink,var(--ink));text-shadow:none;box-shadow:none}
.cf-pg3__reassure{font-size:15px;line-height:1.4;font-weight:600;color:var(--muted);text-align:center;text-wrap:pretty}
.cf-pg3__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:1000px){
.cf-pg3__deck{grid-template-columns:152px minmax(0,1fr) 152px;grid-template-areas:'before stage after' '. strip .' '. note .';column-gap:16px;row-gap:16px}
.cf-pg3__side{align-self:center;padding:16px}
}
@media (min-width:900px){
.cf-pg3__close{grid-template-columns:minmax(0,1fr) auto;align-items:center;column-gap:clamp(24px,4vw,48px)}
}
@media (max-width:640px){
.cf-pg3{--rail-w:36px;--rail-gap:12px}
.cf-pg3__viewer{margin-left:calc(-1 * (var(--rail-w) + var(--rail-gap) + var(--g)));margin-right:calc(-1 * var(--g));border-radius:0;border-left:0;border-right:0;padding:12px}
.cf-pg3__stage{aspect-ratio:5/4}
.cf-pg3__handle{width:48px;height:48px;margin:-24px 0 0 -24px}
.cf-pg3__thumb{width:112px}
.cf-pg3__close{margin-left:calc(-1 * (var(--rail-w) + var(--rail-gap)));padding:16px;gap:20px}
.cf-pg3__close.is-solo{grid-template-columns:minmax(0,1fr);justify-content:stretch}
.cf-pg3__act{align-items:stretch}
.cf-pg3__cta{width:100%;min-height:64px;padding:0 20px}
}
@keyframes cf-pg3-rise{from{opacity:0.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes cf-pg3-pop{from{transform:scale(0.9)}to{transform:none}}
@keyframes cf-pg3-fade{from{opacity:0.82}to{opacity:1}}
@media (prefers-reduced-motion:no-preference){
.cf-pg3__stop{animation:cf-pg3-rise 0.45s cubic-bezier(0.2,0.7,0.2,1) both;animation-delay:calc(var(--i,0) * 0.07s)}
.cf-pg3__stop--act.is-lit .cf-pg3__num{animation:cf-pg3-pop 0.3s cubic-bezier(0.2,0.7,0.2,1) both}
.cf-pg3__num{transition:color 0.16s ease}
.cf-pg3__line>i{transition:height 0.28s cubic-bezier(0.2,0.7,0.2,1)}
.cf-pg3__img--single{animation:cf-pg3-fade 0.3s ease both}
.cf-pg3__stage:not(.is-dragging) .cf-pg3__img--after{transition:clip-path 0.28s cubic-bezier(0.2,0.7,0.2,1)}
.cf-pg3__stage:not(.is-dragging) .cf-pg3__divider{transition:left 0.28s cubic-bezier(0.2,0.7,0.2,1)}
.cf-pg3__handle{transition:left 0.28s cubic-bezier(0.2,0.7,0.2,1),transform 0.16s ease,box-shadow 0.16s ease}
.cf-pg3__stage.is-dragging .cf-pg3__handle{transition:transform 0.16s ease,box-shadow 0.16s ease}
.cf-pg3__side,.cf-pg3__thumb,.cf-pg3__cta{transition:background 0.16s ease,transform 0.16s ease,box-shadow 0.16s ease}
.cf-pg3__thumb-frame{transition:transform 0.16s ease}
}
@media (prefers-reduced-motion:reduce){
.cf-pg3 *,.cf-pg3 *::before,.cf-pg3 *::after{animation:none !important;transition:none !important}
}
`
pieces/offer/product-gallery-3/specimen.tsx 43 lines
import __studioImage20ee30a3 from "../assets/b62ed229049d409b.webp";
import __studioImage3dcd49b3 from "../assets/7babd56bd8fe9ba0.webp";
import __studioImage2ae9c64c from "../assets/12b131e3c635437e.webp";
// Specimen: the Brightline stain bar before/after gallery, with illustrative generated photos.
import * as React from 'react'
import { ProductGallery3 } from '../product-gallery-3'
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
export const states = ['default', 'hover', 'active', 'disabled']
type SpecimenState = 'default' | 'hover' | 'active' | 'disabled'
export default function ProductGallery3Specimen({ state = 'default' }: { state?: SpecimenState }) {
const before = slot('before', __studioImage20ee30a3)
const after = slot('after', __studioImage3dcd49b3)
const product = slot('product', __studioImage2ae9c64c)
return (
<ProductGallery3
state={state}
headline='Don’t take our word for it. Drag the line.'
highlight='Drag the line.'
lead='On the left, a coffee-stained cuff. On the right, the same cuff scrubbed with the Brightline stain bar. Slide across and look for yourself.'
compareHeading='Drag the line across the cuff'
photoHeading='Take a closer look at the bar'
actionHeading='Keep a bar by the laundry basket'
beforeImage={before}
afterImage={after}
beforeAlt='White shirt cuff with a brown coffee stain'
afterAlt='The same white shirt cuff, clean'
beforeCaption='Coffee on a white cuff'
afterCaption='The same cuff, scrubbed'
shots={[{ src: product, alt: 'Brightline stain bar, half unwrapped, beside a folded white shirt', label: 'The bar' }]}
note='Illustrative photos, generated for this page.'
price='$12'
offerLine='for one Brightline stain bar, sent to your door.'
actionLabel='Send me a Brightline bar'
reassurance={defaults.sample.guarantee}
onAction={() => {}}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalProductGallery3 |
React.ReactNode |
Default 'Don’t take our word for it. Drag the line.'
|
highlight OptionalProductGallery3 |
string |
Default 'Drag the line.'
|
lead OptionalProductGallery3 |
React.ReactNode |
Default 'Two photos of the same thing, side by side. Slide across to compare them, then decide.'
|
compareHeading OptionalProductGallery3 |
string |
Default 'Drag the line across the photo'
|
photoHeading OptionalProductGallery3 |
string |
Default 'Take a closer look'
|
actionHeading OptionalProductGallery3 |
string |
Default 'Get yours on the way'
|
beforeImage OptionalProductGallery3 |
string |
|
afterImage OptionalProductGallery3 |
string |
|
beforeAlt OptionalProductGallery3 |
string |
Default 'Before'
|
afterAlt OptionalProductGallery3 |
string |
Default 'After'
|
beforeLabel OptionalProductGallery3 |
string |
Default 'Before'
|
afterLabel OptionalProductGallery3 |
string |
Default 'After'
|
beforeCaption OptionalProductGallery3 |
string |
Default ''
|
afterCaption OptionalProductGallery3 |
string |
Default ''
|
imagePosition OptionalProductGallery3 |
string |
Default '50% 50%'
|
compareThumbLabel OptionalProductGallery3 |
string |
Default 'Before & after'
|
shots OptionalProductGallery3 |
GalleryShot[] |
Default []
|
note OptionalProductGallery3 |
string |
Default ''
|
investmentLabel OptionalProductGallery3 |
string |
Default 'Your investment:'
|
price OptionalProductGallery3 |
string |
Default ''
|
offerLine OptionalProductGallery3 |
string |
Default ''
|
actionLabel OptionalProductGallery3 |
string |
Default 'Send me mine'
|
reassurance OptionalProductGallery3 |
string |
Default ''
|
href OptionalProductGallery3 |
string |
|
onAction OptionalProductGallery3 |
() => void |
|
disabled OptionalProductGallery3 |
boolean |
Default false
|
initialPosition OptionalProductGallery3 |
number |
Default 50
|
state OptionalProductGallery3 |
ProductGallery3State |
Default 'default'
|
copy OptionalProductGallery3 |
Partial<ProductGallery3Copy> |
|
onSelect OptionalProductGallery3 |
(index: number) => void |
|
className OptionalProductGallery3 |
string |
Default ''
|
style OptionalProductGallery3 |
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-border--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.
after- An image this piece places.
before- An image this piece places.
product- The main product shot or cover (ebook, kit, bottle).
-
12b131e3c635437e.webp
image/webp · 49.9 KB
-
7babd56bd8fe9ba0.webp
image/webp · 207 KB
-
b62ed229049d409b.webp
image/webp · 114 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB