Coupon Claim 1
Coupon claim on a lit product stage. The visitor taps the product they want, sees its price with the
Use it in a prompt
Use offer/coupon-claim 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/coupon-claim.tsx. - Import it and pass your copy and images (Props tab):
import { CouponClaim } from "@/components/funneldna/offer/coupon-claim"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/coupon-claim/component.tsx 422 lines
// layout: product-stage
// Coupon claim on a lit product stage. The visitor taps the product they want, sees its price with the
// first-order code applied, then asks for the code by email, so the saving is tied to the exact thing they want.
import React from "react";
import { motion, useReducedMotion } from "motion/react";
import { AlertCircle, Check, Clock, Lock, Scissors, Tag } from "lucide-react";
import { FX_HOST, Spotlight } from "../fx/fx";
export type CouponClaimProduct = {
name: string;
/** One short line about what it does, shown beside the stage. */
detail?: string;
/** Two or three short feature notes, shown beside the stage. */
notes?: string[];
/** Regular price as a number, e.g. 48 for $48. */
price: number;
/** Cut-out product shot on a transparent background (slot item-n). */
image: string;
};
export type CouponClaimValues = {
email: string;
product: CouponClaimProduct;
productIndex: number;
regularPrice: number;
price: number;
saving: number;
};
export type CouponClaimCopy = {
/** Placeholders: {percent}. */
headline: string;
/** The phrase inside the headline that gets the marker stroke. Placeholders: {percent}. */
highlight: string;
/** Placeholders: {percent}. */
lead: string;
/** Accessible name of the product choice. */
legend: string;
/** Placeholders: {name}. */
cardHeading: string;
regularLabel: string;
priceLabel: string;
/** Placeholders: {saving}, {percent}. */
saving: string;
emailLabel: string;
emailPlaceholder: string;
/** Placeholders: {percent}. */
button: string;
errorEmpty: string;
errorInvalid: string;
};
export type CouponClaimProps = {
/** The products on the stage (designed for three). */
products: CouponClaimProduct[];
/** The supplied first-order discount, e.g. 20 for 20% off. */
discountPercent: number;
/** ISO currency code for the price figures. */
currency?: string;
locale?: string;
/** Index of the product chosen at first; defaults to the middle one. */
defaultSelected?: number;
/** What the code applies to, from the offer. Hidden when empty. */
appliesTo?: string;
/** When the code expires, from the offer. Hidden when empty. */
expiry?: string;
privacy?: string;
defaultEmail?: string;
copy?: Partial<CouponClaimCopy>;
/** Called with the email and the chosen product once the email is valid. */
onSubmit?: (values: CouponClaimValues) => void;
state?: "default" | "hover" | "active" | "disabled" | "error";
className?: string;
};
const DEFAULT_COPY: CouponClaimCopy = {
headline: "Pick your favourite. See it {percent} off right now.",
highlight: "{percent} off",
lead: "Your first-order code takes {percent} off. Tap the one you’ve been eyeing, see your new price, and we’ll email the code to you.",
legend: "Choose the product you want your code for",
cardHeading: "{name} with your code",
regularLabel: "Regular price",
priceLabel: "Your price with the code",
saving: "You save {saving} with your {percent} code",
emailLabel: "Email address",
emailPlaceholder: "you@example.com",
button: "Send Me My {percent} Code",
errorEmpty: "Enter your email so we can send your code.",
errorInvalid: "That email looks incomplete. Check it and try again.",
};
const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/;
export function CouponClaim({
products,
discountPercent,
currency = "USD",
locale = "en-US",
defaultSelected,
appliesTo = "",
expiry = "",
privacy = "We respect your inbox. Unsubscribe anytime.",
defaultEmail = "",
copy,
onSubmit,
state = "default",
className,
}: CouponClaimProps) {
const t = { ...DEFAULT_COPY, ...copy };
const uid = React.useId();
const reduce = useReducedMotion();
const inputRef = React.useRef<HTMLInputElement>(null);
const count = products.length;
const [selected, setSelected] = React.useState(() => clampIndex(defaultSelected ?? Math.floor((count - 1) / 2), count));
const [email, setEmail] = React.useState(defaultEmail);
const [touched, setTouched] = React.useState(state === "error");
const index = clampIndex(selected, count);
const product = products[index];
if (!product) return null;
const pct = `${discountPercent}%`;
const now = Math.round(product.price * (100 - discountPercent)) / 100;
const saving = Math.round((product.price - now) * 100) / 100;
const fmt = (v: number) => money(v, currency, locale);
const fill = (s: string) =>
s.split("{percent}").join(pct).split("{name}").join(product.name).split("{saving}").join(fmt(saving));
const trimmed = email.trim();
const valid = EMAIL.test(trimmed);
const showError = touched && !valid;
const disabled = state === "disabled" || (!valid && (trimmed !== "" || touched));
const emailId = `${uid}-email`;
const errId = `${uid}-err`;
const fineId = `${uid}-fine`;
const hasFine = Boolean(appliesTo || expiry || privacy);
const describedBy = [showError ? errId : "", hasFine ? fineId : ""].filter(Boolean).join(" ") || undefined;
const swap = reduce
? { initial: false as const, animate: { opacity: 1, y: 0 } }
: { initial: { opacity: 0.82, y: 8 }, animate: { opacity: 1, y: 0 }, transition: { duration: 0.45, ease: [0.2, 0.7, 0.2, 1] as const } };
function submit(e: React.FormEvent<HTMLFormElement>) {
e.preventDefault();
if (!valid) {
setTouched(true);
inputRef.current?.focus();
return;
}
onSubmit?.({ email: trimmed, product, productIndex: index, regularPrice: product.price, price: now, saving });
}
return (
<section
className={["cf-coupon-claim", className].filter(Boolean).join(" ")}
data-state={state}
aria-labelledby={`${uid}-h`}
>
<style>{CSS}</style>
<div className="cf-cc-wrap">
<header className="cf-cc-head">
<h2 id={`${uid}-h`} className="cf-cc-h">
<Marked text={fill(t.headline)} mark={fill(t.highlight)} />
</h2>
{t.lead ? <p className="cf-cc-lead">{fill(t.lead)}</p> : null}
</header>
<div className="cf-cc-grid">
<fieldset className="cf-cc-stage">
<legend className="cf-cc-sr">{fill(t.legend)}</legend>
<div className="cf-cc-row" style={{ "--n": count, "--i": index } as React.CSSProperties}>
<div className="cf-cc-beam" aria-hidden="true">
<div className="cf-cc-beam-in" style={FX_HOST}>
<Spotlight />
</div>
</div>
{products.map((p, k) => (
<label key={`${p.name}-${k}`} className="cf-cc-tile" style={{ "--k": k } as React.CSSProperties}>
<input
className="cf-cc-sr cf-cc-radio"
type="radio"
name={`${uid}-product`}
value={String(k)}
checked={k === index}
onChange={() => setSelected(k)}
/>
<span className="cf-cc-fig">
<span className="cf-cc-badge" aria-hidden="true">
<Check size={16} strokeWidth={3} />
</span>
<span className="cf-cc-shot">
<img src={p.image} alt="" width={512} height={512} decoding="async" />
</span>
<span className="cf-cc-ped" aria-hidden="true" />
<span className="cf-cc-name">{p.name}</span>
<span className="cf-cc-reg">{fmt(p.price)}</span>
</span>
</label>
))}
</div>
</fieldset>
<div className="cf-cc-notes">
<motion.div key={index} {...swap}>
<h3 className="cf-cc-nh">{product.name}</h3>
{product.detail ? <p className="cf-cc-np">{product.detail}</p> : null}
{product.notes && product.notes.length ? (
<ul className="cf-cc-nl">
{product.notes.map((n) => (
<li key={n}>
<span className="cf-cc-tick" aria-hidden="true">
<Check size={16} strokeWidth={3} />
</span>
<span>{n}</span>
</li>
))}
</ul>
) : null}
</motion.div>
</div>
<div className="cf-cc-card">
<div aria-live="polite">
<motion.div key={index} {...swap}>
<h3 className="cf-cc-for">{fill(t.cardHeading)}</h3>
<p className="cf-cc-prices">
<span className="cf-cc-sr">{t.regularLabel} </span>
<s className="cf-cc-was">{fmt(product.price)}</s>
<span className="cf-cc-sr"> {t.priceLabel} </span>
<strong className="cf-cc-now">{fmt(now)}</strong>
</p>
<p className="cf-cc-save">
<Scissors className="cf-cc-ico" size={18} strokeWidth={2.5} aria-hidden="true" />
{fill(t.saving)}
</p>
</motion.div>
</div>
<form className="cf-cc-form" noValidate onSubmit={submit}>
<label className="cf-cc-label" htmlFor={emailId}>
{t.emailLabel}
</label>
<input
ref={inputRef}
id={emailId}
className="cf-cc-email"
type="email"
name="email"
autoComplete="email"
inputMode="email"
placeholder={t.emailPlaceholder}
value={email}
onChange={(e) => setEmail(e.target.value)}
onBlur={() => {
if (email.trim()) setTouched(true);
}}
aria-invalid={showError}
aria-describedby={describedBy}
/>
<p id={errId} className="cf-cc-err" aria-live="polite">
{showError ? (
<>
<AlertCircle className="cf-cc-ico" size={16} strokeWidth={2.5} aria-hidden="true" />
{trimmed ? t.errorInvalid : t.errorEmpty}
</>
) : null}
</p>
<button type="submit" className="cf-cc-btn" disabled={disabled}>
{fill(t.button)}
</button>
{hasFine ? (
<ul id={fineId} className="cf-cc-fine">
{appliesTo ? (
<li>
<Tag className="cf-cc-ico" size={16} strokeWidth={2.5} aria-hidden="true" />
{appliesTo}
</li>
) : null}
{expiry ? (
<li>
<Clock className="cf-cc-ico" size={16} strokeWidth={2.5} aria-hidden="true" />
{expiry}
</li>
) : null}
{privacy ? (
<li>
<Lock className="cf-cc-ico" size={16} strokeWidth={2.5} aria-hidden="true" />
{privacy}
</li>
) : null}
</ul>
) : null}
</form>
</div>
</div>
</div>
</section>
);
}
export default CouponClaim;
function Marked({ text, mark }: { text: string; mark: string }) {
const at = mark ? text.indexOf(mark) : -1;
if (at < 0) return <>{text}</>;
return (
<>
{text.slice(0, at)}
<span className="cf-cc-mark">{mark}</span>
{text.slice(at + mark.length)}
</>
);
}
function clampIndex(i: number, count: number) {
if (count <= 0) return 0;
return Math.min(Math.max(Math.round(i), 0), count - 1);
}
function money(v: number, currency: string, locale: string) {
const whole = Math.abs(v - Math.round(v)) < 0.005;
return new Intl.NumberFormat(locale, {
style: "currency",
currency,
minimumFractionDigits: whole ? 0 : 2,
maximumFractionDigits: whole ? 0 : 2,
}).format(v);
}
const CSS = `
.cf-coupon-claim { --cc-gap: clamp(8px, 2vw, 24px); --cc-shadow: var(--shadow, oklch(0.22 0.03 260)); position: relative; overflow: hidden; background: var(--band); color: var(--band-ink); font-family: var(--font-body); padding: clamp(56px, 8vw, 112px) clamp(16px, 5vw, 48px) clamp(64px, 8.5vw, 120px); }
.cf-coupon-claim *, .cf-coupon-claim *::before, .cf-coupon-claim *::after { box-sizing: border-box; }
.cf-cc-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.cf-cc-wrap { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; }
.cf-cc-head { max-width: 46rem; margin: 0 auto; text-align: center; }
.cf-cc-h { margin: 0; color: var(--band-ink); font-family: var(--font-display); font-weight: var(--display-weight, 800); letter-spacing: var(--display-tracking, -0.025em); text-transform: var(--display-case, none); font-size: clamp(2rem, 3.6vw, 3.25rem); line-height: 1.06; text-wrap: balance; }
.cf-cc-mark { --cc-marker: oklch(from var(--marker, #fae37c) max(l, 0.86) min(c, 0.17) h); color: oklch(from var(--cc-marker) 0.22 0.05 h); background: linear-gradient(transparent 14%, var(--cc-marker) 14%, var(--cc-marker) 94%, transparent 94%); padding: 0 .14em; margin: 0 -.04em; border-radius: .18em .4em .24em .34em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.cf-cc-lead { margin: 16px auto 0; max-width: 40rem; color: var(--band-ink); font-size: clamp(1.125rem, 1.5vw, 1.375rem); font-weight: 500; line-height: 1.4; text-wrap: pretty; }
.cf-cc-grid { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "stage" "card"; gap: clamp(28px, 4vw, 48px); align-items: start; margin-top: clamp(32px, 5vw, 56px); }
.cf-cc-stage { grid-area: stage; width: 100%; max-width: 640px; justify-self: center; margin: 0; padding: 0; border: 0; min-width: 0; }
.cf-cc-notes { grid-area: notes; display: none; }
.cf-cc-card { grid-area: card; width: 100%; max-width: 30rem; justify-self: center; }
@media (min-width: 720px) {
.cf-cc-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); grid-template-areas: "stage stage" "notes card"; }
.cf-cc-notes { display: block; }
.cf-cc-card { max-width: none; }
}
@media (min-width: 1080px) {
.cf-cc-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 24rem); grid-template-areas: "stage card" "notes card"; column-gap: clamp(40px, 5vw, 72px); row-gap: 32px; }
.cf-cc-stage { max-width: none; }
.cf-cc-notes > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 32px; align-items: start; }
.cf-cc-notes .cf-cc-nh { grid-column: 1; grid-row: 1; }
.cf-cc-notes .cf-cc-np { grid-column: 1; grid-row: 2; }
.cf-cc-notes .cf-cc-nl { grid-column: 2; grid-row: 1 / span 2; margin-top: 4px; }
}
.cf-cc-row { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: var(--cc-gap); padding-top: clamp(16px, 4vw, 48px); }
.cf-cc-beam { position: absolute; top: 0; bottom: 0; left: 0; z-index: 0; width: calc((100% - (var(--n) - 1) * var(--cc-gap)) / var(--n)); transform: translateX(calc(var(--i) * (100% + var(--cc-gap)))); transition: transform .45s cubic-bezier(.2,.7,.2,1); pointer-events: none; }
.cf-cc-beam-in { width: 100%; height: 100%; }
.cf-cc-tile { position: relative; z-index: 1; display: block; cursor: pointer; -webkit-tap-highlight-color: transparent; animation: cf-cc-rise .45s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(min(var(--k) * .07s, .28s)); }
.cf-cc-fig { position: relative; display: flex; flex-direction: column; align-items: center; padding: 8px 6px 12px; border-radius: 12px; text-align: center; }
.cf-cc-radio:focus-visible + .cf-cc-fig { outline: 3px solid var(--band-ink); outline-offset: 4px; }
.cf-cc-shot { position: relative; z-index: 2; display: flex; align-items: flex-end; justify-content: center; width: 100%; aspect-ratio: 4 / 5; transform-origin: 50% 100%; transform: scale(.84); filter: saturate(.72); transition: transform .3s cubic-bezier(.2,.7,.2,1), filter .3s ease; }
.cf-cc-shot::before { content: ""; position: absolute; inset: 18% 2% 0; z-index: -1; border-radius: 50%; background: radial-gradient(closest-side, oklch(from var(--band-ink) l c h / .13), oklch(from var(--band-ink) l c h / 0)); pointer-events: none; }
.cf-cc-shot img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: 50% 100%; filter: drop-shadow(0 2px 3px oklch(from var(--cc-shadow) calc(l - .08) c h / .55)) drop-shadow(0 14px 14px oklch(from var(--cc-shadow) calc(l - .08) c h / .4)); }
.cf-cc-tile:hover .cf-cc-radio:not(:checked) + .cf-cc-fig .cf-cc-shot { transform: translateY(-6px) scale(.88); filter: saturate(.92); }
.cf-cc-tile:active .cf-cc-radio:not(:checked) + .cf-cc-fig .cf-cc-shot { transform: scale(.82); transition-duration: .12s; }
.cf-cc-radio:checked + .cf-cc-fig .cf-cc-shot { transform: scale(1.04); filter: none; }
.cf-cc-tile:hover .cf-cc-radio:checked + .cf-cc-fig .cf-cc-shot { transform: translateY(-3px) scale(1.04); }
.cf-cc-ped { position: relative; z-index: 1; display: block; width: 86%; height: clamp(14px, 2vw, 24px); margin-top: calc(clamp(14px, 2vw, 24px) * -.55); border-radius: 50%; background: oklch(from var(--band) calc(l + .07) c h); box-shadow: inset 0 1px 0 oklch(from var(--band-ink) l c h / .14), 0 2px 3px oklch(from var(--cc-shadow) calc(l - .08) c h / .45), 0 8px 12px -6px oklch(from var(--cc-shadow) calc(l - .08) c h / .6); transition: background .3s ease; }
.cf-cc-radio:checked + .cf-cc-fig .cf-cc-ped { background: oklch(from var(--band) calc(l + .15) c h); }
.cf-cc-badge { position: absolute; top: 4px; right: 8%; z-index: 3; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 999px; background: var(--accent-fill, var(--accent)); color: var(--accent-fill-ink, var(--card)); box-shadow: var(--shadow-sm, 0 1px 2px oklch(from var(--cc-shadow) l c h / .3)); opacity: 0; transform: scale(.9); transition: opacity .3s ease, transform .3s ease; }
.cf-cc-radio:checked + .cf-cc-fig .cf-cc-badge { opacity: 1; transform: scale(1); }
.cf-cc-name { display: block; margin-top: 12px; color: var(--band-ink); font-size: clamp(.875rem, 1.2vw, 1.0625rem); font-weight: 600; line-height: 1.25; text-wrap: balance; }
.cf-cc-radio:checked + .cf-cc-fig .cf-cc-name { font-weight: 800; }
.cf-cc-reg { display: block; margin-top: 4px; color: var(--band-ink); font-size: .9375rem; font-weight: 500; line-height: 1.4; font-variant-numeric: tabular-nums; }
.cf-cc-nh { margin: 0; color: var(--band-ink); font-family: var(--font-display); font-size: clamp(1.3125rem, 1.8vw, 1.625rem); font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; text-wrap: balance; }
.cf-cc-np { margin: 12px 0 0; color: var(--band-ink); font-size: clamp(1.0625rem, 1.25vw, 1.125rem); line-height: 1.5; text-wrap: pretty; }
.cf-cc-nl { display: grid; gap: 12px; margin: 24px 0 0; padding: 0; list-style: none; }
.cf-cc-nl li { display: flex; align-items: flex-start; gap: 12px; color: var(--band-ink); font-size: clamp(1.0625rem, 1.25vw, 1.125rem); font-weight: 600; line-height: 1.4; text-wrap: pretty; }
.cf-cc-tick { flex: 0 0 auto; display: grid; place-items: center; width: 24px; height: 24px; margin-top: 0; border-radius: 999px; background: var(--success); color: var(--success-ink, #fff); }
.cf-cc-card { color: var(--ink); 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-lg, 0 2px 4px oklch(from var(--cc-shadow) l c h / .22), 0 12px 24px -8px oklch(from var(--cc-shadow) l c h / .32))); padding: clamp(20px, 3vw, 32px); }
.cf-cc-for { margin: 0; color: var(--ink); font-family: var(--font-display); font-size: clamp(1.3125rem, 1.8vw, 1.625rem); font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; text-wrap: balance; }
.cf-cc-prices { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin: 16px 0 0; }
.cf-cc-was { color: var(--muted); font-size: clamp(1.3125rem, 1.8vw, 1.625rem); font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; text-decoration: line-through; text-decoration-color: var(--danger); text-decoration-thickness: 2px; }
.cf-cc-now { color: var(--ink); font-family: var(--font-display); font-size: clamp(2.5rem, 4.2vw, 3.75rem); font-weight: var(--display-weight, 800); letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.cf-cc-save { margin: 16px 0 0; padding: 12px 16px; border-radius: 10px; background: var(--success-soft); color: var(--success); font-size: 1rem; font-weight: 700; line-height: 1.35; text-wrap: pretty; }
.cf-cc-ico { display: inline-block; vertical-align: -0.15em; margin-inline-end: .4em; }
.cf-cc-form { display: grid; gap: 8px; margin-top: 24px; }
.cf-cc-label { color: var(--label-ink, var(--ink)); font-size: 1rem; font-weight: 700; line-height: 1.3; }
.cf-cc-email { width: 100%; height: 56px; padding: 0 16px; color: var(--field-ink); background: var(--field); border: 1px solid var(--field-border, color-mix(in oklch, var(--ink) 22%, transparent)); border-radius: var(--field-radius, var(--radius, 12px)); font: inherit; font-size: 1.0625rem; transition: border-color .16s ease, box-shadow .16s ease; }
.cf-cc-email::placeholder { color: color-mix(in oklch, var(--field-ink) 65%, var(--field)); opacity: 1; }
.cf-cc-email:focus { outline: none; border-color: var(--field-focus, var(--accent)); box-shadow: 0 0 0 3px oklch(from var(--field-focus, var(--accent)) l c h / .35); }
.cf-cc-email[aria-invalid=true] { border-color: var(--danger); }
.cf-cc-email[aria-invalid=true]:focus { box-shadow: 0 0 0 3px oklch(from var(--danger) l c h / .3); }
.cf-cc-err { margin: 0; color: var(--danger); font-size: .9375rem; font-weight: 600; line-height: 1.4; text-wrap: pretty; }
.cf-cc-err:empty { display: none; }
.cf-cc-btn { --b: var(--button-bg, var(--cta)); --b2: var(--button-bg-2, var(--cta-2)); appearance: none; display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 56px; margin-top: 8px; padding: 8px 20px; border: 0; cursor: pointer; text-align: center; color: var(--button-ink, var(--cta-ink)); font-family: var(--button-font, var(--font-display)); font-size: clamp(1.0625rem, 1.4vw, 1.25rem); font-weight: var(--button-weight, 800); line-height: 1.15; text-transform: var(--button-case, none); text-wrap: balance; text-shadow: var(--button-text-shadow, none); border-radius: var(--button-radius, var(--radius, 12px)); background: linear-gradient(oklch(from var(--b) calc(l + .04) c h), oklch(from var(--b2) calc(l - .02) c h)); box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--b) calc(l + .14) c h / .7), inset 0 -3px 0 oklch(from var(--b) calc(l - .16) c h), 0 1px 2px oklch(from var(--cc-shadow) l c h / .3), 0 8px 16px -6px oklch(from var(--cc-shadow) l c h / .5)); transition: transform .16s ease, box-shadow .16s ease, background .16s ease; }
.cf-cc-btn:not(:disabled):hover, .cf-coupon-claim[data-state=hover] .cf-cc-btn:not(:disabled) { background: linear-gradient(oklch(from var(--b) calc(l - .01) c h), oklch(from var(--b2) calc(l - .07) c h)); box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--b) calc(l + .1) c h / .7), inset 0 -3px 0 oklch(from var(--b) calc(l - .2) c h), 0 1px 2px oklch(from var(--cc-shadow) l c h / .32), 0 10px 18px -6px oklch(from var(--cc-shadow) l c h / .58)); }
.cf-cc-btn:not(:disabled):active, .cf-coupon-claim[data-state=active] .cf-cc-btn:not(:disabled) { transform: translateY(1px); background: linear-gradient(oklch(from var(--b) calc(l - .04) c h), oklch(from var(--b2) calc(l - .08) c h)); box-shadow: inset 0 2px 3px oklch(from var(--b) calc(l - .22) c h / .55), inset 0 -2px 0 oklch(from var(--b) calc(l - .16) c h), 0 1px 1px oklch(from var(--cc-shadow) l c h / .3); }
.cf-cc-btn:focus-visible { outline: 3px solid var(--field-focus, var(--accent)); outline-offset: 3px; }
.cf-cc-btn:disabled { cursor: not-allowed; transform: none; color: var(--button-2-ink, var(--secondary-ink)); background: var(--button-2-bg, var(--secondary)); box-shadow: none; text-shadow: none; }
.cf-cc-fine { display: grid; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; color: var(--muted); font-size: .9375rem; font-weight: 500; line-height: 1.4; text-wrap: pretty; }
@media (max-width: 719px) {
.cf-cc-row { padding-top: 12px; }
.cf-cc-fig { padding: 6px 2px 8px; }
.cf-cc-badge { top: 0; right: 4%; width: 24px; height: 24px; }
.cf-cc-name { margin-top: 8px; }
.cf-cc-reg { display: none; }
}
@keyframes cf-cc-rise { from { opacity: .82; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
.cf-cc-tile, .cf-cc-shot, .cf-cc-beam, .cf-cc-ped, .cf-cc-badge, .cf-cc-btn, .cf-cc-email { animation: none; transition: none; }
}
`;
pieces/offer/coupon-claim/specimen.tsx 62 lines
import __studioImagee76f289d from "../assets/c2a1e2ded10d4843.webp";
import __studioImagef95d4ad6 from "../assets/02c81a8077b219d0.webp";
import __studioImagea6358f0d from "../assets/27b237a630d78851.webp";
import React from "react";
import { CouponClaim } from "../coupon-claim";
import { slot } from "../../slots";
import defaults from "../../studio-defaults.json";
type SpecimenState = "default" | "hover" | "active" | "disabled" | "error";
export const states = ["default", "hover", "active", "disabled", "error"];
export default function CouponClaimSpecimen({ state = "default" }: { state?: SpecimenState }) {
const products = [
{
name: "Gentle Clay Cleanser",
detail: "A soft clay gel that lifts the day off without stripping.",
notes: ["Kaolin clay and oat", "Rinses clean, no tight feel", "150 ml tube"],
price: 32,
image: slot(
"item-1",
__studioImagef95d4ad6
),
},
{
name: "Daily Barrier Serum",
detail: "The light layer you put on every morning and night.",
notes: ["Ceramides and niacinamide", "Fragrance-free", "30 ml dropper bottle"],
price: 48,
image: slot(
"item-2",
__studioImagea6358f0d
),
},
{
name: "Overnight Repair Cream",
detail: "A rich night cream that melts in while you sleep.",
notes: ["Squalane and peptides", "Slow-melt, rich texture", "50 ml jar"],
price: 56,
image: slot(
"item-3",
__studioImagee76f289d
),
},
];
const sampleEmail = state === "error" ? "jamie@halewood" : state === "disabled" ? "jamie@hale" : undefined;
return (
<CouponClaim
key={state}
state={state}
products={products}
discountPercent={20}
appliesTo="Works on any full-size product in your first Halewood Skin order."
expiry="Code is valid for 14 days after we send it."
privacy={defaults.sample.registration.privacy}
defaultEmail={sampleEmail}
/>
);
}
| Name | Type | Details |
|---|---|---|
products RequiredCouponClaim |
CouponClaimProduct[] |
|
discountPercent RequiredCouponClaim |
number |
|
currency OptionalCouponClaim |
string |
Default "USD"
|
locale OptionalCouponClaim |
string |
Default "en-US"
|
defaultSelected OptionalCouponClaim |
number |
|
appliesTo OptionalCouponClaim |
string |
Default ""
|
expiry OptionalCouponClaim |
string |
Default ""
|
privacy OptionalCouponClaim |
string |
Default "We respect your inbox. Unsubscribe anytime."
|
defaultEmail OptionalCouponClaim |
string |
Default ""
|
copy OptionalCouponClaim |
Partial<CouponClaimCopy> |
|
onSubmit OptionalCouponClaim |
(values: CouponClaimValues) => void |
|
state OptionalCouponClaim |
"default" | "hover" | "active" | "disabled" | "error" |
Default "default"
|
className OptionalCouponClaim |
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-ink- 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-1- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-2- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-3- One image per offer item (item-1, item-2…), shown in stacks and lists.
-
02c81a8077b219d0.webp
image/webp · 49.5 KB
-
27b237a630d78851.webp
image/webp · 48.2 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
c2a1e2ded10d4843.webp
image/webp · 73.6 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB