Before After Cards 2
Before/after case-file fan: a hand of customer cards, each with a before and after photo pair, name, timeframe and
Use it in a prompt
Use proof/before-after-cards-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/proof/before-after-cards-2.tsx. - Import it and pass your copy and images (Props tab):
import { BeforeAfterCards2 } from "@/components/funneldna/proof/before-after-cards-2"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/proof/before-after-cards-2/component.tsx 486 lines
// layout: card-fan
// Before/after case-file fan: a hand of customer cards, each with a before and after photo pair, name, timeframe and
// one supplied line. Swipe, drag, arrow keys or the buttons bring the next card forward; a send-it button closes the band.
import * as React from "react";
import { CalendarCheck, ChevronLeft, ChevronRight, Info, LockKeyhole, UserRound } from "lucide-react";
import { Spot } from "../fx/fx";
export type TransformationStory = {
/** Card title, e.g. "Dana R., Austin". */
name: string;
/** Short timeframe chip, e.g. "28 days". */
timeframe?: string;
/** The one line the person supplied; quote marks are added. */
quote?: React.ReactNode;
beforeImage?: string;
beforeAlt?: string;
/** Small note beside the Before label, e.g. "Day 1". */
beforeNote?: string;
afterImage?: string;
afterAlt?: string;
/** Small note beside the After label, e.g. "Day 28". */
afterNote?: string;
/** One side-by-side before/after image; split into its two halves when the separate images are absent. */
pairImage?: string;
};
export type BeforeAfterCards2Copy = {
before?: string;
after?: string;
previous?: string;
next?: string;
/** "{current}" and "{total}" are replaced. */
count?: string;
/** Accessible card label; "{name}", "{current}" and "{total}" are replaced. */
slide?: string;
/** Accessible label of the card fan. */
region?: string;
};
export type BeforeAfterCards2Props = {
headline?: string;
/** Phrase inside the headline that gets one marker stroke. */
highlight?: string;
lead?: string;
/** Customer cards (3 to 5 work best). Empty by default: the block then shows only the headline and the action. */
stories?: TransformationStory[];
/** Results-vary line, always shown under the fan whenever stories are present. */
disclaimer?: string;
label?: string;
/** One reassurance line under the button. */
note?: string;
/** Optional fx Spot illustration beside the fan on desktop (an imported spot asset); off by default, hidden on phones. */
spot?: string | null;
copy?: BeforeAfterCards2Copy;
/** Card shown first. */
initialIndex?: number;
href?: string;
onAction?: (event: React.MouseEvent<HTMLElement>) => void;
disabled?: boolean;
state?: "default" | "hover" | "active" | "disabled";
className?: string;
};
const DEFAULT_COPY: Required<BeforeAfterCards2Copy> = {
before: "Before",
after: "After",
previous: "Previous story",
next: "Next story",
count: "{current} of {total}",
slide: "{name}, story {current} of {total}",
region: "Before and after stories",
};
const STEP_NEXT = 84;
const STEP_PREV = 46;
export function BeforeAfterCards2({
headline = "Picture yourself a few weeks from now",
highlight = "a few weeks from now",
lead = "Take the first step today and see where it leads.",
stories = [],
disclaimer = "Results vary from person to person.",
label = "Send Me The First Step",
note = "",
spot = null,
copy,
initialIndex = 0,
href,
onAction,
disabled = false,
state = "default",
className,
}: BeforeAfterCards2Props) {
const text = { ...DEFAULT_COPY, ...copy };
const uid = React.useId();
const total = stories.length;
const [current, setCurrent] = React.useState(initialIndex);
const active = total ? Math.max(0, Math.min(current, total - 1)) : 0;
const [drag, setDrag] = React.useState(0);
const [dragging, setDragging] = React.useState(false);
const cards = React.useRef<Array<HTMLElement | null>>([]);
const pointer = React.useRef<{ id: number; x: number; y: number; moved: boolean } | null>(null);
const swallowClick = React.useRef(false);
const focusActive = React.useRef(false);
React.useEffect(() => {
if (!focusActive.current) return;
focusActive.current = false;
cards.current[active]?.focus({ preventScroll: true });
}, [active]);
const go = (index: number, focus = false) => {
if (!total) return;
const next = Math.max(0, Math.min(total - 1, index));
if (focus) {
if (next === active) cards.current[active]?.focus({ preventScroll: true });
else focusActive.current = true;
}
setCurrent(next);
};
const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
const targets: Record<string, number> = { ArrowLeft: active - 1, ArrowRight: active + 1, Home: 0, End: total - 1 };
if (!(event.key in targets)) return;
event.preventDefault();
go(targets[event.key], true);
};
const onPointerDown = (event: React.PointerEvent<HTMLDivElement>) => {
swallowClick.current = false;
if (total < 2 || (event.pointerType === "mouse" && event.button !== 0)) return;
pointer.current = { id: event.pointerId, x: event.clientX, y: event.clientY, moved: false };
};
const onPointerMove = (event: React.PointerEvent<HTMLDivElement>) => {
const p = pointer.current;
if (!p || p.id !== event.pointerId) return;
const dx = event.clientX - p.x;
const dy = event.clientY - p.y;
if (!p.moved) {
if (Math.abs(dy) > 10 && Math.abs(dy) > Math.abs(dx)) {
pointer.current = null;
return;
}
if (Math.abs(dx) < 8) return;
p.moved = true;
setDragging(true);
try {
event.currentTarget.setPointerCapture(event.pointerId);
} catch {
// capture is an enhancement only
}
}
const atEdge = (dx > 0 && active === 0) || (dx < 0 && active === total - 1);
setDrag(atEdge ? dx * 0.25 : dx);
};
const finishDrag = (event: React.PointerEvent<HTMLDivElement>, commit: boolean) => {
const p = pointer.current;
if (!p || p.id !== event.pointerId) return;
pointer.current = null;
if (!p.moved) return;
swallowClick.current = true;
const dx = event.clientX - p.x;
setDragging(false);
setDrag(0);
if (commit && dx <= -64) go(active + 1);
else if (commit && dx >= 64) go(active - 1);
};
const onClickCapture = (event: React.MouseEvent<HTMLDivElement>) => {
if (!swallowClick.current) return;
swallowClick.current = false;
event.preventDefault();
event.stopPropagation();
};
const isDisabled = disabled || state === "disabled";
const forced = state === "hover" || state === "active" ? state : undefined;
const action =
href && !isDisabled ? (
<a className="cf-baf__btn" href={href} data-state={forced} onClick={onAction}>
{label}
</a>
) : (
<button type="button" className="cf-baf__btn" data-state={forced} disabled={isDisabled} onClick={onAction}>
{label}
</button>
);
return (
<section
className={["cf-before-after-cards-2", className].filter(Boolean).join(" ")}
aria-labelledby={`${uid}-headline`}
>
<style>{css}</style>
<div className="cf-baf__inner">
<header className="cf-baf__head">
<h2 id={`${uid}-headline`} className="cf-baf__headline">
{withMarker(headline, highlight)}
</h2>
{lead ? <p className="cf-baf__lead">{lead}</p> : null}
</header>
{total > 0 ? (
<div className="cf-baf__proof">
<div
className="cf-baf__stage"
role="region"
aria-roledescription="carousel"
aria-label={text.region}
data-multi={total > 1 ? "" : undefined}
data-dragging={dragging ? "" : undefined}
onKeyDown={onKeyDown}
onPointerDown={onPointerDown}
onPointerMove={onPointerMove}
onPointerUp={(event) => finishDrag(event, true)}
onPointerCancel={(event) => finishDrag(event, false)}
onClickCapture={onClickCapture}
>
<div className="cf-baf__hand">
{spot ? (
<div className="cf-baf__spot" aria-hidden="true">
<Spot src={spot} size={200} />
</div>
) : null}
{stories.map((story, index) => {
const offset = index - active;
const distance = Math.abs(offset);
const pos = offset === 0 ? "active" : offset > 0 ? "next" : "prev";
const vars = {
"--x": offset > 0 ? offset * STEP_NEXT : offset * STEP_PREV,
"--r": offset > 0 ? offset * 4 : offset * 3,
"--ad": Math.min(distance, 3),
"--drag": offset === 0 ? drag : 0,
zIndex: 20 - distance * 2 - (offset < 0 ? 1 : 0),
} as React.CSSProperties;
const slideLabel = fill(text.slide, { name: story.name, current: index + 1, total });
return (
<article
key={`${story.name}-${index}`}
ref={(element) => {
cards.current[index] = element;
}}
className="cf-baf__card"
style={vars}
data-pos={pos}
data-far={distance > 2 ? "" : undefined}
role="group"
aria-roledescription="slide"
aria-label={slideLabel}
aria-hidden={offset !== 0 ? true : undefined}
tabIndex={offset === 0 ? 0 : -1}
onClick={offset !== 0 ? () => go(index) : undefined}
>
<div className="cf-baf__pair">
<Photo
src={story.beforeImage}
pair={story.pairImage}
half="before"
alt={story.beforeAlt}
label={text.before}
note={story.beforeNote}
/>
<Photo
src={story.afterImage}
pair={story.pairImage}
half="after"
alt={story.afterAlt}
label={text.after}
note={story.afterNote}
/>
</div>
<div className="cf-baf__meta">
<h3 className="cf-baf__name">{story.name}</h3>
{story.timeframe ? (
<span className="cf-baf__chip">
<CalendarCheck strokeWidth={2.5} aria-hidden="true" />
{story.timeframe}
</span>
) : null}
</div>
{story.quote ? <p className="cf-baf__quote">“{story.quote}”</p> : null}
</article>
);
})}
</div>
</div>
{total > 1 ? (
<div className="cf-baf__controls">
<button
type="button"
className="cf-baf__nav"
aria-label={text.previous}
disabled={active === 0}
onClick={() => go(active - 1, active - 1 <= 0)}
>
<ChevronLeft strokeWidth={2.5} aria-hidden="true" />
</button>
<div className="cf-baf__count">
<span className="cf-baf__count-text" aria-live="polite">
{fill(text.count, { current: active + 1, total })}
</span>
<span className="cf-baf__pips" aria-hidden="true">
{stories.map((story, index) => (
<i key={`${story.name}-pip-${index}`} data-on={index === active ? "" : undefined} />
))}
</span>
</div>
<button
type="button"
className="cf-baf__nav"
aria-label={text.next}
disabled={active === total - 1}
onClick={() => go(active + 1, active + 1 >= total - 1)}
>
<ChevronRight strokeWidth={2.5} aria-hidden="true" />
</button>
</div>
) : null}
{disclaimer ? (
<p className="cf-baf__disclaimer">
<Info strokeWidth={2.5} aria-hidden="true" />
{disclaimer}
</p>
) : null}
</div>
) : null}
<div className="cf-baf__cta">
{action}
{note ? (
<p className="cf-baf__note">
<LockKeyhole strokeWidth={2.5} aria-hidden="true" />
{note}
</p>
) : null}
</div>
</div>
</section>
);
}
export default BeforeAfterCards2;
function Photo({
src,
pair,
half,
alt,
label,
note,
}: {
src?: string;
pair?: string;
half: "before" | "after";
alt?: string;
label: string;
note?: string;
}) {
const image = src || pair;
return (
<figure className="cf-baf__photo" data-tone={half}>
<div className="cf-baf__frame">
{image ? (
<img
className={src ? "cf-baf__img" : "cf-baf__img cf-baf__img--pair"}
data-half={src ? undefined : half}
src={image}
alt={alt ?? ""}
draggable={false}
loading="lazy"
decoding="async"
/>
) : (
<UserRound className="cf-baf__empty" strokeWidth={2.5} aria-hidden="true" />
)}
</div>
<figcaption className="cf-baf__label">
<strong>{label}</strong>
{note ? <span>{note}</span> : null}
</figcaption>
</figure>
);
}
function withMarker(text: string, phrase?: string) {
if (!phrase) return glue(text);
const at = text.indexOf(phrase);
if (at < 0) return glue(text);
return (
<>
{glue(text.slice(0, at))}
<span className="cf-baf__mark">{glue(phrase)}</span>
{glue(text.slice(at + phrase.length))}
</>
);
}
/** Keeps a number on the line of the word before it ("Day 1", "Week 3") so headlines never split them. */
function glue(text: string) {
return text.replace(/ (\d)/g, "\u00a0$1");
}
function fill(template: string, values: Record<string, string | number>) {
return Object.keys(values).reduce((out, key) => out.split(`{${key}}`).join(String(values[key])), template);
}
const R = ".cf-before-after-cards-2";
const css = `
${R}{--cf-baf-marker:color-mix(in oklab, var(--marker, #fae37c) 64%, var(--surface));--cf-baf-sh:var(--shadow, oklch(0.22 0.03 260));--cf-baf-k:1;position:relative;isolation:isolate;overflow-x:clip;box-sizing:border-box;background:var(--surface);color:var(--ink);font-family:var(--font-body);padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) clamp(64px,8.5vw,120px)}
${R} *,${R} *::before,${R} *::after{box-sizing:border-box}
${R} .cf-baf__inner{max-width:1120px;margin:0 auto}
${R} .cf-baf__head{max-width:46rem;margin:0 auto clamp(40px,4.5vw,56px);text-align:center;animation:cf-baf-rise .45s cubic-bezier(.2,.7,.2,1) both}
${R} .cf-baf__head + .cf-baf__cta{margin-top:0}
${R} .cf-baf__headline{margin:0;font-family:var(--font-display);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);text-wrap:balance;color:var(--ink)}
${R} .cf-baf__mark{background-image:linear-gradient(transparent 50%,var(--cf-baf-marker) 50%,var(--cf-baf-marker) 94%,transparent 94%);-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:0 .06em;margin:0 -.02em;border-radius:.1em}
${R} .cf-baf__lead{margin:16px auto 0;max-width:40rem;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
${R} .cf-baf__proof{animation:cf-baf-rise .45s cubic-bezier(.2,.7,.2,1) .07s both}
${R} .cf-baf__stage{position:relative;padding:8px 0 72px;touch-action:pan-y;-webkit-user-select:none;user-select:none}
${R} .cf-baf__hand{position:relative;display:grid;width:min(560px,100%);margin:0 auto}
${R} .cf-baf__spot{position:absolute;z-index:0;left:-168px;top:40px;transform:rotate(-8deg);pointer-events:none}
${R} .cf-baf__card{grid-area:1/1;position:relative;display:flex;flex-direction:column;gap:16px;min-width:0;padding:clamp(16px,2vw,20px);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 oklch(from var(--cf-baf-sh) l c h / .22),0 4px 10px -2px oklch(from var(--cf-baf-sh) l c h / .2)));transform-origin:50% 130%;transform:translateX(calc((var(--x,0) * var(--cf-baf-k) + var(--drag,0)) * 1px)) translateY(calc(var(--ad,0) * 16px)) rotate(calc((var(--r,0) * var(--cf-baf-k) + var(--drag,0) / 28) * 1deg)) scale(calc(1 - var(--ad,0) * .04));transition:transform .45s cubic-bezier(.2,.7,.2,1),opacity .3s ease,visibility .3s,box-shadow .2s ease,border-color .2s ease;outline:none}
${R} .cf-baf__card[data-pos="active"]{border-color:oklch(from var(--accent) l c h / .45);box-shadow:var(--shadow-lg,0 2px 4px oklch(from var(--cf-baf-sh) l c h / .22),0 12px 24px -8px oklch(from var(--cf-baf-sh) l c h / .32))}
${R} .cf-baf__meta,${R} .cf-baf__quote,${R} .cf-baf__label{transition:opacity .3s ease}
${R} .cf-baf__card:not([data-pos="active"]) :is(.cf-baf__meta,.cf-baf__quote,.cf-baf__label){opacity:0}
${R} .cf-baf__card:not([data-pos="active"]){cursor:pointer}
${R} .cf-baf__card[data-far]{opacity:0;visibility:hidden;pointer-events:none}
${R} .cf-baf__card:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:4px}
${R} .cf-baf__stage[data-dragging] .cf-baf__card[data-pos="active"]{transition:opacity .3s ease,box-shadow .2s ease}
@media (hover:hover) and (pointer:fine){${R} .cf-baf__stage[data-multi]{cursor:grab}${R} .cf-baf__stage[data-dragging]{cursor:grabbing}${R} .cf-baf__card[data-pos="next"]:hover,${R} .cf-baf__card[data-pos="prev"]:hover{border-color:oklch(from var(--accent) l c h / .35)}}
${R} .cf-baf__pair{display:grid;grid-template-columns:1fr 1fr;gap:12px}
${R} .cf-baf__photo{margin:0;min-width:0}
${R} .cf-baf__frame{position:relative;display:grid;place-items:center;aspect-ratio:3/4;overflow:hidden;border-radius:12px;background:color-mix(in oklch,var(--ink) 6%,var(--card))}
${R} .cf-baf__img{display:block;width:100%;height:100%;object-fit:cover;object-position:50% 30%;-webkit-user-drag:none}
${R} .cf-baf__img--pair{position:absolute;top:0;left:-2%;width:208%;max-width:none;object-position:50% 30%}
${R} .cf-baf__img--pair[data-half="after"]{left:-106%}
${R} .cf-baf__empty{width:32px;height:32px;color:var(--muted)}
${R} .cf-baf__label{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 8px;margin-top:10px;line-height:1.2}
${R} .cf-baf__label strong{font-size:.875rem;font-weight:800;letter-spacing:.08em;text-transform:uppercase;color:var(--ink)}
${R} .cf-baf__photo[data-tone="after"] .cf-baf__label strong{color:var(--accent)}
${R} .cf-baf__label span{font-size:.9375rem;font-weight:600;color:var(--muted)}
${R} .cf-baf__meta{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 12px}
${R} .cf-baf__name{margin:0;font-family:var(--font-display);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;font-weight:var(--display-weight,800);letter-spacing:-0.01em;text-wrap:balance;color:var(--ink)}
${R} .cf-baf__chip{display:inline-flex;align-items:center;gap:6px;min-height:30px;padding:4px 12px;border-radius:999px;background:color-mix(in oklch,var(--ink) 6%,var(--card));color:var(--ink);font-size:.875rem;font-weight:800;line-height:1.2;white-space:nowrap}
${R} .cf-baf__chip svg{width:16px;height:16px;flex:none;color:var(--accent)}
${R} .cf-baf__quote{margin:0;flex:1;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;font-weight:500;color:var(--ink);text-wrap:pretty}
${R} .cf-baf__controls{display:flex;align-items:center;justify-content:center;gap:20px}
${R} .cf-baf__nav{display:inline-grid;place-items:center;width:48px;height:48px;padding:0;border:1px solid var(--button-2-border,transparent);border-radius:999px;background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));box-shadow:var(--button-2-shadow,var(--shadow-sm));cursor:pointer;transition:transform .16s ease,background .16s ease,box-shadow .16s ease,opacity .16s ease}
${R} .cf-baf__nav svg{width:20px;height:20px}
@media (hover:hover){${R} .cf-baf__nav:not(:disabled):hover{background:oklch(from var(--button-2-bg,var(--secondary)) calc(l - .05) c h)}}
${R} .cf-baf__nav:not(:disabled):active{transform:translateY(1px);box-shadow:none}
${R} .cf-baf__nav:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:3px}
${R} .cf-baf__nav:disabled{opacity:.45;cursor:not-allowed;box-shadow:none}
${R} .cf-baf__count{display:grid;justify-items:center;gap:8px;min-width:88px}
${R} .cf-baf__count-text{font-size:.9375rem;font-weight:700;line-height:1.2;font-variant-numeric:tabular-nums;color:var(--ink)}
${R} .cf-baf__pips{display:flex;gap:6px}
${R} .cf-baf__pips i{display:block;width:8px;height:8px;border-radius:999px;background:color-mix(in oklch,var(--ink) 20%,var(--surface));transition:width .3s cubic-bezier(.2,.7,.2,1),background .3s ease}
${R} .cf-baf__pips i[data-on]{width:22px;background:var(--accent-fill,var(--accent))}
${R} .cf-baf__disclaimer{max-width:46rem;margin:16px auto 0;text-align:center;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
${R} .cf-baf__disclaimer svg,${R} .cf-baf__note svg{display:inline-block;width:16px;height:16px;vertical-align:-.15em;margin-inline-end:.4em}
${R} .cf-baf__cta{display:flex;flex-direction:column;align-items:center;gap:12px;margin-top:clamp(32px,4vw,48px);text-align:center;animation:cf-baf-rise .45s cubic-bezier(.2,.7,.2,1) .14s both}
${R} .cf-baf__note{margin:0;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted);text-wrap:pretty}
${R} .cf-baf__btn{--cf-baf-b:var(--button-bg,var(--cta));--cf-baf-b2:var(--button-bg-2,var(--cta-2));display:inline-flex;align-items:center;justify-content:center;min-height:72px;max-width:100%;padding:12px 32px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from var(--cf-baf-b) calc(l + .04) c h),oklch(from var(--cf-baf-b2) calc(l - .02) c h));color:var(--button-ink,var(--cta-ink));font-family:var(--button-font,var(--font-display));font-size:clamp(1.125rem,1.55vw,1.375rem);font-weight:var(--button-weight,800);line-height:1.15;text-transform:var(--button-case,none);text-align:center;text-decoration:none;text-wrap:balance;text-shadow:var(--button-text-shadow,none);cursor:pointer;box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--cf-baf-b) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--cf-baf-b) calc(l - .16) c h),0 1px 2px oklch(from var(--cf-baf-sh) l c h / .3),0 8px 16px -6px oklch(from var(--cf-baf-sh) l c h / .45));transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
${R} .cf-baf__btn[data-state="hover"],${R} .cf-baf__btn:not(:disabled):hover{background:linear-gradient(oklch(from var(--cf-baf-b) calc(l - .01) c h),oklch(from var(--cf-baf-b2) calc(l - .07) c h));transform:translateY(-1px);box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--cf-baf-b) calc(l + .1) c h / .6),inset 0 -3px 0 oklch(from var(--cf-baf-b) calc(l - .2) c h),0 1px 2px oklch(from var(--cf-baf-sh) l c h / .32),0 12px 20px -8px oklch(from var(--cf-baf-sh) l c h / .5))}
${R} .cf-baf__btn[data-state="active"],${R} .cf-baf__btn:not(:disabled):active{transform:translateY(1px);background:linear-gradient(oklch(from var(--cf-baf-b) calc(l - .04) c h),oklch(from var(--cf-baf-b2) calc(l - .08) c h));box-shadow:inset 0 2px 4px oklch(from var(--cf-baf-b) calc(l - .22) c h / .55),inset 0 -2px 0 oklch(from var(--cf-baf-b) calc(l - .16) c h),0 1px 2px oklch(from var(--cf-baf-sh) l c h / .3)}
${R} .cf-baf__btn:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:3px}
${R} .cf-baf__btn:disabled{background:color-mix(in oklch,var(--ink) 12%,var(--card));color:var(--muted);text-shadow:none;box-shadow:none;cursor:not-allowed;transform:none}
@media (max-width:960px){${R}{--cf-baf-k:.7}${R} .cf-baf__hand{width:min(500px,100%)}}
@media (max-width:640px){
${R} .cf-baf__head{margin-bottom:52px}
${R} .cf-baf__stage{padding:0 0 32px}
${R} .cf-baf__hand{width:100%}
${R} .cf-baf__spot{display:none}
${R} .cf-baf__card{transform-origin:50% 100%;transform:translateX(calc(var(--drag,0) * 1px)) translateY(calc(var(--ad,0) * 10px)) rotate(calc(var(--drag,0) / 40 * 1deg)) scale(calc(1 - var(--ad,0) * .05))}
${R} .cf-baf__card[data-pos="prev"]{opacity:0;visibility:hidden;pointer-events:none}
${R} .cf-baf__pair{gap:10px}
${R} .cf-baf__btn{width:100%;min-height:64px;padding:12px 20px}
}
@keyframes cf-baf-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){${R} .cf-baf__head,${R} .cf-baf__proof,${R} .cf-baf__cta{animation:none}${R} .cf-baf__card,${R} .cf-baf__meta,${R} .cf-baf__quote,${R} .cf-baf__label,${R} .cf-baf__pips i,${R} .cf-baf__nav,${R} .cf-baf__btn{transition:none}}
`;
pieces/proof/before-after-cards-2/specimen.tsx 56 lines
import __studioImage714e71eb from "../assets/1aa0ce90decfe345.webp";
import __studioImage6bf8d203 from "../assets/e8594722da1c1b7c.webp";
import __studioImagef5787304 from "../assets/2d485b484dae1eac.webp";
import * as React from "react";
import { BeforeAfterCards2, type BeforeAfterCards2Props, type TransformationStory } from "../before-after-cards-2";
import defaults from "../../studio-defaults.json";
export const states = ["default", "hover", "active", "disabled"];
export default function BeforeAfterCards2Specimen({ state = "default" }: { state?: BeforeAfterCards2Props["state"] }) {
const stories: TransformationStory[] = [
{
name: "Dana R., Austin",
timeframe: "28 days",
quote: "I stopped skipping breakfast and started walking after work. By week three I actually wanted to.",
pairImage: __studioImage714e71eb,
beforeAlt: "Dana on day 1 of the challenge, in a grey t-shirt in her kitchen",
beforeNote: "Day 1",
afterAlt: "Dana on day 28, standing tall in a teal workout top",
afterNote: "Day 28",
},
{
name: "Marcus T., Columbus",
timeframe: "28 days",
quote: "The daily check-in kept me honest. I finished every workout for the first time ever.",
pairImage: __studioImage6bf8d203,
beforeAlt: "Marcus on day 1, in a navy hoodie in his living room",
beforeNote: "Day 1",
afterAlt: "Marcus on day 28, upright in a grey t-shirt",
afterNote: "Day 28",
},
{
name: "Priya S., Leeds",
timeframe: "28 days",
quote: "Twenty minutes a day fit around the kids. I feel stronger carrying the shopping home now.",
pairImage: __studioImagef5787304,
beforeAlt: "Priya on day 1, arms folded in a cardigan in her hallway",
beforeNote: "Day 1",
afterAlt: "Priya on day 28, smiling in a coral sports top",
afterNote: "Day 28",
},
];
return (
<BeforeAfterCards2
headline="They started on Day 1, just like you will"
highlight="just like you will"
lead="Swipe through check-ins from the 28-Day Reset Challenge, then get your Day 1 plan sent straight to your inbox."
stories={stories}
disclaimer="Results vary. These are individual experiences shared by participants, not typical or guaranteed outcomes."
label="Send My Day 1 Plan"
note={defaults.sample.registration.privacy}
state={state}
/>
);
}
| Name | Type | Details |
|---|---|---|
headline OptionalBeforeAfterCards2 |
string |
Default "Picture yourself a few weeks from now"
|
highlight OptionalBeforeAfterCards2 |
string |
Default "a few weeks from now"
|
lead OptionalBeforeAfterCards2 |
string |
Default "Take the first step today and see where it leads."
|
stories OptionalBeforeAfterCards2 |
TransformationStory[] |
Default []
|
disclaimer OptionalBeforeAfterCards2 |
string |
Default "Results vary from person to person."
|
label OptionalBeforeAfterCards2 |
string |
Default "Send Me The First Step"
|
note OptionalBeforeAfterCards2 |
string |
Default ""
|
spot OptionalBeforeAfterCards2 |
string | null |
Default null
|
copy OptionalBeforeAfterCards2 |
BeforeAfterCards2Copy |
|
initialIndex OptionalBeforeAfterCards2 |
number |
Default 0
|
href OptionalBeforeAfterCards2 |
string |
|
onAction OptionalBeforeAfterCards2 |
(event: React.MouseEvent<HTMLElement>) => void |
|
disabled OptionalBeforeAfterCards2 |
boolean |
Default false
|
state OptionalBeforeAfterCards2 |
"default" | "hover" | "active" | "disabled" |
Default "default"
|
className OptionalBeforeAfterCards2 |
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-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.
This piece reads no image slots.
-
1aa0ce90decfe345.webp
image/webp · 56.3 KB
-
2d485b484dae1eac.webp
image/webp · 61.3 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
e8594722da1c1b7c.webp
image/webp · 58.6 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB