Ecom Product Hero 1
E-commerce product hero: the product lit on a centre stage, the outcome headline and supplied proof above it, and a buy card with quantity and Add to cart (plus an optional sticky quick-buy bar) so the order is always one tap away.
Use it in a prompt
Use hero/ecom-product-hero 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/hero/ecom-product-hero.tsx. - Import it and pass your copy and images (Props tab):
import { EcomProductHero } from "@/components/funneldna/hero/ecom-product-hero"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/hero/ecom-product-hero/component.tsx 618 lines
// layout: product-stage
// E-commerce product hero: the product lit on a centre stage, the outcome headline and supplied proof above it, and a buy card with quantity and Add to cart (plus an optional sticky quick-buy bar) so the order is always one tap away.
import * as React from 'react';
import { AlertCircle, Check, ChevronDown, Download, Loader2, Lock, Minus, Plus, ShieldCheck, Star, Truck, X, type LucideIcon } from 'lucide-react';
export type EcomProductHeroNote = {
name: string;
detail?: string;
/** Supplied value only, shown through copy.valueLabel. */
value?: string;
/** Item image src (slot item-n). */
image?: string;
imageAlt?: string;
};
export type EcomProductHeroValues = { quantity: number };
export type EcomProductHeroCopy = {
/** Screen-reader rating line; {rating} */
ratingLabel: string;
/** Review count label; {count} */
reviews: string;
/** Follows the price, e.g. today. That’s it. */
todaySuffix: string;
/** Words before the struck compare-at price */
compareAt: string;
/** Disclosure title; {price} */
reasonsTitle: string;
quantityLabel: string;
/** Accessible label of the minus control */
decrease: string;
/** Accessible label of the plus control */
increase: string;
quantityPlaceholder: string;
/** Inline quantity error; {min} {max} */
quantityError: string;
/** Button label with total; {label} {total} */
actionWithTotal: string;
/** Button label while loading */
loading: string;
/** Live total announcement; {total} */
totalLive: string;
/** Note value label; {value} */
valueLabel: string;
/** Accessible form name; {product} */
formLabel: string;
/** Accessible name of the quick-buy bar */
stickyLabel: string;
/** Sticky bar price line; {price} */
stickyPrice: string;
/** Accessible label of the bar's close control */
stickyHide: string;
};
export type EcomProductHeroProps = {
/** Product name above the headline and in the quick-buy bar. */
productName?: string;
/** Outcome headline; a string can carry one marker phrase via highlight. */
headline?: React.ReactNode;
/** Phrase inside a string headline that gets the marker stroke. */
highlight?: string;
lead?: React.ReactNode;
/** Product cut-out src (slot product), transparent background. */
productImage?: string;
productImageAlt?: string;
/** Supplied average rating out of 5; omit to hide the rating line. */
rating?: number;
/** Supplied review count. */
reviewCount?: number;
/** Where the review count links to. */
reviewsHref?: string;
/** Benefit chips; three reads best. */
benefits?: string[];
/** Feature notes set beside the stage. */
notes?: EcomProductHeroNote[];
/** Unit price, e.g. $47. */
price?: string;
/** Supplied compare-at or regular price, shown struck. */
compareAtPrice?: string;
/** Small line under the price. */
priceNote?: string;
/** Numbered reasons in the disclosure; empty hides it. */
reasons?: string[];
/** Plain instruction above the button. */
instruction?: string;
/** Button label; the total follows it via copy.actionWithTotal. */
actionLabel?: string;
/** Shipping, access and guarantee lines; the icon follows the words. */
reassurance?: string[];
/** Starting quantity, clamped to 1..maxQuantity. */
defaultQuantity?: number;
maxQuantity?: number;
/** Show a quick-buy bar once the buy card scrolls out of view. */
sticky?: boolean;
stickyPosition?: 'top' | 'bottom';
headingLevel?: 'h1' | 'h2';
/** Checkout URL; the form submits quantity there with GET. */
href?: string;
/** Validated values on Add to cart. */
onSubmit?: (values: EcomProductHeroValues) => void;
/** Checkout action after a valid Add to cart. */
onAction?: (values: EcomProductHeroValues) => void;
/** Show the busy button while the cart updates. */
loading?: boolean;
disabled?: boolean;
state?: 'default' | 'hover' | 'active' | 'disabled' | 'error';
copy?: Partial<EcomProductHeroCopy>;
className?: string;
};
export function EcomProductHero(props: EcomProductHeroProps) {
const {
productName = 'The Funnel Starter Kit',
headline = 'Build your first funnel with a clear plan',
highlight = 'a clear plan',
lead = 'Plan your funnel, write your page copy, and check every step before you launch.',
productImage,
productImageAlt = '',
rating,
reviewCount,
reviewsHref,
benefits = ['Plan your funnel', 'Write your page copy', 'Check every step'],
notes = DEFAULT_NOTES,
price = '$47',
compareAtPrice,
priceNote = 'One payment · Lifetime access',
reasons = DEFAULT_REASONS,
instruction = 'Click the button below to get instant access.',
actionLabel = 'Add to cart',
reassurance = ['Instant digital access', '30-day money-back guarantee'],
defaultQuantity = 1,
maxQuantity = 10,
sticky = false,
stickyPosition = 'top',
headingLevel = 'h1',
href,
onSubmit,
onAction,
loading = false,
disabled = false,
state = 'default',
copy,
className,
} = props;
const c = { ...DEFAULT_COPY, ...copy };
const uid = React.useId().replace(/[^a-zA-Z0-9]/g, '');
const id = (part: string) => `eph-${uid}-${part}`;
const min = 1;
const max = Math.max(min, Math.floor(maxQuantity));
const startQty = String(clampInt(defaultQuantity, min, max));
const [raw, setRaw] = React.useState(state === 'error' ? '0' : startQty);
const [touched, setTouched] = React.useState(false);
const [open, setOpen] = React.useState(false);
const [barShown, setBarShown] = React.useState(false);
const [barClosed, setBarClosed] = React.useState(false);
const formRef = React.useRef<HTMLFormElement>(null);
const buyRef = React.useRef<HTMLDivElement>(null);
const inputRef = React.useRef<HTMLInputElement>(null);
const toggleRef = React.useRef<HTMLButtonElement>(null);
const ctaRef = React.useRef<HTMLButtonElement>(null);
React.useEffect(() => {
setRaw(state === 'error' ? '0' : startQty);
setTouched(false);
}, [state, startQty]);
React.useEffect(() => {
if (!sticky || barClosed) return;
const el = buyRef.current;
if (!el || typeof IntersectionObserver === 'undefined') return;
const io = new IntersectionObserver((entries) => {
const entry = entries[0];
if (!entry) return;
setBarShown(!entry.isIntersecting && (stickyPosition === 'bottom' || entry.boundingClientRect.top < 0));
});
io.observe(el);
return () => io.disconnect();
}, [sticky, stickyPosition, barClosed]);
const parsed = /^[0-9]+$/.test(raw) ? parseInt(raw, 10) : NaN;
const valid = parsed >= min && parsed <= max;
const showError = !valid && (touched || state === 'error');
const isDisabled = disabled || state === 'disabled';
const busy = loading && !isDisabled;
const qty = valid ? parsed : min;
const base = Number.isNaN(parsed) ? min : parsed;
const total = formatTotal(price, qty);
const actionText = fill(c.actionWithTotal, { label: actionLabel, total });
const forced = state === 'hover' ? ' is-hover' : state === 'active' ? ' is-active' : '';
const ratingValue = typeof rating === 'number' && rating > 0 ? Math.min(5, rating) : null;
const reviewsText = typeof reviewCount === 'number' ? fill(c.reviews, { count: reviewCount.toLocaleString('en-US') }) : '';
const Heading = headingLevel;
const step = (d: number) => {
setRaw(String(clampInt(base + d, min, max)));
setTouched(true);
};
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
if (isDisabled || busy) { e.preventDefault(); return; }
if (!valid) { e.preventDefault(); setTouched(true); inputRef.current?.focus(); return; }
const values = { quantity: parsed };
onSubmit?.(values);
onAction?.(values);
if (!href) e.preventDefault();
};
const onReasonsKey = (e: React.KeyboardEvent<HTMLDivElement>) => {
if (e.key === 'Escape' && open) {
e.stopPropagation();
setOpen(false);
toggleRef.current?.focus();
}
};
const closeBar = () => { setBarClosed(true); setBarShown(false); };
const onBarKey = (e: React.KeyboardEvent<HTMLDivElement>) => {
if (e.key === 'Escape') {
e.stopPropagation();
closeBar();
ctaRef.current?.focus();
}
};
return (
<section className={['cf-ecom-product-hero', className].filter(Boolean).join(' ')} aria-labelledby={id('h')}>
<style>{CSS}</style>
<div className='eph-wrap'>
<header className='eph-head'>
<div className='eph-meta eph-rise' style={delay(0)}>
<span className='eph-name'>{productName}</span>
{ratingValue !== null ? (
<span className='eph-rating'>
<span className='eph-stars' aria-hidden='true'>
<span className='eph-stars-row eph-stars-base'>{STAR_KEYS.map((k) => <Star key={k} size={18} strokeWidth={1.5} />)}</span>
<span className='eph-stars-row eph-stars-fill' style={{ width: `${(ratingValue / 5) * 100}%` }}>{STAR_KEYS.map((k) => <Star key={k} size={18} strokeWidth={1.5} />)}</span>
</span>
<span className='eph-sr'>{fill(c.ratingLabel, { rating: ratingValue.toFixed(1) })}</span>
<b aria-hidden='true'>{ratingValue.toFixed(1)}</b>
{reviewsText ? (reviewsHref ? <a className='eph-link' href={reviewsHref}>{reviewsText}</a> : <span>{reviewsText}</span>) : null}
</span>
) : null}
</div>
<Heading id={id('h')} className='eph-h1 eph-rise' style={delay(1)}>{markPhrase(headline, highlight)}</Heading>
{lead ? <p className='eph-lead eph-rise' style={delay(1)}>{lead}</p> : null}
{benefits.length ? (
<ul className='eph-chips eph-rise' style={delay(2)}>
{benefits.map((b, i) => (
<li key={i} className='eph-chip'><Check size={16} strokeWidth={2.5} aria-hidden='true' />{b}</li>
))}
</ul>
) : null}
</header>
<div className='eph-grid'>
<div className='eph-stage eph-rise' style={delay(2)}>
<span className='eph-podium' aria-hidden='true' />
{productImage ? <img className='eph-product' src={productImage} alt={productImageAlt} width={720} height={720} decoding='async' /> : null}
</div>
{notes.length ? (
<ul className='eph-notes'>
{notes.map((n, i) => (
<li key={i} className={`eph-note eph-rise${n.image ? ' eph-note--img' : ''}`} style={delay(3 + i)}>
{n.image ? <img className='eph-note-thumb' src={n.image} alt={n.imageAlt || n.name} width={144} height={144} decoding='async' /> : null}
<p className='eph-note-name'>{n.name}</p>
{n.detail ? <p className='eph-note-detail'>{n.detail}</p> : null}
{n.value ? <p className='eph-note-value'>{fill(c.valueLabel, { value: n.value })}</p> : null}
</li>
))}
</ul>
) : null}
<div className='eph-buy eph-rise' style={delay(3)} ref={buyRef}>
<form ref={formRef} className='eph-form' noValidate onSubmit={handleSubmit} action={href} method={href ? 'get' : undefined} aria-label={fill(c.formLabel, { product: productName })}>
<div className='eph-price'>
<p className='eph-price-line'><span className='eph-price-num'>{price}</span> <span className='eph-price-suffix'>{c.todaySuffix}</span></p>
{compareAtPrice || priceNote ? (
<p className='eph-price-sub'>
{compareAtPrice ? <span className='eph-compare'>{c.compareAt} <s>{compareAtPrice}</s></span> : null}
{priceNote ? <span className='eph-price-note'>{priceNote}</span> : null}
</p>
) : null}
</div>
{reasons.length ? (
<div className='eph-reasons' data-open={open ? 'true' : 'false'} onKeyDown={onReasonsKey}>
<button ref={toggleRef} type='button' className='eph-reasons-btn' aria-expanded={open} aria-controls={id('reasons')} onClick={() => setOpen((o) => !o)}>
<span>{fill(c.reasonsTitle, { price })}</span>
<ChevronDown className='eph-chev' size={20} strokeWidth={2.5} aria-hidden='true' />
</button>
<div id={id('reasons')} className='eph-reasons-panel' aria-hidden={open ? undefined : true}>
<div>
<ol className='eph-reasons-list'>
{reasons.map((r, i) => (
<li key={i}><span className='eph-num' aria-hidden='true'>{i + 1}</span><span>{r}</span></li>
))}
</ol>
</div>
</div>
</div>
) : null}
<div className='eph-qty-row'>
<label className='eph-qty-label' htmlFor={id('qty')}>{c.quantityLabel}</label>
<div className='eph-stepper' data-invalid={showError ? 'true' : 'false'}>
<button type='button' className='eph-step' aria-label={c.decrease} onClick={() => step(-1)} disabled={isDisabled || base <= min}>
<Minus size={18} strokeWidth={2.5} aria-hidden='true' />
</button>
<input
ref={inputRef}
id={id('qty')}
className='eph-qty-input'
name='quantity'
type='text'
inputMode='numeric'
pattern='[0-9]*'
autoComplete='off'
placeholder={c.quantityPlaceholder}
value={raw}
disabled={isDisabled}
aria-invalid={showError || undefined}
aria-describedby={showError ? id('err') : undefined}
onChange={(e) => setRaw(e.target.value.replace(/[^0-9]/g, '').slice(0, 3))}
onBlur={() => setTouched(true)}
/>
<button type='button' className='eph-step' aria-label={c.increase} onClick={() => step(1)} disabled={isDisabled || base >= max}>
<Plus size={18} strokeWidth={2.5} aria-hidden='true' />
</button>
</div>
</div>
{showError ? (
<p className='eph-error' id={id('err')} role='alert'>
<AlertCircle className='eph-inline-icon' size={16} strokeWidth={2.5} aria-hidden='true' />
{fill(c.quantityError, { min, max })}
</p>
) : null}
{instruction ? <p className='eph-instr' id={id('instr')}>{instruction}</p> : null}
<button
ref={ctaRef}
type='submit'
className={`eph-cta${forced}`}
disabled={isDisabled || busy}
aria-busy={busy || undefined}
aria-describedby={instruction ? id('instr') : undefined}
>
{busy ? (
<>
<Loader2 className='eph-spin' size={20} strokeWidth={2.5} aria-hidden='true' />
<span>{c.loading}</span>
</>
) : (
<span>{actionText}</span>
)}
</button>
<span className='eph-sr' aria-live='polite'>{fill(c.totalLive, { total })}</span>
{reassurance.length ? (
<ul className='eph-reassure'>
{reassurance.map((r, i) => {
const Icon = reassuranceIcon(r);
return <li key={i}><Icon className='eph-inline-icon' size={18} strokeWidth={2.5} aria-hidden='true' />{r}</li>;
})}
</ul>
) : null}
</form>
</div>
</div>
</div>
{sticky && !barClosed ? (
<div
className='eph-bar'
data-pos={stickyPosition}
data-shown={barShown ? 'true' : 'false'}
role='region'
aria-label={c.stickyLabel}
aria-hidden={barShown ? undefined : true}
onKeyDown={onBarKey}
>
<div className='eph-bar-in'>
{productImage ? <img className='eph-bar-thumb' src={productImage} alt='' width={88} height={88} /> : null}
<p className='eph-bar-text'>
<span className='eph-bar-name'>{productName}</span>
<span className='eph-bar-price'>{fill(c.stickyPrice, { price })}</span>
</p>
<button type='button' className='eph-cta eph-cta--bar' disabled={isDisabled || busy} tabIndex={barShown ? undefined : -1} onClick={() => formRef.current?.requestSubmit()}>
{actionText}
</button>
<button type='button' className='eph-bar-x' aria-label={c.stickyHide} tabIndex={barShown ? undefined : -1} onClick={closeBar}>
<X size={20} strokeWidth={2.5} aria-hidden='true' />
</button>
</div>
</div>
) : null}
</section>
);
}
export default EcomProductHero;
const DEFAULT_COPY: EcomProductHeroCopy = {
ratingLabel: 'Rated {rating} out of 5',
reviews: '{count} reviews',
todaySuffix: 'today. That’s it.',
compareAt: 'Valued at',
reasonsTitle: 'Three reasons this is {price} today',
quantityLabel: 'Quantity',
decrease: 'Decrease quantity',
increase: 'Increase quantity',
quantityPlaceholder: '1',
quantityError: 'Choose a quantity from {min} to {max}.',
actionWithTotal: '{label} · {total}',
loading: 'Adding to cart…',
totalLive: 'Total: {total}',
valueLabel: '{value} value',
formLabel: 'Order {product}',
stickyLabel: 'Quick buy',
stickyPrice: '{price} today',
stickyHide: 'Hide the quick-buy bar',
};
const DEFAULT_NOTES: EcomProductHeroNote[] = [
{ name: 'Funnel Planning Guide', detail: 'Map your offer and the pages your funnel needs.' },
{ name: 'Page Copy Workbook', detail: 'Draft your headline, offer, and call to action.' },
{ name: 'Launch Checklist', detail: 'Review the links, forms, and next steps before launch.' },
];
const DEFAULT_REASONS = [
'The guide, workbook, and checklist come in one download.',
'One payment. Yours to keep.',
'Every order is backed by a 30-day money-back guarantee.',
];
const STAR_KEYS = [0, 1, 2, 3, 4];
/** Stagger index for the rise animation. */
function delay(i: number): React.CSSProperties {
return { '--i': i } as React.CSSProperties;
}
/** Replaces {name} placeholders in a copy template. */
function fill(template: string, values: Record<string, string | number>): string {
return template.replace(/[{]([a-zA-Z]+)[}]/g, (match, key: string) => (key in values ? String(values[key]) : match));
}
function clampInt(n: number, lo: number, hi: number): number {
const v = Number.isFinite(n) ? Math.round(n) : lo;
return Math.min(hi, Math.max(lo, v));
}
/** Multiplies a formatted price string, keeping its prefix, suffix and decimals. */
function formatTotal(price: string, qty: number): string {
const m = price.match(/^([^0-9]*)([0-9][0-9,]*)([.][0-9]+)?(.*)$/);
if (!m) return price;
const whole = m[2] ?? '0';
const frac = m[3] ?? '';
const decimals = frac ? frac.length - 1 : 0;
const unit = parseFloat(whole.replace(/,/g, '') + frac);
const total = (unit * qty).toLocaleString('en-US', { minimumFractionDigits: decimals, maximumFractionDigits: decimals });
return `${m[1] ?? ''}${total}${m[4] ?? ''}`;
}
function markPhrase(text: React.ReactNode, phrase?: string): React.ReactNode {
if (typeof text !== 'string' || !phrase) return text;
const at = text.indexOf(phrase);
if (at < 0) return text;
// Glue short words ("a", "to", "the") to the next word so the marker never strands one on its own line.
const kept = phrase.replace(/(^|\s)(\S{1,3}) /g, '$1$2\u00a0');
return (
<>
{text.slice(0, at)}
<span className='eph-mark'>{kept}</span>
{text.slice(at + phrase.length)}
</>
);
}
function reassuranceIcon(text: string): LucideIcon {
const t = text.toLowerCase();
if (/guarantee|refund|money/.test(t)) return ShieldCheck;
if (/ship|deliver/.test(t)) return Truck;
if (/secure|checkout|encrypt/.test(t)) return Lock;
if (/access|download|instant|digital/.test(t)) return Download;
return Check;
}
const R = '.cf-ecom-product-hero';
const CSS = `
${R}{position:relative;background:var(--surface,#fff);color:var(--ink,#101828);font-family:var(--font-body,system-ui,sans-serif);font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) clamp(64px,8.5vw,120px);overflow-x:clip}
${R} *,${R} *::before,${R} *::after{box-sizing:border-box}
${R} :where(p,h1,h2,ul,ol){margin:0}
${R} :where(ul,ol){padding:0;list-style:none}
${R} .eph-wrap{max-width:1200px;margin:0 auto}
${R} .eph-head{max-width:56rem;margin:0 auto;text-align:center}
${R} .eph-meta{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:8px 16px;margin-bottom:16px}
${R} .eph-name{font-family:var(--font-display,inherit);font-weight:800;letter-spacing:-0.005em;color:var(--ink,#101828)}
${R} .eph-rating{display:inline-flex;flex-wrap:wrap;align-items:center;gap:4px 8px;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted,#475467)}
${R} .eph-rating b{font-weight:800;color:var(--ink,#101828);font-variant-numeric:tabular-nums}
${R} .eph-stars{position:relative;display:inline-block;line-height:0}
${R} .eph-stars-row{display:inline-flex;white-space:nowrap}
${R} .eph-stars-base{color:oklch(from var(--ink,#101828) l c h / .22)}
${R} .eph-stars-fill{position:absolute;top:0;left:0;bottom:0;overflow:hidden;color:var(--accent-fill,var(--accent,#2563eb))}
${R} .eph-stars svg{flex:none;fill:currentColor;stroke:currentColor}
${R} .eph-link{color:var(--link,var(--accent,#2563eb));font-weight:700;text-decoration:underline;text-decoration-color:oklch(from var(--link,var(--accent,#2563eb)) l c h / .45);text-underline-offset:.18em;border-radius:4px}
${R} .eph-link:hover{color:oklch(from var(--link,var(--accent,#2563eb)) calc(l - .08) c h);text-decoration-color:currentColor}
${R} .eph-h1{font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);font-size:clamp(2.5rem,5.4vw,4.875rem);line-height:1.04;text-wrap:balance;color:var(--ink,#101828)}
${R} .eph-mark{--eph-marker:color-mix(in oklch,var(--marker,#fae37c) 85%,transparent);background:linear-gradient(transparent 46%,var(--eph-marker) 46%,var(--eph-marker) 92%,transparent 92%);border-radius:.16em .34em .22em .3em;padding:0 .08em;margin:0 -.04em;-webkit-box-decoration-break:clone;box-decoration-break:clone}
${R} .eph-lead{max-width:40rem;margin:clamp(14px,1.6vw,22px) auto 0;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--muted,#475467);text-wrap:pretty}
${R} .eph-chips{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:24px}
${R} .eph-chip{display:inline-flex;align-items:center;gap:8px;min-height:32px;padding:4px 12px;border-radius:999px;background:color-mix(in oklch,var(--ink,#101828) 6%,var(--surface,#fff));color:var(--ink,#101828);font-size:.875rem;line-height:1.2;font-weight:800}
${R} .eph-chip svg{flex:none;color:var(--success,#15803d)}
${R} .eph-grid{display:grid;grid-template-columns:minmax(0,.78fr) minmax(0,1.28fr) minmax(0,1fr);grid-template-areas:'notes stage buy';gap:clamp(24px,3.2vw,48px);align-items:start;margin-top:clamp(40px,5vw,64px)}
${R} .eph-stage{grid-area:stage;position:relative;isolation:isolate;aspect-ratio:1;border-radius:var(--card-radius,var(--radius,14px));background:var(--band,#1b2a4a);box-shadow:inset 0 0 0 1px oklch(from var(--band-ink,#fff) l c h / .08);overflow:hidden}
${R} .eph-stage::before,${R} .eph-stage::after{content:'';position:absolute;left:50%;top:46%;aspect-ratio:1;border-radius:50%;transform:translate(-50%,-50%);z-index:-1}
${R} .eph-stage::before{width:84%;background:oklch(from var(--band,#1b2a4a) calc(l + .05) c h)}
${R} .eph-stage::after{width:60%;background:oklch(from var(--band,#1b2a4a) calc(l + .09) c h)}
${R} .eph-podium{position:absolute;left:50%;bottom:9%;width:66%;height:13%;transform:translateX(-50%);border-radius:50%;background:linear-gradient(oklch(from var(--band,#1b2a4a) calc(l + .17) c h),oklch(from var(--band,#1b2a4a) calc(l + .08) c h));box-shadow:inset 0 2px 0 oklch(from var(--band,#1b2a4a) calc(l + .26) c h / .7),0 2px 3px oklch(from var(--shadow,oklch(.22 .03 260)) calc(l - .06) c h / .5),0 14px 20px -8px oklch(from var(--shadow,oklch(.22 .03 260)) calc(l - .06) c h / .6)}
${R} .eph-product{position:absolute;z-index:1;left:12%;top:7%;width:76%;height:78%;object-fit:contain;object-position:50% 100%;filter:drop-shadow(0 2px 3px oklch(from var(--shadow,oklch(.22 .03 260)) l c h / .4)) drop-shadow(0 16px 18px oklch(from var(--shadow,oklch(.22 .03 260)) l c h / .32));transition:transform .3s cubic-bezier(.2,.7,.2,1)}
@media (hover:hover){${R} .eph-stage:hover .eph-product{transform:translateY(-6px)}}
${R} .eph-notes{grid-area:notes;display:grid;align-content:start;gap:clamp(20px,2.4vw,28px)}
${R} .eph-note{display:grid;align-content:start;gap:4px}
${R} .eph-note--img{grid-template-columns:64px minmax(0,1fr);column-gap:16px;align-items:start}
${R} .eph-note--img > p{grid-column:2}
${R} .eph-note-thumb{grid-row:1 / span 3;display:block;width:64px;height:64px;object-fit:cover;border-radius:8px}
${R} .eph-note-name{font-family:var(--font-display,inherit);font-weight:800;line-height:1.25;letter-spacing:-0.005em;text-wrap:balance}
${R} .eph-note-detail{font-size:.9375rem;line-height:1.4;color:var(--muted,#475467);text-wrap:pretty}
${R} .eph-note-value{justify-self:start;display:inline-flex;align-items:center;min-height:28px;margin-top:4px;padding:4px 12px;border-radius:999px;background:color-mix(in oklch,var(--ink,#101828) 6%,var(--surface,#fff));color:var(--ink,#101828);font-size:.875rem;line-height:1.2;font-weight:800;font-variant-numeric:tabular-nums}
${R} .eph-buy{grid-area:buy;background:var(--card,#fff);color:var(--ink,#101828);border:1px solid var(--card-border,color-mix(in oklch,var(--ink,#101828) 12%,transparent));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(.22 .03 260 / .22),0 12px 24px -8px oklch(.22 .03 260 / .32)));padding:clamp(20px,3vw,32px)}
${R} .eph-price-line{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 12px;font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);color:var(--ink,#101828)}
${R} .eph-price-num{font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums}
${R} .eph-price-suffix{font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-0.01em}
${R} .eph-price-sub{display:grid;gap:2px;margin-top:12px;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted,#475467)}
${R} .eph-price-note{text-wrap:pretty}
${R} .eph-compare{white-space:nowrap}
${R} .eph-price-sub s{text-decoration-color:var(--danger,#b42318);text-decoration-thickness:2px;font-variant-numeric:tabular-nums}
${R} .eph-reasons{margin-top:20px;border-radius:10px;background:color-mix(in oklch,var(--ink,#101828) 4%,var(--card,#fff))}
${R} .eph-reasons-btn{--eph-rb-hover-bg:var(--button-2-bg,var(--secondary,color-mix(in oklch,var(--ink,#101828) 8%,var(--card,#fff))));--eph-rb-hover-ink:var(--button-2-ink,var(--secondary-ink,var(--ink,#101828)));appearance:none;width:100%;display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:52px;padding:12px 16px;border:0;border-radius:10px;background:transparent;color:var(--ink,#101828);font:inherit;font-size:1rem;font-weight:700;line-height:1.3;text-align:left;text-wrap:balance;cursor:pointer;transition:background .16s ease,color .16s ease}
${R} .eph-reasons-btn:hover{background:var(--eph-rb-hover-bg);color:var(--eph-rb-hover-ink)}
${R} .eph-chev{flex:none;transition:transform .2s ease}
${R} .eph-reasons[data-open=true] .eph-chev{transform:rotate(180deg)}
${R} .eph-reasons-panel{display:grid;grid-template-rows:0fr;visibility:hidden;transition:grid-template-rows .3s cubic-bezier(.2,.7,.2,1),visibility 0s linear .3s}
${R} .eph-reasons[data-open=true] .eph-reasons-panel{grid-template-rows:1fr;visibility:visible;transition:grid-template-rows .3s cubic-bezier(.2,.7,.2,1),visibility 0s}
${R} .eph-reasons-panel > div{min-height:0;overflow:hidden}
${R} .eph-reasons-list{display:grid;gap:12px;padding:0 16px 16px}
${R} .eph-reasons-list li{display:grid;grid-template-columns:24px minmax(0,1fr);gap:10px;align-items:baseline;font-size:.9375rem;line-height:1.4;text-wrap:pretty}
${R} .eph-num{font-family:var(--font-display,inherit);font-weight:800;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1;color:var(--accent,#2563eb);font-variant-numeric:tabular-nums}
${R} .eph-instr{margin-top:20px;text-align:center;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--ink,#101828);text-wrap:pretty}
${R} .eph-qty-row{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px 16px;margin-top:20px}
${R} .eph-qty-label{font-size:1rem;font-weight:700;color:var(--label-ink,var(--ink,#101828))}
${R} .eph-stepper{display:inline-flex;align-items:center;gap:4px;height:56px;padding:5px;border:1px solid var(--field-border,color-mix(in oklch,var(--ink,#101828) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));background:var(--field,#fff);color:var(--field-ink,#101828);transition:border-color .16s ease,box-shadow .16s ease}
${R} .eph-stepper:focus-within{border-color:var(--field-focus,var(--accent,#2563eb));box-shadow:0 0 0 3px oklch(from var(--field-focus,var(--accent,#2563eb)) l c h / .35)}
${R} .eph-stepper[data-invalid=true]{border-color:var(--danger,#b42318)}
${R} .eph-stepper[data-invalid=true]:focus-within{box-shadow:0 0 0 3px oklch(from var(--danger,#b42318) l c h / .3)}
${R} .eph-step{appearance:none;display:inline-grid;place-items:center;width:44px;height:44px;padding:0;border:1px solid var(--button-2-border,transparent);border-radius:max(4px,calc(var(--field-radius,var(--radius,12px)) - 5px));background:var(--button-2-bg,var(--secondary,#eef1f6));color:var(--button-2-ink,var(--secondary-ink,#101828));box-shadow:var(--button-2-shadow,var(--shadow-sm,0 1px 2px oklch(from var(--shadow,oklch(.22 .03 260)) l c h / .25)));cursor:pointer;transition:background .16s ease,transform .16s ease,box-shadow .16s ease}
${R} .eph-step:hover:not(:disabled){background:oklch(from var(--button-2-bg,var(--secondary,#eef1f6)) calc(l - .04) c h)}
${R} .eph-step:active:not(:disabled){transform:translateY(1px);box-shadow:inset 0 1px 2px oklch(from var(--button-2-bg,var(--secondary,#eef1f6)) calc(l - .18) c h / .6)}
${R} .eph-step:disabled{cursor:not-allowed;opacity:.45}
${R} .eph-qty-input{width:56px;height:44px;padding:0;border:0;background:var(--field,#fff);color:var(--field-ink,#101828);text-align:center;font:inherit;font-size:1.0625rem;font-weight:800;font-variant-numeric:tabular-nums;outline:none}
${R} .eph-qty-input::placeholder{color:color-mix(in oklch,var(--field-ink,#101828) 65%,var(--field,#fff));opacity:1}
${R} .eph-qty-input:disabled{cursor:not-allowed;color:color-mix(in oklch,var(--field-ink,#101828) 65%,var(--field,#fff))}
${R} .eph-error{margin-top:8px;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--danger,#b42318);text-wrap:pretty}
${R} .eph-inline-icon{display:inline-block;vertical-align:-0.15em;margin-inline-end:.4em}
${R} .eph-cta{--eph-b:var(--button-bg,var(--cta,#d63a2f));--eph-b2:var(--button-bg-2,var(--cta-2,#b52e24));--eph-sh:var(--shadow,oklch(.22 .03 260));appearance:none;margin:0;border:0;cursor:pointer;display:inline-flex;align-items:center;justify-content:center;gap:10px;min-height:64px;padding:0 28px;border-radius:var(--button-radius,var(--radius,12px));font-family:var(--button-font,var(--font-display,inherit));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;letter-spacing:-0.005em;white-space:nowrap;color:var(--button-ink,var(--cta-ink,#fff));text-shadow:var(--button-text-shadow,none);background:linear-gradient(oklch(from var(--eph-b) calc(l + .04) c h),oklch(from var(--eph-b2) calc(l - .02) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--eph-b) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--eph-b) calc(l - .16) c h),0 1px 2px oklch(from var(--eph-sh) l c h / .3),0 8px 16px -6px oklch(from var(--eph-sh) l c h / .45));transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
${R} .eph-buy .eph-cta{width:100%;margin-top:12px}
${R} .eph-qty-row + .eph-cta,${R} .eph-error + .eph-cta{margin-top:20px}
${R} .eph-cta:hover:not(:disabled),${R} .eph-cta.is-hover:not(:disabled){background:linear-gradient(oklch(from var(--eph-b) calc(l - .01) c h),oklch(from var(--eph-b2) calc(l - .07) c h));transform:translateY(-1px);box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--eph-b) calc(l + .12) c h / .65),inset 0 -3px 0 oklch(from var(--eph-b) calc(l - .2) c h),0 2px 3px oklch(from var(--eph-sh) l c h / .32),0 12px 20px -8px oklch(from var(--eph-sh) l c h / .5))}
${R} .eph-cta:active:not(:disabled),${R} .eph-cta.is-active:not(:disabled){transform:translateY(1px);background:linear-gradient(oklch(from var(--eph-b) calc(l - .05) c h),oklch(from var(--eph-b2) calc(l - .06) c h));box-shadow:inset 0 2px 4px oklch(from var(--eph-b) calc(l - .22) c h / .55),inset 0 -2px 0 oklch(from var(--eph-b) calc(l - .16) c h),0 1px 2px oklch(from var(--eph-sh) l c h / .3)}
${R} .eph-cta:focus-visible{outline:3px solid var(--field-focus,var(--accent,#2563eb));outline-offset:3px}
${R} .eph-cta:disabled:not([aria-busy=true]){cursor:not-allowed;background:var(--secondary,#e9edf3);color:var(--secondary-ink,#344054);text-shadow:none;transform:none;box-shadow:inset 0 -2px 0 oklch(from var(--secondary,#e9edf3) calc(l - .08) c h)}
${R} .eph-cta[aria-busy=true]{cursor:progress}
${R} :is(.eph-reasons-btn,.eph-step,.eph-bar-x,.eph-link):focus-visible{outline:3px solid var(--field-focus,var(--accent,#2563eb));outline-offset:2px}
${R} .eph-reassure{display:grid;gap:8px;margin-top:16px}
${R} .eph-reassure li{font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted,#475467);text-wrap:pretty}
${R} .eph-reassure svg{color:var(--success,#15803d)}
${R} .eph-sr{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
${R} .eph-bar{position:fixed;left:0;right:0;top:0;z-index:60;background:var(--card,#fff);color:var(--ink,#101828);border-bottom:1px solid var(--card-border,oklch(from var(--ink,#101828) l c h / .12));box-shadow:0 1px 2px oklch(from var(--shadow,oklch(.22 .03 260)) l c h / .2),0 6px 14px -6px oklch(from var(--shadow,oklch(.22 .03 260)) l c h / .3);transform:translateY(-110%);visibility:hidden;transition:transform .28s cubic-bezier(.2,.7,.2,1),visibility 0s linear .28s}
${R} .eph-bar[data-pos=bottom]{top:auto;bottom:0;border-bottom:0;box-shadow:0 -1px 2px oklch(from var(--shadow,oklch(.22 .03 260)) l c h / .2),0 -6px 14px -6px oklch(from var(--shadow,oklch(.22 .03 260)) l c h / .3);transform:translateY(110%)}
${R} .eph-bar[data-shown=true]{transform:none;visibility:visible;transition:transform .28s cubic-bezier(.2,.7,.2,1),visibility 0s}
${R} .eph-bar-in{max-width:1200px;margin:0 auto;display:flex;align-items:center;gap:12px;padding:10px clamp(16px,5vw,48px)}
${R} .eph-bar[data-pos=bottom] .eph-bar-in{padding-bottom:calc(10px + env(safe-area-inset-bottom,0px))}
${R} .eph-bar-thumb{flex:none;width:44px;height:44px;object-fit:contain;filter:drop-shadow(0 1px 2px oklch(from var(--shadow,oklch(.22 .03 260)) l c h / .3))}
${R} .eph-bar-text{flex:1;min-width:0;display:grid;line-height:1.25}
${R} .eph-bar-name{font-family:var(--font-display,inherit);font-weight:800;font-size:1.0625rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
${R} .eph-bar-price{font-size:.9375rem;font-weight:600;color:var(--muted,#475467)}
${R} .eph-cta.eph-cta--bar{flex:none;width:auto;min-height:48px;padding:0 20px;font-size:1.0625rem}
${R} .eph-bar-x{--eph-x-hover-bg:var(--button-2-bg,var(--secondary,color-mix(in oklch,var(--ink,#101828) 7%,var(--card,#fff))));--eph-x-hover-ink:var(--button-2-ink,var(--secondary-ink,var(--ink,#101828)));appearance:none;flex:none;display:inline-grid;place-items:center;width:40px;height:40px;padding:0;border:0;border-radius:999px;background:transparent;color:var(--muted,#475467);cursor:pointer;transition:background .16s ease,color .16s ease}
${R} .eph-bar-x:hover{background:var(--eph-x-hover-bg);color:var(--eph-x-hover-ink)}
@keyframes eph-rise{from{opacity:.82;transform:translateY(8px)}}
@keyframes eph-spin{to{transform:rotate(360deg)}}
${R} .eph-rise{animation:eph-rise .45s cubic-bezier(.2,.7,.2,1) both;animation-delay:min(calc(var(--i,0) * .07s),.28s)}
${R} .eph-spin{animation:eph-spin .8s linear infinite}
@media (max-width:1080px){
${R} .eph-grid{grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);grid-template-areas:'stage buy' 'notes notes'}
${R} .eph-notes{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media (max-width:720px){
${R} .eph-grid{grid-template-columns:minmax(0,1fr);grid-template-areas:'stage' 'buy' 'notes'}
${R} .eph-stage{aspect-ratio:1/.92}
${R} .eph-notes{grid-template-columns:minmax(0,1fr);gap:20px}
${R} .eph-note--img{grid-template-columns:56px minmax(0,1fr)}
${R} .eph-note--img .eph-note-thumb{width:56px;height:56px}
}
@media (max-width:520px){
${R} .eph-bar-thumb{display:none}
${R} .eph-bar-in{gap:8px}
}
@media (prefers-reduced-motion:reduce){
${R} .eph-rise,${R} .eph-spin{animation:none}
${R} *,${R} *::before,${R} *::after{transition:none}
${R} .eph-stage:hover .eph-product{transform:none}
${R} .eph-cta:hover:not(:disabled),${R} .eph-cta.is-hover:not(:disabled){transform:none}
}
`;
pieces/hero/ecom-product-hero/specimen.tsx 46 lines
import __studioImage7c3748c8 from "../assets/68e2be8785d83407.webp";
import { EcomProductHero, type EcomProductHeroProps } from '../ecom-product-hero';
import defaults from '../../studio-defaults.json';
import { slot } from '../../slots';
const sample = defaults.sample;
export const states = ['default', 'hover', 'active', 'disabled', 'error'];
type SpecimenState = NonNullable<EcomProductHeroProps['state']>;
export default function EcomProductHeroSpecimen({ state = 'default' }: { state?: SpecimenState }) {
return (
<EcomProductHero
state={state}
productName={sample.name}
headline={sample.headline}
highlight='a clear plan'
lead={sample.lead}
productImage={slot('product', __studioImage7c3748c8)}
productImageAlt={`${sample.name}: the planning guide, page copy workbook and launch checklist`}
rating={4.8}
reviewCount={312}
benefits={['Plan your funnel', 'Write your page copy', 'Check every step']}
notes={sample.items.map((item, i) => ({
name: item.name,
detail: item.detail,
value: item.value,
image: slot(`item-${i + 1}`, item.image),
imageAlt: item.imageAlt,
}))}
price={sample.price}
compareAtPrice={sample.regularPrice}
priceNote={sample.note}
reasons={[
'The guide, workbook, and checklist come in one download.',
'One payment. Yours to keep.',
`Every order is backed by a ${sample.guarantee}.`,
]}
instruction='Click the button below to get instant access.'
actionLabel='Add to cart'
reassurance={sample.reassurance}
sticky
/>
);
}
| Name | Type | Details |
|---|---|---|
productName OptionalEcomProductHero |
string |
|
headline OptionalEcomProductHero |
React.ReactNode |
|
highlight OptionalEcomProductHero |
string |
|
lead OptionalEcomProductHero |
React.ReactNode |
|
productImage OptionalEcomProductHero |
string |
|
productImageAlt OptionalEcomProductHero |
string |
|
rating OptionalEcomProductHero |
number |
|
reviewCount OptionalEcomProductHero |
number |
|
reviewsHref OptionalEcomProductHero |
string |
|
benefits OptionalEcomProductHero |
string[] |
|
notes OptionalEcomProductHero |
EcomProductHeroNote[] |
|
price OptionalEcomProductHero |
string |
|
compareAtPrice OptionalEcomProductHero |
string |
|
priceNote OptionalEcomProductHero |
string |
|
reasons OptionalEcomProductHero |
string[] |
|
instruction OptionalEcomProductHero |
string |
|
actionLabel OptionalEcomProductHero |
string |
|
reassurance OptionalEcomProductHero |
string[] |
|
defaultQuantity OptionalEcomProductHero |
number |
|
maxQuantity OptionalEcomProductHero |
number |
|
sticky OptionalEcomProductHero |
boolean |
|
stickyPosition OptionalEcomProductHero |
'top' | 'bottom' |
|
headingLevel OptionalEcomProductHero |
'h1' | 'h2' |
|
href OptionalEcomProductHero |
string |
|
onSubmit OptionalEcomProductHero |
(values: EcomProductHeroValues) => void |
|
onAction OptionalEcomProductHero |
(values: EcomProductHeroValues) => void |
|
loading OptionalEcomProductHero |
boolean |
|
disabled OptionalEcomProductHero |
boolean |
|
state OptionalEcomProductHero |
'default' | 'hover' | 'active' | 'disabled' | 'error' |
|
copy OptionalEcomProductHero |
Partial<EcomProductHeroCopy> |
|
className OptionalEcomProductHero |
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--field-border--field-focus--field-ink--field-radius- Form inputs: background, ink, border, radius and focus colour.
--marker- The highlighter colour behind key phrases.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
item-*- One image per offer item (item-1, item-2…), shown in stacks and lists.
product- The main product shot or cover (ebook, kit, bottle).
-
68e2be8785d83407.webp
image/webp · 163 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB