Daily Deal 3
Daily deal price-drop ladder: the product photo fills a dark half, and the light half steps the supplied price history down
Use it in a prompt
Use offer/daily-deal-3 from the FunnelDNA library. Follow the skill and theme contract. Ask me for the copy, images, and brand details you need; do not invent proof.
Paste into Claude or ChatGPT with FunnelDNA connected (MCP setup), or alongside the skill.
Use it in code
- Save
component.tsx(Code tab) ascomponents/funneldna/offer/daily-deal-3.tsx. - Import it and pass your copy and images (Props tab):
import { DailyDeal3 } from "@/components/funneldna/offer/daily-deal-3"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/daily-deal-3/component.tsx 596 lines
// layout: split-contrast
// Daily deal price-drop ladder: the product photo fills a dark half, and the light half steps the supplied price history down
// rung by rung to today's price (a receipt-style ladder) with the computed saving, real stock, the countdown and one buy button.
import * as React from 'react';
import { Clock, Package, ShieldCheck } from 'lucide-react';
import { Divider, FX_HOST } from '../fx/fx';
export type DailyDeal3Step = {
/** Row label for this step, e.g. 'Spring sale' or 'Last week'. */
label: string;
/** The price on that step, as a number in the currency below. */
amount: number;
};
export type DailyDeal3Copy = {
regularLabel: string;
todayLabel: string;
/** Saving sentence with {amount} and {percent}; the part inside [[ ]] gets the marker stroke. */
saving: string;
/** Drop shown on each rung, with {amount}. */
dropBy: string;
/** Screen-reader word before a struck price. */
was: string;
/** Accessible name of the ladder list. */
ladderLabel: string;
endsIn: string;
/** With {time}, the end time in the offer's time zone. */
endsAt: string;
ended: string;
/** With {time}. */
endedAt: string;
days: string;
hours: string;
minutes: string;
seconds: string;
/** Accessible timer text with {days} {hours} {minutes} {seconds}. */
timerLabel: string;
/** Stock line with {left} and {total}. */
stock: string;
/** Stock line with {left} when no total is supplied. */
stockOnly: string;
soldOut: string;
/** Button label used when the label needs {price} and no price is supplied. */
labelNoPrice: string;
endedLabel: string;
soldOutLabel: string;
};
export type DailyDeal3Props = {
headline?: string;
lead?: string;
/** Product photo (product slot). It fills the dark half; the headline sits over its upper part. */
productImage?: string;
productImageAlt?: string;
/** cover suits a styled photo; contain suits a transparent cut-out. */
imageFit?: 'cover' | 'contain';
/** Focal point of the photo (CSS object-position). Keep the product low in the frame. */
imagePosition?: string;
/** Supplied regular price. It is the top rung, struck. */
regularPrice?: number;
/** Supplied price steps between the regular price and today, oldest first. */
history?: DailyDeal3Step[];
/** Today's deal price: the large bottom rung. */
price?: number;
/** ISO 4217 code, e.g. USD. */
currency?: string;
locale?: string;
/** Supplied end time, ISO 8601 with offset. Omit it and no countdown shows. */
endsAt?: string;
/** IANA time zone the end time is shown in, e.g. America/Los_Angeles. */
timeZone?: string;
/** Supplied stock left at the deal price. Omit it and no stock meter shows. */
stockLeft?: number;
stockTotal?: number;
/** Supplied reassurance under today's price, e.g. the guarantee. */
assurance?: string;
/** Button label; {price} becomes today's price. */
label?: string;
/** One plain line under the button. */
secondaryLabel?: string;
secondaryHref?: string;
href?: string;
onAction?: (event: React.MouseEvent<HTMLElement>) => void;
/** disabled previews the ended deal. */
state?: 'default' | 'hover' | 'active' | 'disabled';
className?: string;
copy?: Partial<DailyDeal3Copy>;
};
const DEFAULT_COPY: DailyDeal3Copy = {
regularLabel: 'Regular price',
todayLabel: 'Today',
saving: 'That’s [[{amount} off]] the regular price, {percent}% less.',
dropBy: 'Down {amount}',
was: 'Was',
ladderLabel: 'How the price came down',
endsIn: 'Today’s price ends in',
endsAt: 'Ends {time}',
ended: 'This deal has ended',
endedAt: 'Ended {time}',
days: 'days',
hours: 'hrs',
minutes: 'min',
seconds: 'sec',
timerLabel: '{days} days, {hours} hours, {minutes} minutes and {seconds} seconds left at today’s price',
stock: '{left} of {total} left at this price',
stockOnly: '{left} left at this price',
soldOut: 'None left at this price',
labelNoPrice: 'Get today’s deal',
endedLabel: 'This deal has ended',
soldOutLabel: 'Sold out at this price',
};
const useIsoLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
export function DailyDeal3(props: DailyDeal3Props) {
const {
headline = 'The price just dropped to today’s deal',
lead,
productImage,
productImageAlt = 'The product in today’s deal',
imageFit = 'cover',
imagePosition = '50% 78%',
regularPrice,
history = [],
price,
currency = 'USD',
locale = 'en-US',
endsAt,
timeZone,
stockLeft,
stockTotal,
assurance,
label = 'Get it for {price} today',
secondaryLabel = 'or keep reading to see what’s included',
secondaryHref,
href,
onAction,
state = 'default',
className,
} = props;
const copy = { ...DEFAULT_COPY, ...props.copy };
const titleId = React.useId() + '-title';
const money = React.useMemo(() => makeMoney(locale, currency), [locale, currency]);
const steps: DailyDeal3Step[] = [
...(isNum(regularPrice) ? [{ label: copy.regularLabel, amount: regularPrice }] : []),
...history.filter((step) => step && isNum(step.amount)),
];
const saving = isNum(price) && isNum(regularPrice) && regularPrice > price ? regularPrice - price : 0;
const percent = saving > 0 && isNum(regularPrice) ? Math.round((saving / regularPrice) * 100) : 0;
const lastStep = steps.length ? steps[steps.length - 1] : undefined;
const todayDrop = isNum(price) && lastStep && lastStep.amount > price ? lastStep.amount - price : 0;
const end = endsAt ? Date.parse(endsAt) : Number.NaN;
const hasClock = Number.isFinite(end);
const [now, setNow] = React.useState(() => Date.now());
const running = hasClock && state !== 'disabled' && now < end;
React.useEffect(() => {
if (!running) return undefined;
const id = window.setInterval(() => setNow(Date.now()), 1000);
return () => window.clearInterval(id);
}, [running]);
const ended = state === 'disabled' || (hasClock && now >= end);
const endText = hasClock ? formatEnd(end, locale, timeZone) : '';
const showAt = Boolean(endText) && (!ended || now >= end);
const parts = splitTime(running ? end - now : 0);
const units = [
...(parts.days > 0 ? [{ key: 'd', value: parts.days, label: copy.days }] : []),
{ key: 'h', value: parts.hours, label: copy.hours },
{ key: 'm', value: parts.minutes, label: copy.minutes },
{ key: 's', value: parts.seconds, label: copy.seconds },
];
const timerText = fillText(copy.timerLabel, {
days: String(parts.days),
hours: String(parts.hours),
minutes: String(parts.minutes),
seconds: String(parts.seconds),
});
const hasStock = isNum(stockLeft) && stockLeft >= 0;
const soldOut = isNum(stockLeft) && stockLeft <= 0;
const hasTotal = hasStock && isNum(stockTotal) && stockTotal > 0;
const pct = hasTotal && isNum(stockLeft) && isNum(stockTotal) ? Math.max(0, Math.min(1, stockLeft / stockTotal)) : 0;
const count = (n?: number) => (isNum(n) ? formatInt(n, locale) : '');
const closed = ended || soldOut;
const buttonLabel = ended
? copy.endedLabel
: soldOut
? copy.soldOutLabel
: isNum(price)
? label.split('{price}').join(money(price))
: label.includes('{price}')
? copy.labelNoPrice
: label;
const ladderRef = React.useRef<HTMLOListElement>(null);
const [phase, setPhase] = React.useState<'still' | 'armed' | 'drop'>('still');
useIsoLayoutEffect(() => {
const el = ladderRef.current;
if (!el || typeof window === 'undefined' || !('IntersectionObserver' in window)) return undefined;
if (window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches) return undefined;
const box = el.getBoundingClientRect();
if (box.top < window.innerHeight * 0.85 && box.bottom > 0) {
setPhase('drop');
return undefined;
}
setPhase('armed');
const io = new IntersectionObserver(
(entries) => {
if (entries.some((entry) => entry.isIntersecting)) {
setPhase('drop');
io.disconnect();
}
},
{ threshold: 0.35 },
);
io.observe(el);
return () => io.disconnect();
}, []);
const buttonClass = ['cf-ddl-btn', state === 'hover' ? 'is-hover' : '', state === 'active' ? 'is-active' : '']
.filter(Boolean)
.join(' ');
const struck = isNum(price);
return (
<section className={['cf-ddl', className].filter(Boolean).join(' ')} aria-labelledby={titleId}>
<style>{CSS}</style>
<div className='cf-ddl-grid'>
<div className={'cf-ddl-stage' + (productImage ? '' : ' no-photo')} style={FX_HOST}>
{productImage ? (
<img
className='cf-ddl-photo'
src={productImage}
alt={productImageAlt}
style={{ objectFit: imageFit, objectPosition: imagePosition }}
/>
) : null}
<div className='cf-ddl-story'>
<div className='cf-ddl-story-in'>
<h2 id={titleId} className='cf-ddl-h'>
{headline}
</h2>
{lead ? <p className='cf-ddl-lead'>{lead}</p> : null}
</div>
</div>
<div className='cf-ddl-view' aria-hidden='true' />
<div className='cf-ddl-edge' aria-hidden='true'>
<Divider shape='angle' tone='surface' height={56} />
</div>
</div>
<div className='cf-ddl-deal'>
<div className='cf-ddl-deal-in'>
{hasClock ? (
<div className='cf-ddl-clock'>
{ended ? (
<p className='cf-ddl-clock-head is-ended'>
<Clock className='cf-ddl-ico' size={18} strokeWidth={2.5} aria-hidden='true' />
{copy.ended}
</p>
) : (
<div className='cf-ddl-clock-row'>
<p className='cf-ddl-clock-head'>
<Clock className='cf-ddl-ico' size={18} strokeWidth={2.5} aria-hidden='true' />
{copy.endsIn}
</p>
<div className='cf-ddl-digits' role='timer' aria-label={timerText}>
{units.map((unit) => (
<span key={unit.key} className='cf-ddl-unit' aria-hidden='true'>
<b>{pad(unit.value)}</b>
<small>{unit.label}</small>
</span>
))}
</div>
</div>
)}
{showAt ? (
<p className='cf-ddl-clock-at'>{fillText(ended ? copy.endedAt : copy.endsAt, { time: endText })}</p>
) : null}
</div>
) : null}
{steps.length || isNum(price) ? (
<div className='cf-ddl-card'>
<ol
ref={ladderRef}
className={'cf-ddl-rungs' + (phase === 'still' ? '' : ' is-' + phase)}
aria-label={copy.ladderLabel}
>
{steps.map((step, i) => {
const prev = i > 0 ? steps[i - 1].amount : undefined;
const drop = isNum(prev) && prev > step.amount ? prev - step.amount : 0;
return (
<li key={i} className='cf-ddl-rung' style={{ '--i': i } as React.CSSProperties}>
<span className='cf-ddl-node' aria-hidden='true' />
<span className='cf-ddl-rung-text'>
<span className='cf-ddl-rung-label'>{step.label}</span>
{drop > 0 ? (
<span className='cf-ddl-rung-drop'>{fillText(copy.dropBy, { amount: money(drop) })}</span>
) : null}
</span>
{struck ? (
<s className='cf-ddl-was'>
<span className='cf-ddl-sr'>{copy.was} </span>
<span className='cf-ddl-strike'>{money(step.amount)}</span>
</s>
) : (
<span className='cf-ddl-was'>{money(step.amount)}</span>
)}
</li>
);
})}
{isNum(price) ? (
<li className='cf-ddl-rung is-today' style={{ '--i': steps.length } as React.CSSProperties}>
<span className='cf-ddl-node' aria-hidden='true' />
<span className='cf-ddl-rung-text'>
<span className='cf-ddl-today-label'>{copy.todayLabel}</span>
{todayDrop > 0 ? (
<span className='cf-ddl-rung-drop'>{fillText(copy.dropBy, { amount: money(todayDrop) })}</span>
) : null}
</span>
<strong className='cf-ddl-now'>{money(price)}</strong>
{saving > 0 ? (
<p className='cf-ddl-saving'>
{rich(copy.saving, { amount: money(saving), percent: String(percent) })}
</p>
) : null}
</li>
) : null}
</ol>
{assurance ? (
<p className='cf-ddl-assure'>
<ShieldCheck className='cf-ddl-ico cf-ddl-ico-ok' size={18} strokeWidth={2.5} aria-hidden='true' />
{assurance}
</p>
) : null}
</div>
) : null}
{hasStock ? (
<div className={'cf-ddl-stock' + (soldOut ? ' is-out' : '')}>
<p className='cf-ddl-stock-line'>
<Package className='cf-ddl-ico' size={18} strokeWidth={2.5} aria-hidden='true' />
{soldOut
? copy.soldOut
: fill(hasTotal ? copy.stock : copy.stockOnly, {
left: <strong>{count(stockLeft)}</strong>,
total: count(stockTotal),
})}
</p>
{hasTotal && !soldOut ? (
<div className='cf-ddl-meter' aria-hidden='true'>
<span style={{ width: pct * 100 + '%' }} />
</div>
) : null}
</div>
) : null}
<div className='cf-ddl-act'>
{href && !closed ? (
<a className={buttonClass} href={href} onClick={onAction}>
{buttonLabel}
</a>
) : (
<button type='button' className={buttonClass} disabled={closed} onClick={onAction}>
{buttonLabel}
</button>
)}
{secondaryLabel ? (
<p className='cf-ddl-quiet'>
{secondaryHref ? <a href={secondaryHref}>{secondaryLabel}</a> : secondaryLabel}
</p>
) : null}
</div>
</div>
</div>
</div>
</section>
);
}
export default DailyDeal3;
function isNum(n: unknown): n is number {
return typeof n === 'number' && Number.isFinite(n);
}
function pad(n: number) {
return String(n).padStart(2, '0');
}
function splitTime(ms: number) {
const t = Math.max(0, Math.floor(ms / 1000));
return {
days: Math.floor(t / 86400),
hours: Math.floor((t % 86400) / 3600),
minutes: Math.floor((t % 3600) / 60),
seconds: t % 60,
};
}
function makeMoney(locale: string, currency: string) {
const cache: Record<string, Intl.NumberFormat> = {};
return (value: number) => {
const n = Math.round(value * 100) / 100;
const whole = Math.abs(n % 1) < 0.005;
const key = whole ? 'w' : 'f';
try {
cache[key] =
cache[key] ||
new Intl.NumberFormat(locale, {
style: 'currency',
currency,
minimumFractionDigits: whole ? 0 : 2,
maximumFractionDigits: whole ? 0 : 2,
});
return cache[key].format(n);
} catch {
return String(n);
}
};
}
function formatInt(n: number, locale: string) {
try {
return new Intl.NumberFormat(locale).format(n);
} catch {
return String(n);
}
}
function formatEnd(ms: number, locale: string, timeZone?: string) {
try {
return new Intl.DateTimeFormat(locale, {
weekday: 'long',
hour: 'numeric',
minute: '2-digit',
timeZone,
timeZoneName: 'short',
}).format(ms);
} catch {
try {
return new Intl.DateTimeFormat(locale, { weekday: 'long', hour: 'numeric', minute: '2-digit' }).format(ms);
} catch {
return '';
}
}
}
const PLACEHOLDER = /[{]([A-Za-z]+)[}]/g;
function fillText(template: string, values: Record<string, string>) {
return template.replace(PLACEHOLDER, (match, key: string) => (key in values ? values[key] : match));
}
function fill(template: string, values: Record<string, React.ReactNode>): React.ReactNode[] {
const out: React.ReactNode[] = [];
const re = new RegExp(PLACEHOLDER.source, 'g');
let last = 0;
let k = 0;
let m: RegExpExecArray | null = re.exec(template);
while (m) {
if (m.index > last) out.push(<React.Fragment key={'t' + k++}>{template.slice(last, m.index)}</React.Fragment>);
const value = m[1] in values ? values[m[1]] : m[0];
out.push(<React.Fragment key={'v' + k++}>{value}</React.Fragment>);
last = m.index + m[0].length;
m = re.exec(template);
}
if (last < template.length) out.push(<React.Fragment key={'t' + k++}>{template.slice(last)}</React.Fragment>);
return out;
}
function rich(template: string, values: Record<string, React.ReactNode>): React.ReactNode[] {
const parts: React.ReactNode[] = [];
template.split('[[').forEach((chunk, i) => {
if (i === 0) {
parts.push(<React.Fragment key={'a' + i}>{fill(chunk, values)}</React.Fragment>);
return;
}
const close = chunk.indexOf(']]');
const marked = close >= 0 ? chunk.slice(0, close) : chunk;
const rest = close >= 0 ? chunk.slice(close + 2) : '';
parts.push(
<mark key={'m' + i} className='cf-ddl-mark'>
{fill(marked, values)}
</mark>,
);
if (rest) parts.push(<React.Fragment key={'r' + i}>{fill(rest, values)}</React.Fragment>);
});
return parts;
}
const CSS = `
.cf-ddl{position:relative;overflow:hidden;background:var(--surface);color:var(--ink);font-family:var(--font-body)}
.cf-ddl *,.cf-ddl *::before,.cf-ddl *::after{box-sizing:border-box}
.cf-ddl-grid{display:grid;grid-template-columns:minmax(0,1.08fr) minmax(0,1fr);align-items:stretch}
.cf-ddl-stage{position:relative;isolation:isolate;display:flex;flex-direction:column;overflow:hidden;background:var(--band);color:var(--band-ink)}
.cf-ddl-photo{position:absolute;inset:0;z-index:0;display:block;width:100%;height:100%}
.cf-ddl-story{position:relative;z-index:1;padding-block:clamp(56px,8vw,112px) 96px;padding-inline:max(clamp(16px,5vw,48px),calc((100vw - 1120px) / 2)) clamp(16px,5vw,48px);background:linear-gradient(to bottom,oklch(from var(--band) l c h / .9) 0%,oklch(from var(--band) l c h / .8) calc(100% - 96px),oklch(from var(--band) l c h / 0) 100%)}
.cf-ddl-stage.no-photo .cf-ddl-story{background:none;padding-bottom:clamp(96px,10vw,140px)}
.cf-ddl-story-in{max-width:34rem}
.cf-ddl-h{margin:0;font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-.025em);text-transform:var(--display-case,none);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;text-wrap:balance;color:var(--band-ink)}
.cf-ddl-lead{margin:24px 0 0;max-width:62ch;font-size:clamp(1.125rem,1.5vw,1.375rem);font-weight:500;line-height:1.45;text-wrap:pretty;color:var(--band-ink)}
.cf-ddl-view{flex:1 1 auto;min-height:clamp(300px,30vw,420px)}
.cf-ddl-stage.no-photo .cf-ddl-view{display:none}
.cf-ddl-edge{position:absolute;left:0;right:0;bottom:-1px;z-index:2;height:56px;pointer-events:none}
.cf-ddl-deal{padding-block:clamp(56px,8vw,112px) clamp(64px,8.5vw,120px);padding-inline:clamp(16px,5vw,48px) max(clamp(16px,5vw,48px),calc((100vw - 1120px) / 2))}
.cf-ddl-deal-in{display:flex;flex-direction:column;gap:24px;width:100%;max-width:30rem}
.cf-ddl-ico{display:inline-block;flex:none;vertical-align:-.15em;margin-inline-end:.4em;color:var(--accent)}
.cf-ddl-ico-ok{color:var(--success)}
.cf-ddl-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.cf-ddl-clock{display:flex;flex-direction:column;gap:8px}
.cf-ddl-clock-row{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 16px}
.cf-ddl-clock-head{margin:0;font-size:clamp(1.0625rem,1.25vw,1.125rem);font-weight:700;line-height:1.4;color:var(--ink)}
.cf-ddl-clock-head.is-ended{color:var(--danger)}
.cf-ddl-clock-head.is-ended .cf-ddl-ico{color:var(--danger)}
.cf-ddl-digits{display:flex;flex-wrap:nowrap;gap:8px}
.cf-ddl-unit{display:inline-flex;align-items:baseline;gap:4px;min-height:44px;padding:6px 12px;border-radius:10px;background:color-mix(in oklch,var(--ink) 6%,var(--surface))}
.cf-ddl-unit b{font-family:var(--font-display);font-weight:800;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.2;letter-spacing:-.02em;font-variant-numeric:tabular-nums;color:var(--ink)}
.cf-ddl-unit small{font-size:.875rem;font-weight:800;line-height:1.2;color:var(--muted)}
.cf-ddl-clock-at{margin:0;font-size:.9375rem;font-weight:500;line-height:1.4;color:var(--muted)}
.cf-ddl-card{padding:clamp(12px,2vw,20px) clamp(20px,3vw,32px) clamp(20px,3vw,28px);background:var(--card);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))}
.cf-ddl-rungs{margin:0;padding:0;list-style:none}
.cf-ddl-rung{position:relative;display:grid;grid-template-columns:16px minmax(0,1fr) auto;column-gap:16px;align-items:start;padding:14px 0}
.cf-ddl-rung+.cf-ddl-rung:not(.is-today){border-top:1px solid oklch(from var(--ink) l c h / .1)}
.cf-ddl-rung:not(:last-child)::before,.cf-ddl-rung:not(:last-child)::after{content:'';position:absolute;z-index:1;left:7px;top:27px;bottom:-27px;width:2px;border-radius:2px}
.cf-ddl-rung:not(:last-child)::before{background:oklch(from var(--ink) l c h / .14)}
.cf-ddl-rung:not(:last-child)::after{background:var(--accent-fill,var(--accent));transform-origin:top center}
.cf-ddl-node{position:relative;z-index:2;display:block;width:12px;height:12px;margin:7px 0 0 2px;border-radius:50%;background:var(--accent-fill,var(--accent))}
.cf-ddl-rung.is-today .cf-ddl-node{width:16px;height:16px;margin:5px 0 0}
.cf-ddl-rung-text{display:flex;flex-direction:column;min-width:0}
.cf-ddl-rung-label{font-size:clamp(1.0625rem,1.25vw,1.125rem);font-weight:600;line-height:26px;color:var(--ink)}
.cf-ddl-rung-drop{font-size:.9375rem;font-weight:500;line-height:1.4;color:var(--muted)}
.cf-ddl-was{justify-self:end;font-family:var(--font-display);font-weight:700;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:26px;letter-spacing:-.01em;font-variant-numeric:tabular-nums;white-space:nowrap;text-decoration:none;color:var(--muted)}
.cf-ddl-strike{position:relative;display:inline-block}
.cf-ddl-strike::after{content:'';position:absolute;left:-3px;right:-3px;top:50%;height:2px;margin-top:-1px;border-radius:2px;background:var(--danger);transform-origin:left center}
.cf-ddl-rung.is-today{margin-inline:-12px;padding:16px 12px 20px;border-radius:10px;background:color-mix(in oklch,var(--accent) 10%,var(--card))}
.cf-ddl-today-label{font-family:var(--font-display);font-weight:800;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:26px;letter-spacing:-.01em;color:var(--ink)}
.cf-ddl-now{justify-self:end;margin-top:0;font-family:var(--font-display);font-weight:800;font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1;letter-spacing:-.03em;font-variant-numeric:tabular-nums;white-space:nowrap;color:var(--accent)}
.cf-ddl-saving{grid-column:2 / -1;margin:24px 0 0;max-width:46ch;font-size:clamp(1.0625rem,1.25vw,1.125rem);font-weight:500;line-height:1.5;text-wrap:pretty;color:var(--ink)}
.cf-ddl-mark{padding:0 .2em;margin:0 -.05em;border-radius:.25em .4em .3em .2em;font-weight:700;color:oklch(from var(--marker,#fae37c) clamp(.2,(.6 - l) * 999,.97) .03 h);background:linear-gradient(to bottom,transparent 0 30%,color-mix(in oklch,var(--marker,#fae37c) 92%,transparent) 30% 94%,transparent 94%);-webkit-box-decoration-break:clone;box-decoration-break:clone}
.cf-ddl-assure{margin:16px 0 0;font-size:.9375rem;font-weight:600;line-height:1.4;text-wrap:balance;color:var(--muted)}
.cf-ddl-stock{display:flex;flex-direction:column;gap:8px}
.cf-ddl-stock-line{margin:0;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;text-wrap:pretty;color:var(--ink)}
.cf-ddl-stock-line strong{font-weight:800;font-variant-numeric:tabular-nums}
.cf-ddl-stock.is-out .cf-ddl-stock-line{font-weight:700;color:var(--danger)}
.cf-ddl-stock.is-out .cf-ddl-ico{color:var(--danger)}
.cf-ddl-meter{height:8px;overflow:hidden;border-radius:999px;background:color-mix(in oklch,var(--ink) 9%,var(--surface))}
.cf-ddl-meter span{display:block;height:100%;border-radius:inherit;background:var(--accent-fill,var(--accent))}
.cf-ddl-act{display:flex;flex-direction:column;gap:12px}
.cf-ddl-btn{--cf-bb:var(--button-bg,var(--cta));--cf-bb2:var(--button-bg-2,var(--cta-2));display:flex;align-items:center;justify-content:center;width:100%;min-height:64px;margin:0;padding:12px 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from var(--cf-bb) calc(l + .04) c h),oklch(from var(--cf-bb2) calc(l - .02) c h));color:var(--button-ink,var(--cta-ink));font-family:var(--button-font,var(--font-display));font-weight:var(--button-weight,800);text-transform:var(--button-case,none);font-size:clamp(1.125rem,1.55vw,1.375rem);line-height:1.15;text-align:center;text-decoration:none;text-wrap:balance;text-shadow:var(--button-text-shadow,none);box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--cf-bb) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--cf-bb) calc(l - .16) c h),0 1px 2px oklch(from var(--shadow,oklch(.22 .03 260)) l c h / .3),0 8px 16px -6px oklch(from var(--shadow,oklch(.22 .03 260)) l c h / .36));cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease;-webkit-tap-highlight-color:transparent}
.cf-ddl-btn:not(:disabled):hover,.cf-ddl-btn.is-hover:not(:disabled){transform:translateY(-1px);background:linear-gradient(oklch(from var(--cf-bb) calc(l - .01) c h),oklch(from var(--cf-bb2) calc(l - .07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--cf-bb) calc(l + .1) c h / .6),inset 0 -3px 0 oklch(from var(--cf-bb) calc(l - .2) c h),0 1px 2px oklch(from var(--shadow,oklch(.22 .03 260)) l c h / .32),0 12px 20px -8px oklch(from var(--shadow,oklch(.22 .03 260)) l c h / .45))}
.cf-ddl-btn:not(:disabled):active,.cf-ddl-btn.is-active:not(:disabled){transform:translateY(1px);background:linear-gradient(oklch(from var(--cf-bb) calc(l - .06) c h),oklch(from var(--cf-bb2) calc(l - .08) c h));box-shadow:inset 0 2px 4px oklch(from var(--cf-bb) calc(l - .24) c h / .55),inset 0 -2px 0 oklch(from var(--cf-bb) calc(l - .16) c h),0 1px 2px oklch(from var(--shadow,oklch(.22 .03 260)) l c h / .3)}
.cf-ddl-btn:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:3px}
.cf-ddl-btn:disabled{transform:none;background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));box-shadow:var(--button-2-shadow,var(--shadow-sm));text-shadow:none;cursor:not-allowed}
.cf-ddl-quiet{margin:0;text-align:center;font-size:.9375rem;font-weight:500;line-height:1.4;text-wrap:pretty;color:var(--muted)}
.cf-ddl-quiet a{color:var(--link,var(--accent));text-decoration:underline;text-decoration-color:oklch(from var(--link,var(--accent)) l c h / .45);text-underline-offset:.18em}
.cf-ddl-quiet a:hover{color:oklch(from var(--link,var(--accent)) calc(l - .08) c h);text-decoration-color:currentColor}
.cf-ddl-quiet a:focus-visible{outline:2px solid var(--link,var(--accent));outline-offset:2px;border-radius:4px}
.cf-ddl-rungs.is-armed .cf-ddl-rung:not(.is-today){opacity:.82;transform:translateY(-8px)}
.cf-ddl-rungs.is-armed .cf-ddl-strike::after{transform:scaleX(0)}
.cf-ddl-rungs.is-armed .cf-ddl-rung::after{transform:scaleY(0)}
.cf-ddl-rungs.is-armed .is-today .cf-ddl-now{transform:scale(.94)}
.cf-ddl-rungs.is-drop .cf-ddl-rung:not(.is-today){animation:cf-ddl-in .45s cubic-bezier(.2,.7,.2,1) both;animation-delay:calc(var(--i) * .36s)}
.cf-ddl-rungs.is-drop .cf-ddl-strike::after{animation:cf-ddl-strike .3s cubic-bezier(.2,.7,.2,1) both;animation-delay:calc(var(--i) * .36s + .22s)}
.cf-ddl-rungs.is-drop .cf-ddl-rung::after{animation:cf-ddl-rail .32s ease-out both;animation-delay:calc(var(--i) * .36s + .26s)}
.cf-ddl-rungs.is-drop .is-today{animation:cf-ddl-pop .3s cubic-bezier(.2,.7,.2,1) both;animation-delay:calc(var(--i) * .36s + .2s)}
.cf-ddl-rungs.is-drop .is-today .cf-ddl-now{animation:cf-ddl-pop .3s cubic-bezier(.2,.7,.2,1) both;animation-delay:calc(var(--i) * .36s + .24s)}
@keyframes cf-ddl-in{from{opacity:.82;transform:translateY(-8px)}to{opacity:1;transform:none}}
@keyframes cf-ddl-strike{from{transform:scaleX(0)}to{transform:scaleX(1)}}
@keyframes cf-ddl-rail{from{transform:scaleY(0)}to{transform:scaleY(1)}}
@keyframes cf-ddl-pop{from{transform:scale(.94)}to{transform:none}}
@media (max-width:900px){
.cf-ddl-grid{grid-template-columns:minmax(0,1fr)}
.cf-ddl-story{padding-top:clamp(40px,9vw,64px);padding-inline:clamp(16px,5vw,48px)}
.cf-ddl-view{min-height:clamp(260px,62vw,420px)}
.cf-ddl-deal{padding-top:clamp(24px,6vw,48px);padding-inline:clamp(16px,5vw,48px)}
.cf-ddl-deal-in{max-width:34rem;margin-inline:auto}
}
@media (max-width:520px){
.cf-ddl-deal-in{gap:16px}
.cf-ddl-rung{column-gap:12px;padding:10px 0}
.cf-ddl-rung:not(:last-child)::before,.cf-ddl-rung:not(:last-child)::after{top:23px;bottom:-23px}
.cf-ddl-rung.is-today{padding:12px 12px 16px}
.cf-ddl-saving{margin-top:20px}
.cf-ddl-unit{padding:6px 10px}
}
@media (prefers-reduced-motion:reduce){
.cf-ddl-rungs .cf-ddl-rung,.cf-ddl-rungs .cf-ddl-now,.cf-ddl-rungs .cf-ddl-strike::after,.cf-ddl-rungs .cf-ddl-rung::after{animation:none!important;transform:none!important;opacity:1!important}
.cf-ddl-btn{transition:none}
.cf-ddl-btn:not(:disabled):hover,.cf-ddl-btn.is-hover:not(:disabled),.cf-ddl-btn:not(:disabled):active,.cf-ddl-btn.is-active:not(:disabled){transform:none}
}
`;
pieces/offer/daily-deal-3/specimen.tsx 44 lines
import __studioImage2f4987ee from "../assets/7f6915fea1938407.webp";
import * as React from 'react';
import DailyDeal3 from '../daily-deal-3';
import defaults from '../../studio-defaults.json';
import { slot } from '../../slots';
export const states = ['default', 'hover', 'active', 'disabled'] as const;
export default function DailyDeal3Specimen({ state = 'default' }: { state?: (typeof states)[number] }) {
const [endsAt] = React.useState(() => new Date(Date.now() + (7 * 3600 + 42 * 60 + 18) * 1000).toISOString());
return (
<DailyDeal3
state={state}
headline='The Fernhollow mug set just hit its lowest price'
lead='Four hand-glazed stoneware mugs, fired in small batches in our Oregon studio. The price stepped down all season. Today it lands at half off.'
productImage={slot(
'product',
__studioImage2f4987ee,
)}
productImageAlt='Four Fernhollow stoneware mugs in moss, slate, oat and clay glazes on a walnut table'
imagePosition='50% 80%'
regularPrice={96}
history={[
{ label: 'Spring sale', amount: 78 },
{ label: 'Last week', amount: 64 },
]}
price={48}
currency='USD'
locale='en-US'
endsAt={endsAt}
timeZone='America/Los_Angeles'
stockLeft={37}
stockTotal={120}
assurance={'Ships free · ' + defaults.sample.guarantee}
label='Send me the set for {price}'
secondaryLabel='or keep reading to meet each mug up close'
secondaryHref='#fernhollow-mugs'
copy={{
stock: '{left} of {total} sets left at this price',
stockOnly: '{left} sets left at this price',
}}
/>
);
}
| Name | Type | Details |
|---|---|---|
headline OptionalDailyDeal3 |
string |
|
lead OptionalDailyDeal3 |
string |
|
productImage OptionalDailyDeal3 |
string |
|
productImageAlt OptionalDailyDeal3 |
string |
|
imageFit OptionalDailyDeal3 |
'cover' | 'contain' |
|
imagePosition OptionalDailyDeal3 |
string |
|
regularPrice OptionalDailyDeal3 |
number |
|
history OptionalDailyDeal3 |
DailyDeal3Step[] |
|
price OptionalDailyDeal3 |
number |
|
currency OptionalDailyDeal3 |
string |
|
locale OptionalDailyDeal3 |
string |
|
endsAt OptionalDailyDeal3 |
string |
|
timeZone OptionalDailyDeal3 |
string |
|
stockLeft OptionalDailyDeal3 |
number |
|
stockTotal OptionalDailyDeal3 |
number |
|
assurance OptionalDailyDeal3 |
string |
|
label OptionalDailyDeal3 |
string |
|
secondaryLabel OptionalDailyDeal3 |
string |
|
secondaryHref OptionalDailyDeal3 |
string |
|
href OptionalDailyDeal3 |
string |
|
onAction OptionalDailyDeal3 |
(event: React.MouseEvent<HTMLElement>) => void |
|
state OptionalDailyDeal3 |
'default' | 'hover' | 'active' | 'disabled' |
|
className OptionalDailyDeal3 |
string |
|
copy OptionalDailyDeal3 |
Partial<DailyDeal3Copy> |
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-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.
product- The main product shot or cover (ebook, kit, bottle).
-
7f6915fea1938407.webp
image/webp · 45.1 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB