Before After 4
Job-site gallery: a bento of real jobs where every photo crossfades back to the day the crew arrived, filtered by service and closed by the free-estimate action.
Use it in a prompt
Use proof/before-after-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/proof/before-after-4.tsx. - Import it and pass your copy and images (Props tab):
import { BeforeAfter4 } from "@/components/funneldna/proof/before-after-4"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/proof/before-after-4/component.tsx 477 lines
// layout: before-after-split
// Job-site gallery: a bento of real jobs where every photo crossfades back to the day the crew arrived, filtered by service and closed by the free-estimate action.
'use client'
import * as React from 'react'
import { AnimatePresence, MotionConfig, motion } from 'motion/react'
import { Eye, ImageOff, MapPin } from 'lucide-react'
import { Spot } from '../fx/fx'
import checklist from '../fx/spots/checklist'
export type BeforeAfter4Job = {
/** Stable key; falls back to service + title. */
id?: string
/** Service the job belongs to, matched against the filter (e.g. 'Kitchens'). */
service: string
/** Job type shown under the photo, e.g. 'Full kitchen remodel'. */
title: string
/** Town or neighbourhood of the job. */
town: string
/** One short line, shown under the dominant tile only. */
detail?: string
/** Photo of the finished job. */
afterImage?: string
/** Photo of the same space before the work. */
beforeImage?: string
/** A single side-by-side composite instead of two photos: left half before, right half after, split at the centre (a thin band either side of the seam is cropped away). */
pairImage?: string
beforeAlt?: string
afterAlt?: string
/** CSS object-position for separate before/after photos (composites always stay centred). */
focus?: string
/** Makes this job the dominant tile while it is in view. */
featured?: boolean
}
export type BeforeAfter4Copy = {
all: string
filterLabel: string
showBefore: string
showAfter: string
beforeLabel: string
afterLabel: string
/** Placeholders: {title}, {town}. */
beforeAlt: string
afterAlt: string
statusBefore: string
statusAfter: string
showingOne: string
/** Placeholder: {count}. */
showingMany: string
/** Placeholder: {service}. */
emptyTitle: string
emptyBody: string
emptyReset: string
}
export type BeforeAfter4Props = {
headline?: string
/** The phrase inside the headline swiped with the marker. */
highlight?: string
lead?: string
jobs?: BeforeAfter4Job[]
/** Filter order; defaults to the services found in jobs. A service with no jobs shows the empty message. */
services?: string[]
estimateTitle?: string
estimateBody?: string
estimateLabel?: string
/** One quiet line under the estimate button. */
secondaryLabel?: string
secondaryHref?: string
/** Illustration beside the estimate copy: an imported fx spot asset. */
estimateSpot?: string
href?: string
onAction?: (event: React.MouseEvent<HTMLElement>) => void
disabled?: boolean
/** active: the dominant tile starts on its before photo. */
state?: 'default' | 'hover' | 'active' | 'disabled'
copy?: Partial<BeforeAfter4Copy>
className?: string
}
export function BeforeAfter4({
headline = 'See the work before you book your estimate',
highlight = 'before you book',
lead = 'Pick a room, tap Show before on any job, and see what the space looked like when the crew arrived.',
jobs = [],
services,
estimateTitle = 'Your room could be the next photo here',
estimateBody = 'Tell us about your project and get a written price for it.',
estimateLabel = 'Get My Free Estimate',
secondaryLabel = 'or flip a few more photos first',
secondaryHref,
estimateSpot = checklist,
href,
onAction,
disabled = false,
state = 'default',
copy,
className,
}: BeforeAfter4Props) {
const t: BeforeAfter4Copy = { ...DEFAULT_COPY, ...copy }
const headingId = React.useId()
const filtersRef = React.useRef<HTMLDivElement>(null)
const [service, setService] = React.useState<string | null>(null)
const [flipped, setFlipped] = React.useState<Record<string, boolean>>({})
const isDisabled = disabled || state === 'disabled'
const filters = services && services.length > 0 ? services : uniqueServices(jobs)
const keyed = jobs.map((job, index) => ({ job, key: job.id ?? job.service + '-' + job.title + '-' + index }))
const inView = service === null ? keyed : keyed.filter((entry) => entry.job.service === service)
const featured = Math.max(inView.findIndex((entry) => entry.job.featured), 0)
const ordered = inView.length > 0 ? [inView[featured], ...inView.filter((_, index) => index !== featured)] : []
// Spans that keep the bento a clean rectangle: the estimate tile fills whatever the jobs leave.
const rest = Math.max(ordered.length - 1, 0)
let lg = 1
let lgRows = 1
let md = 2
if (jobs.length === 0) lg = 3
else if (ordered.length > 0) {
if (rest === 0) lgRows = 2
else if (rest >= 2) lg = 3 - ((rest - 2) % 3)
md = rest % 2 === 1 ? 1 : 2
}
const gridStyle = { '--ba4-lg': String(lg), '--ba4-lgr': String(lgRows), '--ba4-md': String(md) } as React.CSSProperties
const showing = jobs.length > 0 ? fill(ordered.length === 1 ? t.showingOne : t.showingMany, { count: String(ordered.length) }) : ''
const handleAction = (event: React.MouseEvent<HTMLElement>) => {
if (isDisabled) {
event.preventDefault()
return
}
onAction?.(event)
}
const resetFilter = () => {
setService(null)
filtersRef.current?.querySelector('button')?.focus()
}
return (
<section className={['cf-before-after-4', className].filter(Boolean).join(' ')} data-state={state} aria-labelledby={headingId}>
<style>{CSS}</style>
<div className='ba4-wrap'>
<div className='ba4-head'>
<h2 id={headingId} className='ba4-h2'>{marked(headline, highlight)}</h2>
{lead ? <p className='ba4-lead'>{lead}</p> : null}
</div>
{jobs.length > 0 && filters.length > 0 ? (
<div ref={filtersRef} className='ba4-filters' role='group' aria-label={t.filterLabel}>
<Chip label={t.all} count={jobs.length} selected={service === null} onSelect={() => setService(null)} />
{filters.map((name) => (
<Chip
key={name}
label={name}
count={jobs.filter((job) => job.service === name).length}
selected={service === name}
onSelect={() => setService(name)}
/>
))}
</div>
) : null}
<p className='ba4-sr' aria-live='polite'>{showing}</p>
<MotionConfig reducedMotion='user'>
<ul className='ba4-grid' style={gridStyle}>
<AnimatePresence initial={false} mode='popLayout'>
{ordered.map(({ job, key }, index) => {
const isLead = index === 0
const before = flipped[key] ?? (state === 'active' && isLead)
return (
<motion.li key={key} layout='position' className={isLead ? 'ba4-tile ba4-tile--lead' : 'ba4-tile'} {...RISE}>
<JobTile
job={job}
lead={isLead}
before={before}
copy={t}
onToggle={() => setFlipped((prev) => ({ ...prev, [key]: !before }))}
/>
</motion.li>
)
})}
{jobs.length > 0 && ordered.length === 0 ? (
<motion.li key='ba4-empty' layout='position' className='ba4-empty' {...RISE}>
<span className='ba4-empty-icon' aria-hidden='true'>
<ImageOff size={20} strokeWidth={2.5} />
</span>
<h3 className='ba4-title'>{fill(t.emptyTitle, { service: service ?? '' })}</h3>
<p className='ba4-empty-body'>{t.emptyBody}</p>
<button type='button' className='ba4-secondary' onClick={resetFilter}>
{t.emptyReset}
</button>
</motion.li>
) : null}
<motion.li key='ba4-estimate' layout='position' className='ba4-est' {...RISE}>
<div className='ba4-est-in'>
{estimateSpot ? (
<div className='ba4-est-spot'>
<Spot src={estimateSpot} size={72} shade='band' light='band-ink' />
</div>
) : null}
<div className='ba4-est-copy'>
<h3 className='ba4-est-title'>{estimateTitle}</h3>
{estimateBody ? <p className='ba4-est-body'>{estimateBody}</p> : null}
</div>
<div className='ba4-est-act'>
{href ? (
<a className='ba4-cta' href={isDisabled ? undefined : href} aria-disabled={isDisabled || undefined} onClick={handleAction}>
{estimateLabel}
</a>
) : (
<button type='button' className='ba4-cta' disabled={isDisabled} onClick={handleAction}>
{estimateLabel}
</button>
)}
{secondaryLabel ? (
<p className='ba4-alt'>{secondaryHref ? <a href={secondaryHref}>{secondaryLabel}</a> : secondaryLabel}</p>
) : null}
</div>
</div>
</motion.li>
</AnimatePresence>
</ul>
</MotionConfig>
</div>
</section>
)
}
export default BeforeAfter4
function JobTile({
job,
lead,
before,
copy,
onToggle,
}: {
job: BeforeAfter4Job
lead: boolean
before: boolean
copy: BeforeAfter4Copy
onToggle: () => void
}) {
const beforeSrc = job.beforeImage ?? job.pairImage
const afterSrc = job.afterImage ?? job.pairImage
const canFlip = Boolean(beforeSrc && afterSrc)
const showBefore = canFlip && before
const vars = { title: job.title, town: job.town }
return (
<>
<div className='ba4-frame' data-before={showBefore ? 'true' : 'false'}>
{canFlip ? (
<Layer
side='before'
src={beforeSrc}
pair={!job.beforeImage}
alt={job.beforeAlt ?? fill(copy.beforeAlt, vars)}
hidden={!showBefore}
focus={job.focus}
eager={lead}
/>
) : null}
<Layer
side='after'
src={afterSrc}
pair={!job.afterImage}
alt={job.afterAlt ?? fill(copy.afterAlt, vars)}
hidden={showBefore}
focus={job.focus}
eager={lead}
/>
{afterSrc ? (
<span key={showBefore ? 'before' : 'after'} className='ba4-stage' data-side={showBefore ? 'before' : 'after'} aria-hidden='true'>
{showBefore ? copy.beforeLabel : copy.afterLabel}
</span>
) : null}
{canFlip ? (
<button type='button' className='ba4-toggle' data-pressed={showBefore ? 'true' : 'false'} onClick={onToggle}>
<Eye size={18} strokeWidth={2.5} aria-hidden='true' />
<span>{showBefore ? copy.showAfter : copy.showBefore}</span>
</button>
) : null}
{canFlip ? (
<span className='ba4-sr' aria-live='polite'>
{fill(showBefore ? copy.statusBefore : copy.statusAfter, vars)}
</span>
) : null}
</div>
<div className='ba4-cap'>
<h3 className='ba4-title'>{job.title}</h3>
<p className='ba4-meta'>
<MapPin size={16} strokeWidth={2.5} aria-hidden='true' />
{job.town}
<span aria-hidden='true'> · </span>
{job.service}
</p>
{lead && job.detail ? <p className='ba4-detail'>{job.detail}</p> : null}
</div>
</>
)
}
function Layer({
side,
src,
pair,
alt,
hidden,
focus,
eager,
}: {
side: 'before' | 'after'
src?: string
pair: boolean
alt: string
hidden: boolean
focus?: string
eager: boolean
}) {
if (!src) return null
return (
<div className={'ba4-layer ba4-layer--' + side} aria-hidden={hidden ? true : undefined}>
<div className={pair ? 'ba4-sprite ba4-sprite--' + side : 'ba4-fill'}>
<img
src={src}
alt={hidden ? '' : alt}
loading={eager ? 'eager' : 'lazy'}
decoding='async'
style={!pair && focus ? { objectPosition: focus } : undefined}
/>
</div>
</div>
)
}
function Chip({ label, count, selected, onSelect }: { label: string; count: number; selected: boolean; onSelect: () => void }) {
return (
<button type='button' className='ba4-chip' aria-pressed={selected} onClick={onSelect}>
<span>{label}</span>
<span className='ba4-count'>{count}</span>
</button>
)
}
function uniqueServices(jobs: BeforeAfter4Job[]) {
const seen: string[] = []
jobs.forEach((job) => {
if (!seen.includes(job.service)) seen.push(job.service)
})
return seen
}
function fill(template: string, vars: Record<string, string>) {
return Object.keys(vars).reduce((out, key) => out.split('{' + key + '}').join(vars[key]), template)
}
function marked(text: string, phrase?: string) {
if (!phrase) return text
const at = text.indexOf(phrase)
if (at < 0) return text
return (
<>
{text.slice(0, at)}
<span className='ba4-mark'>{phrase}</span>
{text.slice(at + phrase.length)}
</>
)
}
const DEFAULT_COPY: BeforeAfter4Copy = {
all: 'All jobs',
filterLabel: 'Filter jobs by service',
showBefore: 'Show before',
showAfter: 'Show after',
beforeLabel: 'Before',
afterLabel: 'After',
beforeAlt: '{title} in {town}, before the work',
afterAlt: '{title} in {town}, finished',
statusBefore: 'Showing the before photo: {title}',
statusAfter: 'Showing the after photo: {title}',
showingOne: 'Showing 1 job',
showingMany: 'Showing {count} jobs',
emptyTitle: 'No {service} photos here yet',
emptyBody: 'Ask us about yours when you book your estimate.',
emptyReset: 'See all jobs',
}
const RISE = {
initial: { opacity: 0.82, y: 8 },
animate: { opacity: 1, y: 0 },
exit: { opacity: 0, scale: 0.98 },
transition: { duration: 0.45, ease: [0.2, 0.7, 0.2, 1] },
} as const
const CSS = `
.cf-before-after-4{--ba4-gutter:clamp(16px,5vw,48px);--ba4-marker:var(--marker,#fae37c);--ba4-ease:cubic-bezier(.2,.7,.2,1);--ba4-shadow:var(--shadow,oklch(0.22 0.03 260));--ba4-ring:var(--field-focus,var(--accent,#2563eb));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) var(--ba4-gutter) clamp(64px,8.5vw,120px)}
.cf-before-after-4 *,.cf-before-after-4 *::before,.cf-before-after-4 *::after{box-sizing:border-box}
.cf-before-after-4 .ba4-wrap{max-width:1120px;margin:0 auto}
.cf-before-after-4 .ba4-head{max-width:46rem}
.cf-before-after-4 .ba4-h2{margin:0;font-family:var(--font-display,system-ui,sans-serif);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;color:var(--ink,#101828);text-wrap:balance}
.cf-before-after-4 .ba4-mark{--ba4-swipe:oklch(from var(--ba4-marker) l c h / 1);color:inherit;color:oklch(from var(--ba4-marker) clamp(0.18, (0.62 - l) * 1000, 0.98) 0.02 h);background:linear-gradient(to bottom,transparent 8%,var(--ba4-marker) 8%,var(--ba4-marker) 94%,transparent 94%);background:linear-gradient(to bottom,transparent 8%,var(--ba4-swipe) 8%,var(--ba4-swipe) 94%,transparent 94%);-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:0 .12em;border-radius:.2em .5em .3em .45em}
.cf-before-after-4 .ba4-lead{margin:16px 0 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-before-after-4 .ba4-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.cf-before-after-4 .ba4-filters{display:flex;gap:8px;margin:32px 0 0;padding:4px 0;overflow-x:auto;scroll-snap-type:x proximity;scrollbar-width:none;-webkit-overflow-scrolling:touch}
.cf-before-after-4 .ba4-filters::-webkit-scrollbar{display:none}
.cf-before-after-4 .ba4-chip{flex:0 0 auto;scroll-snap-align:start;display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 8px 0 16px;border:1px solid transparent;border-radius:999px;background:color-mix(in oklch,var(--ink,#101828) 6%,var(--surface,#fff));color:var(--ink,#101828);font-family:var(--font-body,system-ui,sans-serif);font-size:15px;font-weight:700;line-height:1.2;white-space:nowrap;cursor:pointer;transition:background .16s ease,border-color .16s ease,transform .16s ease}
.cf-before-after-4 .ba4-chip:hover{background:color-mix(in oklch,var(--ink,#101828) 11%,var(--surface,#fff))}
.cf-before-after-4 .ba4-chip:active{transform:translateY(1px)}
.cf-before-after-4 .ba4-chip:focus-visible{outline:none;box-shadow:0 0 0 2px var(--surface,#fff),0 0 0 5px var(--ba4-ring)}
.cf-before-after-4 .ba4-chip[aria-pressed='true']{background:color-mix(in oklch,var(--accent,#2563eb) 12%,var(--surface,#fff));border-color:oklch(from var(--accent,#2563eb) l c h / 0.55)}
.cf-before-after-4 .ba4-count{display:inline-flex;align-items:center;justify-content:center;height:28px;padding:0 12px;border-radius:999px;background:color-mix(in oklch,var(--ink,#101828) 10%,var(--surface,#fff));color:var(--ink,#101828);font-size:14px;font-weight:800;font-variant-numeric:tabular-nums}
.cf-before-after-4 .ba4-chip[aria-pressed='true'] .ba4-count{background:var(--accent-fill,var(--accent,#2563eb));color:var(--accent-fill-ink,var(--card,#fff))}
.cf-before-after-4 .ba4-grid{position:relative;list-style:none;margin:24px 0 0;padding:0;display:grid;grid-template-columns:minmax(0,1fr);gap:32px 24px}
.cf-before-after-4 .ba4-tile{display:flex;flex-direction:column;gap:16px;min-width:0}
.cf-before-after-4 .ba4-frame{position:relative;overflow:hidden;isolation:isolate;aspect-ratio:1/1;border-radius:12px;background:color-mix(in oklch,var(--ink,#101828) 6%,var(--surface,#fff))}
.cf-before-after-4 .ba4-tile--lead .ba4-frame{aspect-ratio:4/5}
.cf-before-after-4 .ba4-layer{position:absolute;inset:0;overflow:hidden;transition:opacity .5s var(--ba4-ease),transform .8s var(--ba4-ease)}
.cf-before-after-4 .ba4-layer--after{z-index:1}
.cf-before-after-4 .ba4-frame[data-before='true'] .ba4-layer--after{opacity:0;transform:scale(1.03)}
.cf-before-after-4 .ba4-frame[data-before='false'] .ba4-layer--before{transform:scale(1.03)}
.cf-before-after-4 .ba4-fill{position:absolute;inset:0}
.cf-before-after-4 .ba4-sprite{position:absolute;top:0;bottom:0;width:214%}
.cf-before-after-4 .ba4-sprite--before{left:-2%}
.cf-before-after-4 .ba4-sprite--after{left:-112%}
.cf-before-after-4 .ba4-layer img{display:block;width:100%;height:100%;object-fit:cover}
.cf-before-after-4 .ba4-stage{position:absolute;top:16px;left:16px;z-index:2;display:inline-flex;align-items:center;min-height:32px;padding:4px 12px;border-radius:999px;font-family:var(--font-body,system-ui,sans-serif);font-size:14px;font-weight:800;line-height:1.2;letter-spacing:.02em;box-shadow:var(--shadow-sm,0 1px 1px oklch(0.22 0.03 260 / 0.18),0 1px 3px oklch(0.22 0.03 260 / 0.14));animation:ba4-pop .3s var(--ba4-ease) both}
.cf-before-after-4 .ba4-stage[data-side='after']{background:var(--accent-fill,var(--accent,#2563eb));color:var(--accent-fill-ink,var(--card,#fff))}
.cf-before-after-4 .ba4-stage[data-side='before']{background:var(--card,#fff);color:var(--ink,#101828)}
@keyframes ba4-pop{from{transform:scale(.9)}to{transform:scale(1)}}
.cf-before-after-4 .ba4-toggle{position:absolute;left:16px;bottom:16px;z-index:2;display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;padding:0 16px 0 14px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:var(--card,#fff);color:var(--ink,#101828);font-family:var(--font-body,system-ui,sans-serif);font-size:15px;font-weight:800;line-height:1.2;white-space:nowrap;cursor:pointer;box-shadow:var(--shadow-md,0 1px 2px oklch(0.22 0.03 260 / 0.22),0 4px 10px -2px oklch(0.22 0.03 260 / 0.2));transition:background .16s ease,color .16s ease,transform .16s ease}
.cf-before-after-4 .ba4-toggle:hover{background:color-mix(in oklch,var(--ink,#101828) 8%,var(--card,#fff))}
.cf-before-after-4 .ba4-toggle[data-pressed='true']{background:var(--band,#1e293b);color:var(--band-ink,#fff)}
.cf-before-after-4 .ba4-toggle[data-pressed='true']:hover{background:color-mix(in oklch,var(--band-ink,#fff) 12%,var(--band,#1e293b))}
.cf-before-after-4 .ba4-toggle:active{transform:translateY(1px) scale(.98)}
.cf-before-after-4 .ba4-toggle:focus-visible{outline:none;box-shadow:0 0 0 2px var(--card,#fff),0 0 0 5px var(--ba4-ring),var(--shadow-md,0 1px 2px oklch(0.22 0.03 260 / 0.22))}
.cf-before-after-4 .ba4-cap{display:grid;gap:4px}
.cf-before-after-4 .ba4-title{margin:0;font-family:var(--font-display,system-ui,sans-serif);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;color:var(--ink,#101828);text-wrap:balance}
.cf-before-after-4 .ba4-meta{margin:0;font-size:15px;line-height:1.4;font-weight:600;color:var(--muted,#475467);text-wrap:pretty}
.cf-before-after-4 .ba4-meta svg{display:inline-block;vertical-align:-0.15em;margin-inline-end:.4em}
.cf-before-after-4 .ba4-detail{margin:4px 0 0;max-width:64ch;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;color:var(--ink,#101828);text-wrap:pretty}
.cf-before-after-4 .ba4-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;min-height:320px;padding:clamp(32px,5vw,56px) clamp(20px,3vw,32px);border-radius:var(--card-radius,var(--radius,14px));background:color-mix(in oklch,var(--ink,#101828) 4%,var(--surface,#fff));text-align:center}
.cf-before-after-4 .ba4-empty-icon{display:inline-flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:999px;background:color-mix(in oklch,var(--ink,#101828) 9%,var(--surface,#fff));color:var(--muted,#475467)}
.cf-before-after-4 .ba4-empty-body{margin:0;max-width:44ch;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;color:var(--muted,#475467);text-wrap:pretty}
.cf-before-after-4 .ba4-secondary{margin-top:12px;display:inline-flex;align-items:center;justify-content:center;min-height:56px;padding:0 24px;border:1px solid var(--button-2-border,transparent);border-radius:var(--button-radius,var(--radius,12px));background:var(--button-2-bg,var(--secondary,#e5e7eb));color:var(--button-2-ink,var(--secondary-ink,#101828));font-family:var(--button-font,var(--font-display,system-ui,sans-serif));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.15;cursor:pointer;box-shadow:var(--button-2-shadow,var(--shadow-sm,0 1px 1px oklch(0.22 0.03 260 / 0.18),0 1px 3px oklch(0.22 0.03 260 / 0.14)));transition:background .16s ease,transform .16s ease}
.cf-before-after-4 .ba4-secondary:hover{background:oklch(from var(--button-2-bg,var(--secondary,#e5e7eb)) calc(l - 0.04) c h)}
.cf-before-after-4 .ba4-secondary:active{transform:translateY(1px)}
.cf-before-after-4 .ba4-secondary:focus-visible{outline:none;box-shadow:0 0 0 2px var(--surface,#fff),0 0 0 5px var(--ba4-ring)}
.cf-before-after-4 .ba4-est{container-type:inline-size;display:flex;flex-direction:column;min-width:0;padding:clamp(20px,3vw,36px);border-radius:var(--card-radius,var(--radius,14px));background:var(--band,#1e293b);color:var(--band-ink,#fff);box-shadow:var(--card-shadow,var(--shadow-md,0 1px 2px oklch(0.22 0.03 260 / 0.22),0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)))}
.cf-before-after-4 .ba4-est-in{flex:1 1 auto;display:flex;flex-direction:column;justify-content:center;gap:24px}
.cf-before-after-4 .ba4-est-spot{line-height:0}
.cf-before-after-4 .ba4-est-copy{display:grid;gap:12px}
.cf-before-after-4 .ba4-est-title{margin:0;font-family:var(--font-display,system-ui,sans-serif);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;color:var(--band-ink,#fff);text-wrap:balance}
.cf-before-after-4 .ba4-est-body{margin:0;max-width:56ch;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;color:var(--band-ink,#fff);text-wrap:pretty}
.cf-before-after-4 .ba4-est-act{display:grid;gap:12px}
.cf-before-after-4 .ba4-cta{display:flex;width:100%;align-items:center;justify-content:center;min-height:64px;padding:12px 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from var(--button-bg,var(--cta,#dc2626)) calc(l + 0.04) c h),oklch(from var(--button-bg-2,var(--cta-2,#b91c1c)) calc(l - 0.02) c h));color:var(--button-ink,var(--cta-ink,#fff));font-family:var(--button-font,var(--font-display,system-ui,sans-serif));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:clamp(1.125rem,1.55vw,1.375rem);font-size:clamp(1rem,6cqi,1.375rem);line-height:1.15;text-align:center;text-wrap:balance;text-decoration:none;text-shadow:var(--button-text-shadow,none);cursor:pointer;box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta,#dc2626)) calc(l + 0.14) c h / 0.7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta,#dc2626)) calc(l - 0.16) c h),0 1px 2px oklch(from var(--ba4-shadow) l c h / 0.3),0 8px 16px -6px oklch(from var(--ba4-shadow) l c h / 0.45));transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
.cf-before-after-4 .ba4-cta:not(:disabled):not([aria-disabled='true']):hover,.cf-before-after-4[data-state='hover'] .ba4-cta:not(:disabled){background:linear-gradient(oklch(from var(--button-bg,var(--cta,#dc2626)) calc(l - 0.01) c h),oklch(from var(--button-bg-2,var(--cta-2,#b91c1c)) calc(l - 0.07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta,#dc2626)) calc(l + 0.1) c h / 0.7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta,#dc2626)) calc(l - 0.2) c h),0 1px 2px oklch(from var(--ba4-shadow) l c h / 0.35),0 10px 18px -6px oklch(from var(--ba4-shadow) l c h / 0.55))}
.cf-before-after-4 .ba4-cta:not(:disabled):not([aria-disabled='true']):active{transform:translateY(1px);box-shadow:inset 0 2px 4px oklch(from var(--button-bg,var(--cta,#dc2626)) calc(l - 0.22) c h / 0.5),inset 0 -2px 0 oklch(from var(--button-bg,var(--cta,#dc2626)) calc(l - 0.16) c h),0 1px 2px oklch(from var(--ba4-shadow) l c h / 0.3)}
.cf-before-after-4 .ba4-cta:focus-visible{outline:3px solid var(--band-ink,#fff);outline-offset:3px}
.cf-before-after-4 .ba4-cta:disabled,.cf-before-after-4 .ba4-cta[aria-disabled='true']{background:var(--button-2-bg,var(--secondary,#e5e7eb));color:var(--button-2-ink,var(--secondary-ink,#101828));text-shadow:none;box-shadow:none;cursor:not-allowed;transform:none}
.cf-before-after-4 .ba4-alt{margin:0;text-align:center;font-size:15px;line-height:1.4;font-weight:500;color:var(--band-ink,#fff);text-wrap:pretty}
.cf-before-after-4 .ba4-alt a{color:var(--band-ink,#fff);text-decoration:underline;text-decoration-color:oklch(from var(--band-ink,#fff) l c h / 0.5);text-underline-offset:.18em}
.cf-before-after-4 .ba4-alt a:hover{text-decoration-color:currentColor}
.cf-before-after-4 .ba4-alt a:focus-visible{outline:2px solid var(--band-ink,#fff);outline-offset:3px;border-radius:4px}
@container (max-width: 400px){.cf-before-after-4 .ba4-cta{padding:12px 18px}}
@container (min-width: 640px){.cf-before-after-4 .ba4-est-in{display:grid;grid-template-columns:auto minmax(0,1fr) minmax(280px,360px);align-items:center;column-gap:32px}}
@media (max-width:719px){.cf-before-after-4 .ba4-filters{margin-inline:calc(var(--ba4-gutter) * -1);padding-inline:var(--ba4-gutter);scroll-padding-inline:var(--ba4-gutter)}}
@media (min-width:720px){.cf-before-after-4 .ba4-filters{flex-wrap:wrap;overflow:visible}.cf-before-after-4 .ba4-grid{grid-template-columns:repeat(2,minmax(0,1fr));margin-top:32px}.cf-before-after-4 .ba4-tile--lead,.cf-before-after-4 .ba4-empty{grid-column:span 2}.cf-before-after-4 .ba4-tile--lead .ba4-frame{aspect-ratio:4/3}.cf-before-after-4 .ba4-est{grid-column:span var(--ba4-md,2)}}
@media (min-width:1024px){.cf-before-after-4 .ba4-grid{grid-template-columns:repeat(3,minmax(0,1fr));grid-auto-flow:row dense}.cf-before-after-4 .ba4-tile--lead{grid-row:span 2}.cf-before-after-4 .ba4-tile--lead .ba4-frame{aspect-ratio:auto;flex:1 1 auto;min-height:520px}.cf-before-after-4 .ba4-est{grid-column:span var(--ba4-lg,1);grid-row:span var(--ba4-lgr,1)}}
@media (prefers-reduced-motion: reduce){.cf-before-after-4 .ba4-layer,.cf-before-after-4 .ba4-chip,.cf-before-after-4 .ba4-toggle,.cf-before-after-4 .ba4-cta,.cf-before-after-4 .ba4-secondary{transition:none}.cf-before-after-4 .ba4-frame[data-before='true'] .ba4-layer--after,.cf-before-after-4 .ba4-frame[data-before='false'] .ba4-layer--before{transform:none}.cf-before-after-4 .ba4-stage{animation:none}}
`
pieces/proof/before-after-4/specimen.tsx 56 lines
import __studioImageddd15a84 from "../assets/a51504d1c3d7b0bb.webp";
import __studioImageb64ad75a from "../assets/6e72739b9030caca.webp";
import __studioImage42565124 from "../assets/c8cc644bcb21115d.webp";
import { BeforeAfter4 } from '../before-after-4'
export const states = ['default', 'hover', 'active', 'disabled']
export default function BeforeAfter4Specimen({ state = 'default' }: { state?: 'default' | 'hover' | 'active' | 'disabled' }) {
return (
<BeforeAfter4
state={state}
headline='Flip any photo to see the room it used to be'
highlight='the room it used to be'
lead='Real jobs by Granite & Grain Renovations. Pick a room, tap Show before, and picture your home in the next photo.'
services={['Kitchens', 'Baths', 'Decks', 'Basements']}
jobs={[
{
id: 'kitchen-maple-grove',
service: 'Kitchens',
title: 'Full kitchen remodel',
town: 'Maple Grove',
detail: 'A new island, white shaker cabinets and quartz counters in the same footprint.',
featured: true,
pairImage: __studioImageddd15a84,
beforeAlt: 'Maple Grove kitchen before: oak cabinets and worn laminate counters',
afterAlt: 'Maple Grove kitchen after: white shaker cabinets, quartz counters and a wood-topped island',
},
{
id: 'bath-cedar-falls',
service: 'Baths',
title: 'Primary bath rebuild',
town: 'Cedar Falls',
detail: 'Tub out, a walk-in tile shower and a floating double vanity in.',
pairImage: __studioImageb64ad75a,
beforeAlt: 'Cedar Falls bathroom before: beige tub, pink tile and a cracked vanity',
afterAlt: 'Cedar Falls bathroom after: walk-in glass shower and a floating walnut double vanity',
},
{
id: 'deck-lakeview',
service: 'Decks',
title: 'Two-level cedar deck',
town: 'Lakeview',
detail: 'Rotted boards replaced with cedar, black steel rails and built-in steps.',
pairImage: __studioImage42565124,
beforeAlt: 'Lakeview deck before: weathered grey boards and a broken railing',
afterAlt: 'Lakeview deck after: two-level cedar deck with black metal railings',
},
]}
estimateTitle='Your room could be the next photo here'
estimateBody='We walk the space, measure, and leave you a written, itemized price. Free, with no obligation.'
estimateLabel='Get My Free Estimate'
secondaryLabel='or call the shop at (555) 214-0188'
secondaryHref='tel:+15552140188'
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalBeforeAfter4 |
string |
Default 'See the work before you book your estimate'
|
highlight OptionalBeforeAfter4 |
string |
Default 'before you book'
|
lead OptionalBeforeAfter4 |
string |
Default 'Pick a room, tap Show before on any job, and see what the space looked like when the crew arrived.'
|
jobs OptionalBeforeAfter4 |
BeforeAfter4Job[] |
Default []
|
services OptionalBeforeAfter4 |
string[] |
|
estimateTitle OptionalBeforeAfter4 |
string |
Default 'Your room could be the next photo here'
|
estimateBody OptionalBeforeAfter4 |
string |
Default 'Tell us about your project and get a written price for it.'
|
estimateLabel OptionalBeforeAfter4 |
string |
Default 'Get My Free Estimate'
|
secondaryLabel OptionalBeforeAfter4 |
string |
Default 'or flip a few more photos first'
|
secondaryHref OptionalBeforeAfter4 |
string |
|
estimateSpot OptionalBeforeAfter4 |
string |
Default checklist
|
href OptionalBeforeAfter4 |
string |
|
onAction OptionalBeforeAfter4 |
(event: React.MouseEvent<HTMLElement>) => void |
|
disabled OptionalBeforeAfter4 |
boolean |
Default false
|
state OptionalBeforeAfter4 |
'default' | 'hover' | 'active' | 'disabled' |
Default 'default'
|
copy OptionalBeforeAfter4 |
Partial<BeforeAfter4Copy> |
|
className OptionalBeforeAfter4 |
string |
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-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.
This piece reads no image slots.
-
6e72739b9030caca.webp
image/webp · 41.3 KB
-
a51504d1c3d7b0bb.webp
image/webp · 114 KB
-
c8cc644bcb21115d.webp
image/webp · 250 KB
-
d0943b629c0b1324.webp
image/webp · 8.87 KB