Giveaway Boost 1
Giveaway referral boost: the post-entry screen that turns one entry into many. A path of supplied boost actions
Use it in a prompt
Use forms/giveaway-boost 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/forms/giveaway-boost.tsx. - Import it and pass your copy and images (Props tab):
import { GiveawayBoost } from "@/components/funneldna/forms/giveaway-boost"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/forms/giveaway-boost/component.tsx 599 lines
// layout: path-to-action
// Giveaway referral boost: the post-entry screen that turns one entry into many. A path of supplied boost actions
// leads to the visitor's personal referral link; each finished action ticks and counts the entries up toward the cap.
import React from 'react';
import {
AlertCircle,
CalendarDays,
Check,
Heart,
Link2,
Lock,
Mail,
MousePointerClick,
Share2,
UserPlus,
Users,
type LucideIcon,
} from 'lucide-react';
export type GiveawayBoostIcon = 'share' | 'follow' | 'refer' | 'email' | 'visit' | 'like';
export type GiveawayBoostAction = {
id: string;
title: React.ReactNode;
detail?: React.ReactNode;
/** Entries this action adds (the supplied value only). */
entries: number;
icon?: GiveawayBoostIcon;
/** Button label; defaults to the icon's verb in copy.actionLabels. */
label?: string;
/** Destination opened in a new tab when the visitor takes the action. */
href?: string;
};
/** Templates use named placeholders: {prize}, {count}, {label}, {n}, {cap}, {left}, {date}. */
export type GiveawayBoostCopy = {
entries: string;
entry: string;
toward: string;
inDraw: string;
srCount: string;
gain: string;
meterAria: string;
capLine: string;
remaining: string;
maxed: string;
closes: string;
closed: string;
pathAria: string;
chip: string;
chipOne: string;
added: string;
done: string;
maxedButton: string;
actionLabels: Record<GiveawayBoostIcon, string>;
linkTitle: string;
linkDetail: string;
linkDetailEntries: string;
linkPlaceholder: string;
copyLabel: string;
copyShort: string;
copied: string;
copiedShort: string;
copyError: string;
rulesLine: string;
};
export type GiveawayBoostProps = {
headline?: React.ReactNode;
/** One sentence per line; the last line is the short emphasis line. */
lead?: React.ReactNode[];
/** Full-bleed scene behind the band (slot: scene). Decorative. */
sceneImage?: string;
/** Small prize photo beside the count (slot: product). */
prizeImage?: string;
prizeAlt?: string;
/** Prize name used in the count line. */
prizeName?: string;
/** Entries the visitor already holds from entering. */
baseEntries?: number;
/** Maximum entries one person can hold; the bar fills toward it. */
cap?: number;
/** When the draw closes, written as the page wants it shown. */
endDate?: string;
rulesHref?: string;
actions?: GiveawayBoostAction[];
/** Action ids the visitor has already completed. */
completed?: string[];
/** The visitor's personal referral URL. */
referralUrl?: string;
/** Entries added per friend who enters through the link. */
referralEntries?: number;
onAction?: (id: string) => void;
onCopy?: (url: string) => void;
copy?: Partial<GiveawayBoostCopy>;
/** disabled = entries closed, error = copy failed, success = every action done. */
state?: 'default' | 'hover' | 'active' | 'disabled' | 'error' | 'success';
className?: string;
};
const DEFAULT_LEAD: React.ReactNode[] = [
'Your entry is in the draw.',
'Every action below adds more chances to win.',
'Simple.',
];
const DEFAULT_COPY: GiveawayBoostCopy = {
entries: 'entries',
entry: 'entry',
toward: 'toward the {prize}',
inDraw: 'in the draw',
srCount: 'You have {count} {label}.',
gain: '+{n}',
meterAria: 'Your entries toward the maximum',
capLine: '{count} of {cap} max entries',
remaining: '{left} more to earn',
maxed: 'Max reached',
closes: 'Draw closes {date}',
closed: 'Entries are closed for this giveaway.',
pathAria: 'Ways to earn more entries',
chip: '+{n} entries',
chipOne: '+1 entry',
added: '+{n} added',
done: 'Done',
maxedButton: 'Max reached',
actionLabels: { share: 'Share', follow: 'Follow', refer: 'Invite', email: 'Join', visit: 'Visit', like: 'Like' },
linkTitle: 'Share your personal link',
linkDetail: 'Every friend who enters through your link earns you more entries.',
linkDetailEntries: 'Every friend who enters through your link adds {n} entries to your count.',
linkPlaceholder: 'https://example.com/giveaway?ref=your-code',
copyLabel: 'Copy my link',
copyShort: 'Copy',
copied: 'Link copied',
copiedShort: 'Copied',
copyError: 'We couldn’t copy it. Select the link and copy it yourself.',
rulesLine: 'or read the official giveaway rules',
};
const ICONS: Record<GiveawayBoostIcon, LucideIcon> = {
share: Share2,
follow: UserPlus,
refer: Users,
email: Mail,
visit: MousePointerClick,
like: Heart,
};
export function GiveawayBoost(props: GiveawayBoostProps) {
const {
headline = 'You’re in. Now stack the odds.',
lead = DEFAULT_LEAD,
sceneImage,
prizeImage,
prizeAlt = '',
prizeName,
baseEntries = 0,
cap,
endDate,
rulesHref,
actions = [],
completed = [],
referralUrl,
referralEntries,
onAction,
onCopy,
copy: copyIn,
state = 'default',
className,
} = props;
const c: GiveawayBoostCopy = {
...DEFAULT_COPY,
...copyIn,
actionLabels: { ...DEFAULT_COPY.actionLabels, ...(copyIn?.actionLabels ?? {}) },
};
const uid = React.useId().replace(/:/g, '');
const headingId = 'gb-h-' + uid;
const fieldId = 'gb-ref-' + uid;
const errId = 'gb-err-' + uid;
const closed = state === 'disabled';
const [doneState, setDoneState] = React.useState<string[]>(completed);
const done = state === 'success' ? actions.map((a) => a.id) : doneState;
const earned = actions.reduce(
(sum, a) => (done.includes(a.id) ? sum + Math.max(0, a.entries) : sum),
Math.max(0, baseEntries),
);
const hasCap = typeof cap === 'number' && cap > 0;
const capValue = hasCap ? (cap as number) : 0;
const total = hasCap ? Math.min(capValue, earned) : earned;
const maxed = hasCap && total >= capValue;
const pct = hasCap ? Math.min(100, (total / capValue) * 100) : 0;
const shown = useCountUp(total);
const [gain, setGain] = React.useState<{ n: number; k: number } | null>(null);
const [copied, setCopied] = React.useState(false);
const [copyErr, setCopyErr] = React.useState(false);
const timer = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined);
const inputRef = React.useRef<HTMLInputElement>(null);
const btnRef = React.useRef<HTMLButtonElement>(null);
React.useEffect(() => () => {
if (timer.current) clearTimeout(timer.current);
}, []);
const showErr = copyErr || state === 'error';
const complete = (a: GiveawayBoostAction) => {
if (closed || done.includes(a.id) || maxed) return;
const raw = Math.max(0, a.entries);
const add = hasCap ? Math.min(raw, capValue - total) : raw;
setDoneState((prev) => (prev.includes(a.id) ? prev : [...prev, a.id]));
setGain((g) => ({ n: add, k: (g ? g.k : 0) + 1 }));
onAction?.(a.id);
};
const copyLink = async () => {
if (closed || !referralUrl) return;
let ok = false;
try {
if (typeof navigator !== 'undefined' && navigator.clipboard?.writeText) {
await navigator.clipboard.writeText(referralUrl);
ok = true;
}
} catch {
ok = false;
}
if (!ok) {
try {
inputRef.current?.select();
ok = document.execCommand('copy');
btnRef.current?.focus();
} catch {
ok = false;
}
}
if (!ok) {
setCopied(false);
setCopyErr(true);
return;
}
setCopyErr(false);
setCopied(true);
if (timer.current) clearTimeout(timer.current);
timer.current = setTimeout(() => setCopied(false), 2400);
onCopy?.(referralUrl);
};
const forcedCls = state === 'hover' ? ' is-hover' : state === 'active' ? ' is-press' : '';
const firstPending = actions.findIndex((a) => !done.includes(a.id));
const countLabel = (total === 1 ? c.entry : c.entries) + ' ' + (prizeName ? fill(c.toward, { prize: prizeName }) : c.inDraw);
const rootClass = ['cf-giveaway-boost', closed ? 'is-closed' : '', className ?? ''].filter(Boolean).join(' ');
const rules = rulesHref ? (
<p className='gb-quiet'>
<a href={rulesHref}>{c.rulesLine}</a>
</p>
) : null;
return (
<section className={rootClass} aria-labelledby={headingId}>
<style>{CSS}</style>
<div className='gb-band'>
{sceneImage ? <img className='gb-scene' src={sceneImage} alt='' aria-hidden='true' decoding='async' /> : null}
<div className='gb-scrim' aria-hidden='true' />
<div className='gb-top'>
<h2 id={headingId} className='gb-h'>{headline}</h2>
{lead.length > 0 ? (
<div className='gb-lead'>
{lead.map((line, i) => (
<p key={i} className={lead.length > 1 && i === lead.length - 1 ? 'gb-punch' : undefined}>{line}</p>
))}
</div>
) : null}
</div>
</div>
<div className='gb-stage'>
<div className='gb-card'>
<div className='gb-score'>
{prizeImage ? <img className='gb-prize' src={prizeImage} alt={prizeAlt} width={96} height={96} /> : null}
<div className='gb-tally'>
<p className='gb-count' aria-hidden='true'>
<span key={gain ? gain.k : 0} className={gain ? 'gb-num is-bump' : 'gb-num'}>{shown}</span>
{gain && gain.n > 0 ? (
<span key={'g' + gain.k} className='gb-gain'>{fill(c.gain, { n: gain.n })}</span>
) : null}
</p>
<p className='gb-count-label' aria-hidden='true'>{countLabel}</p>
<p className='gb-sr' aria-live='polite'>{fill(c.srCount, { count: total, label: countLabel })}</p>
</div>
</div>
{hasCap ? (
<div className='gb-meter'>
<div
className={maxed ? 'gb-bar is-max' : 'gb-bar'}
role='progressbar'
aria-label={c.meterAria}
aria-valuemin={0}
aria-valuemax={capValue}
aria-valuenow={total}
>
<span style={{ width: pct + '%' }} />
</div>
<p className='gb-meter-line'>
<span>{fill(c.capLine, { count: total, cap: capValue })}</span>
<span className={maxed ? 'is-max' : undefined}>
{maxed ? c.maxed : fill(c.remaining, { left: capValue - total })}
</span>
</p>
</div>
) : null}
{closed ? (
<p className='gb-meta'>
<Lock className='gb-ic-inline' aria-hidden='true' strokeWidth={2.5} />
{c.closed}
</p>
) : endDate ? (
<p className='gb-meta'>
<CalendarDays className='gb-ic-inline' aria-hidden='true' strokeWidth={2.5} />
{fill(c.closes, { date: endDate })}
</p>
) : null}
{actions.length > 0 ? (
<ol className={referralUrl ? 'gb-path has-end' : 'gb-path'} aria-label={c.pathAria}>
{actions.map((a, i) => {
const isDone = done.includes(a.id);
const key = a.icon ?? 'share';
const Icon = ICONS[key];
const verb = a.label ?? c.actionLabels[key];
const blocked = closed || (!isDone && maxed);
const n = Math.max(0, a.entries);
const titleId = 'gb-t-' + uid + '-' + i;
const forced = i === firstPending ? forcedCls : '';
const doneInner = (
<>
<Check aria-hidden='true' strokeWidth={2.5} />
{c.done}
</>
);
let control: React.ReactNode;
if (blocked && !isDone) {
control = (
<button type='button' className='gb-btn2' disabled aria-describedby={titleId}>
{maxed && !closed ? c.maxedButton : verb}
</button>
);
} else if (a.href) {
control = (
<a
className={'gb-btn2' + (isDone ? ' is-done' : forced)}
href={a.href}
target='_blank'
rel='noopener noreferrer'
aria-describedby={titleId}
onClick={() => complete(a)}
>
{isDone ? doneInner : verb}
</a>
);
} else {
control = (
<button
type='button'
className={'gb-btn2' + (isDone ? ' is-done' : forced)}
aria-disabled={isDone || undefined}
aria-describedby={titleId}
onClick={() => complete(a)}
>
{isDone ? doneInner : verb}
</button>
);
}
return (
<li
key={a.id}
className={isDone ? 'gb-stop is-done' : 'gb-stop'}
style={{ '--i': i } as React.CSSProperties}
>
<span className='gb-node' aria-hidden='true'>
{isDone ? <Check strokeWidth={3} /> : i + 1}
</span>
<div className='gb-body'>
<p className='gb-title' id={titleId}>
<Icon className='gb-ic' aria-hidden='true' strokeWidth={2.5} />
{a.title}
</p>
{a.detail ? <p className='gb-detail'>{a.detail}</p> : null}
</div>
<div className='gb-do'>
{n > 0 ? (
<span className={isDone ? 'gb-chip is-done' : 'gb-chip'}>
{isDone ? fill(c.added, { n }) : n === 1 ? c.chipOne : fill(c.chip, { n })}
</span>
) : null}
{control}
</div>
</li>
);
})}
</ol>
) : null}
{referralUrl ? (
<>
<div className={actions.length > 0 ? 'gb-linkstop' : 'gb-linkstop is-solo'}>
<span className='gb-node' aria-hidden='true'>
<Link2 strokeWidth={2.5} />
</span>
<div className='gb-body'>
<label className='gb-title' htmlFor={fieldId}>{c.linkTitle}</label>
<p className='gb-detail'>
{referralEntries && referralEntries > 0
? fill(c.linkDetailEntries, { n: referralEntries })
: c.linkDetail}
</p>
</div>
</div>
<div className='gb-linkbar'>
<input
ref={inputRef}
id={fieldId}
className='gb-field'
type='url'
readOnly
value={referralUrl}
placeholder={c.linkPlaceholder}
aria-invalid={showErr || undefined}
aria-describedby={showErr ? errId : undefined}
onFocus={(e) => e.currentTarget.select()}
/>
<button
ref={btnRef}
type='button'
className={'gb-copy' + forcedCls}
disabled={closed}
onClick={() => {
void copyLink();
}}
>
<span className='gb-copy-long'>{copied ? c.copied : c.copyLabel}</span>
<span className='gb-copy-short'>{copied ? c.copiedShort : c.copyShort}</span>
</button>
<span className='gb-sr' aria-live='polite'>{copied ? c.copied : ''}</span>
</div>
<div className='gb-linkfoot'>
{showErr ? (
<p id={errId} className='gb-err' role='alert'>
<AlertCircle className='gb-ic-inline' aria-hidden='true' strokeWidth={2.5} />
{c.copyError}
</p>
) : null}
{rules}
</div>
</>
) : rules ? (
<div className='gb-solo-rules'>{rules}</div>
) : null}
</div>
</div>
</section>
);
}
export default GiveawayBoost;
function fill(t: string, v: Record<string, string | number>): string {
return t.replace(/\{(\w+)\}/g, (m: string, k: string) => (k in v ? String(v[k]) : m));
}
// Shows the real value first; animates from the previous value only when it changes and motion is allowed.
function useCountUp(target: number): number {
const [shown, setShown] = React.useState(target);
const from = React.useRef(target);
React.useEffect(() => {
const start = from.current;
if (start === target) return;
const reduce =
typeof window === 'undefined' ||
typeof window.requestAnimationFrame !== 'function' ||
(window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)').matches : false);
if (reduce) {
from.current = target;
setShown(target);
return;
}
let raf = 0;
const t0 = performance.now();
const dur = 700;
const tick = (now: number) => {
const p = Math.min(1, (now - t0) / dur);
const eased = 1 - Math.pow(1 - p, 3);
const v = Math.round(start + (target - start) * eased);
from.current = v;
setShown(v);
if (p < 1) raf = window.requestAnimationFrame(tick);
};
raf = window.requestAnimationFrame(tick);
return () => window.cancelAnimationFrame(raf);
}, [target]);
return shown;
}
const R = '.cf-giveaway-boost';
const CSS = `
${R}{--gb-over:clamp(88px,12vw,168px);--gb-gutter:clamp(16px,5vw,48px);--gb-pad:clamp(20px,3vw,32px);position:relative;background:var(--surface);color:var(--ink);font-family:var(--font-body)}
${R} *{box-sizing:border-box}
${R} p{margin:0}
${R} .gb-band{position:relative;isolation:isolate;overflow:hidden;background:var(--band);color:var(--band-ink);padding:clamp(56px,8vw,112px) var(--gb-gutter) calc(var(--gb-over) + clamp(32px,4vw,48px))}
${R} .gb-scene{position:absolute;inset:0;z-index:-2;width:100%;height:100%;object-fit:cover;object-position:center 62%}
${R} .gb-scrim{position:absolute;inset:0;z-index:-1;background:oklch(from var(--band) l c h / .74)}
${R} .gb-top{max-width:46rem;margin:0 auto;text-align:center}
${R} .gb-h{margin:0;font-family:var(--font-display);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-.025em);text-transform:var(--display-case,none);text-wrap:balance;color:var(--band-ink)}
${R} .gb-lead{display:grid;gap:4px;margin-top:clamp(18px,1.8vw,24px);font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--band-ink);text-wrap:pretty}
${R} .gb-lead .gb-punch{margin-top:4px;font-weight:800}
${R} .gb-stage{position:relative;z-index:1;margin-top:calc(-1 * var(--gb-over));padding:0 var(--gb-gutter) clamp(64px,8.5vw,120px)}
${R} .gb-card{max-width:50rem;margin:0 auto;padding:var(--gb-pad);background:var(--card);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--ink) l c h / .12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(from var(--shadow,oklch(.22 .03 260)) l c h / .22),0 12px 24px -8px oklch(from var(--shadow,oklch(.22 .03 260)) l c h / .32)))}
${R} .gb-score{display:flex;align-items:center;gap:20px}
${R} .gb-prize{flex:0 0 auto;width:96px;height:96px;border-radius:8px;object-fit:cover;object-position:center}
${R} .gb-tally{min-width:0}
${R} .gb-count{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 12px}
${R} .gb-num{display:inline-block;transform-origin:left bottom;font-family:var(--font-display);font-size:clamp(4rem,9vw,6.5rem);line-height:.95;font-weight:var(--display-weight,800);letter-spacing:-.03em;font-variant-numeric:tabular-nums;color:var(--ink)}
${R} .gb-gain{display:inline-block;font-family:var(--font-display);font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1;font-weight:800;font-variant-numeric:tabular-nums;color:var(--success)}
${R} .gb-count-label{margin-top:12px;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.35;font-weight:700;color:var(--ink);text-wrap:balance}
${R} .gb-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}
${R} .gb-meter{margin-top:24px}
${R} .gb-bar{height:10px;overflow:hidden;border-radius:999px;background:color-mix(in oklch,var(--ink) 8%,var(--card))}
${R} .gb-bar>span{display:block;height:100%;border-radius:inherit;background:linear-gradient(90deg,oklch(from var(--accent-fill,var(--accent)) calc(l + .08) c h),var(--accent-fill,var(--accent)))}
${R} .gb-bar.is-max>span{background:var(--success)}
${R} .gb-meter-line{display:flex;flex-wrap:wrap;justify-content:space-between;gap:4px 16px;margin-top:12px;font-size:.9375rem;line-height:1.4;font-weight:600;font-variant-numeric:tabular-nums;color:var(--muted)}
${R} .gb-meter-line .is-max{font-weight:800;color:var(--success)}
${R} .gb-meta{margin-top:8px;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted);text-wrap:pretty}
${R} .gb-ic-inline{display:inline-block;width:16px;height:16px;vertical-align:-.15em;margin-inline-end:.4em}
${R} .gb-path{list-style:none;margin:24px 0 0;padding:8px 0 0;border-top:1px solid oklch(from var(--ink) l c h / .1)}
${R} .gb-stop{position:relative;display:grid;grid-template-columns:40px minmax(0,1fr) auto;gap:16px;align-items:start;padding-block:16px}
${R} .gb-stop::before{content:'';position:absolute;left:19px;top:56px;bottom:-16px;width:2px;border-radius:2px;background:oklch(from var(--ink) l c h / .14)}
${R} .gb-path:not(.has-end) .gb-stop:last-child::before{display:none}
${R} .gb-stop.is-done::before{background:var(--success)}
${R} .gb-node{position:relative;z-index:1;display:flex;align-items:center;justify-content:center;width:40px;height:40px;border-radius:999px;background:var(--card);color:var(--accent);font-family:var(--font-display);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1;font-weight:800;font-variant-numeric:tabular-nums}
${R} .gb-node svg{width:20px;height:20px}
${R} .gb-stop.is-done .gb-node{background:var(--success);color:var(--badge-glyph,#fff)}
${R} .gb-body{min-width:0}
${R} .gb-title{display:block;padding-top:8px;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.35;font-weight:700;color:var(--ink);text-wrap:pretty}
${R} .gb-ic{display:inline-block;width:18px;height:18px;vertical-align:-.18em;margin-inline-end:.45em;color:var(--accent)}
${R} .gb-detail{margin-top:4px;font-size:.9375rem;line-height:1.45;color:var(--muted);text-wrap:pretty}
${R} .gb-do{display:flex;align-items:center;gap:12px}
${R} .gb-chip{display:inline-flex;align-items:center;min-height:28px;padding:4px 12px;border-radius:999px;background:color-mix(in oklch,var(--ink) 6%,var(--card));color:var(--ink);font-size:.875rem;line-height:1.2;font-weight:800;font-variant-numeric:tabular-nums;white-space:nowrap}
${R} .gb-chip.is-done{background:var(--success-soft);color:var(--success)}
${R} .gb-btn2{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;min-width:8.5rem;padding:0 20px;border:1px solid var(--button-2-border,transparent);border-radius:var(--button-radius,var(--radius,12px));background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));box-shadow:var(--button-2-shadow,var(--shadow-sm));font-family:var(--button-font,var(--font-display));font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.15;font-weight:var(--button-weight,800);text-transform:var(--button-case,none);text-decoration:none;white-space:nowrap;cursor:pointer}
${R} .gb-btn2 svg{width:18px;height:18px;flex:0 0 auto}
${R} .gb-btn2:hover:not(:disabled):not(.is-done),${R} .gb-btn2.is-hover:not(:disabled){background:oklch(from var(--button-2-bg,var(--secondary)) calc(l - .045) c h)}
${R} .gb-btn2:active:not(:disabled):not(.is-done),${R} .gb-btn2.is-press:not(:disabled){transform:translateY(1px);box-shadow:none;background:oklch(from var(--button-2-bg,var(--secondary)) calc(l - .07) c h)}
${R} .gb-btn2.is-done{border-color:transparent;background:var(--success-soft);color:var(--success);box-shadow:none;cursor:default}
${R} .gb-btn2:disabled{border-color:transparent;background:color-mix(in oklch,var(--ink) 6%,var(--card));color:var(--muted);box-shadow:none;cursor:not-allowed}
${R} .gb-btn2:focus-visible,${R} .gb-copy:focus-visible{outline:3px solid oklch(from var(--field-focus,var(--accent)) l c h / .55);outline-offset:2px}
${R} .gb-linkstop{display:grid;grid-template-columns:40px minmax(0,1fr);gap:16px;align-items:start;padding-top:16px}
${R} .gb-linkstop.is-solo{margin-top:24px;border-top:1px solid oklch(from var(--ink) l c h / .1);padding-top:24px}
${R} .gb-linkbar{display:flex;gap:12px;margin:20px 0 0 56px}
${R} .gb-field{flex:1 1 auto;min-width:0;height:56px;padding:0 16px;border:1px solid var(--field-border,color-mix(in oklch,var(--ink) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));background:var(--field);color:var(--field-ink);font-family:var(--font-body);font-size:1.0625rem;font-weight:500;text-overflow:ellipsis}
${R} .gb-field::placeholder{color:color-mix(in oklch,var(--field-ink) 65%,var(--field));opacity:1}
${R} .gb-field: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)}
${R} .gb-field[aria-invalid='true']{border-color:var(--danger)}
${R} .gb-copy{flex:0 0 auto;display:inline-flex;align-items:center;justify-content:center;min-height:56px;min-width:12rem;padding:0 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l + .04) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .02) c h));color:var(--button-ink,var(--cta-ink));font-family:var(--button-font,var(--font-display));font-size:clamp(1.125rem,1.55vw,1.375rem);line-height:1.15;font-weight:var(--button-weight,800);text-transform:var(--button-case,none);text-shadow:var(--button-text-shadow,none);white-space:nowrap;cursor:pointer;box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--button-bg,var(--cta)) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) 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 / .45))}
${R} .gb-copy:hover:not(:disabled),${R} .gb-copy.is-hover:not(:disabled){background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l - .01) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .07) c h));box-shadow:inset 0 1px 0 oklch(from var(--button-bg,var(--cta)) calc(l + .1) c h / .7),inset 0 -3px 0 oklch(from var(--button-bg,var(--cta)) calc(l - .2) c h),0 1px 2px oklch(from var(--shadow,oklch(.22 .03 260)) l c h / .34),0 10px 18px -6px oklch(from var(--shadow,oklch(.22 .03 260)) l c h / .5)}
${R} .gb-copy:active:not(:disabled),${R} .gb-copy.is-press:not(:disabled){transform:translateY(1px);background:linear-gradient(oklch(from var(--button-bg,var(--cta)) calc(l - .04) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .08) c h));box-shadow:inset 0 2px 3px oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .2) c h / .55),inset 0 -2px 0 oklch(from var(--button-bg,var(--cta)) calc(l - .16) c h),0 1px 2px oklch(from var(--shadow,oklch(.22 .03 260)) l c h / .3)}
${R} .gb-copy:disabled{background:color-mix(in oklch,var(--ink) 8%,var(--card));color:var(--muted);text-shadow:none;box-shadow:none;cursor:not-allowed}
${R} .gb-copy-short{display:none}
${R} .gb-linkfoot{margin-left:56px}
${R} .gb-err{margin-top:8px;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--danger);text-wrap:pretty}
${R} .gb-quiet{margin-top:12px;font-size:.9375rem;line-height:1.4;color:var(--muted)}
${R} .gb-solo-rules{margin-top:16px}
${R} .gb-quiet a{font-weight:600;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}
${R} .gb-quiet a:hover{color:oklch(from var(--link,var(--accent)) calc(l - .08) c h);text-decoration-color:currentColor}
${R} .gb-quiet a:focus-visible{outline:3px solid oklch(from var(--field-focus,var(--accent)) l c h / .55);outline-offset:2px;border-radius:4px}
@media (max-width:760px){
${R} .gb-score{gap:16px}
${R} .gb-prize{width:72px;height:72px}
${R} .gb-stop{grid-template-columns:40px minmax(0,1fr);gap:12px 16px}
${R} .gb-do{grid-column:2}
${R} .gb-btn2{flex:1 1 auto;min-width:0}
${R} .gb-linkbar{flex-direction:column;gap:12px;margin:20px 0 0}
${R} .gb-field{flex:0 0 auto;width:100%;height:56px;padding:0 16px;font-size:1.0625rem}
${R} .gb-copy{width:100%;min-width:0;min-height:64px;padding:0 24px}
${R} .gb-linkfoot{margin-left:0}
${R} .gb-quiet{text-align:center}
}
@media (prefers-reduced-motion:no-preference){
${R} .gb-top>*,${R} .gb-card{animation:cfGbRise .45s cubic-bezier(.2,.7,.2,1) both}
${R} .gb-top>*:nth-child(2){animation-delay:.07s}
${R} .gb-stop{animation:cfGbRise .45s cubic-bezier(.2,.7,.2,1) both;animation-delay:min(calc(var(--i,0) * .07s + .07s),.28s)}
${R} .gb-num.is-bump,${R} .gb-gain,${R} .gb-stop.is-done .gb-node{animation:cfGbPop .3s cubic-bezier(.2,.7,.2,1) both}
${R} .gb-bar>span{transition:width .6s cubic-bezier(.2,.7,.2,1)}
${R} .gb-btn2,${R} .gb-copy{transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
}
@keyframes cfGbRise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes cfGbPop{from{transform:scale(.9)}to{transform:none}}
`;
pieces/forms/giveaway-boost/specimen.tsx 64 lines
import __studioImage76364917 from "../assets/528640a8594e57f5.webp";
import __studioImage5570452a from "../assets/c8a1de5f68e52e4f.webp";
import { GiveawayBoost, type GiveawayBoostProps } from '../giveaway-boost';
import { slot } from '../../slots';
export const states = ['default', 'hover', 'active', 'disabled', 'error', 'success'];
export default function GiveawayBoostSpecimen({ state }: { state?: GiveawayBoostProps['state'] }) {
return (
<GiveawayBoost
key={state ?? 'default'}
state={state}
headline='You’re in. Now grow your chances.'
lead={[
'Your entry for the Greenway backyard makeover is in the draw.',
'Every step below plants more entries.',
'Simple.',
]}
sceneImage={slot('scene', __studioImage76364917)}
prizeImage={slot('product', __studioImage5570452a)}
prizeAlt='A finished Greenway backyard with cedar raised beds beside a stone path'
prizeName='Greenway backyard makeover'
baseEntries={1}
cap={20}
endDate='Sunday, May 31 at 8 pm'
rulesHref='#giveaway-rules'
referralUrl='https://greenway-landscaping.example/makeover?ref=jordan-r7k2'
referralEntries={5}
completed={['follow']}
actions={[
{
id: 'follow',
icon: 'follow',
title: 'Follow Greenway for weekly garden tips',
detail: 'Short planting ideas from our crew, every Friday.',
entries: 2,
},
{
id: 'share',
icon: 'share',
title: 'Share the giveaway with your neighbours',
detail: 'Post it wherever your friends will see it.',
entries: 3,
},
{
id: 'email',
icon: 'email',
title: 'Get the spring planting guide by email',
detail: 'One email a month. Unsubscribe anytime.',
entries: 2,
label: 'Send it',
},
{
id: 'gallery',
icon: 'visit',
title: 'Browse the before-and-after gallery',
detail: 'See what a Greenway makeover looks like.',
entries: 1,
label: 'Browse',
},
]}
/>
);
}
| Name | Type | Details |
|---|---|---|
headline OptionalGiveawayBoost |
React.ReactNode |
|
lead OptionalGiveawayBoost |
React.ReactNode[] |
|
sceneImage OptionalGiveawayBoost |
string |
|
prizeImage OptionalGiveawayBoost |
string |
|
prizeAlt OptionalGiveawayBoost |
string |
|
prizeName OptionalGiveawayBoost |
string |
|
baseEntries OptionalGiveawayBoost |
number |
|
cap OptionalGiveawayBoost |
number |
|
endDate OptionalGiveawayBoost |
string |
|
rulesHref OptionalGiveawayBoost |
string |
|
actions OptionalGiveawayBoost |
GiveawayBoostAction[] |
|
completed OptionalGiveawayBoost |
string[] |
|
referralUrl OptionalGiveawayBoost |
string |
|
referralEntries OptionalGiveawayBoost |
number |
|
onAction OptionalGiveawayBoost |
(id: string) => void |
|
onCopy OptionalGiveawayBoost |
(url: string) => void |
|
copy OptionalGiveawayBoost |
Partial<GiveawayBoostCopy> |
|
state OptionalGiveawayBoost |
'default' | 'hover' | 'active' | 'disabled' | 'error' | 'success' |
|
className OptionalGiveawayBoost |
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.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
product- The main product shot or cover (ebook, kit, bottle).
scene- A wide atmosphere photo behind or beside the copy.
-
528640a8594e57f5.webp
image/webp · 211 KB
-
c8a1de5f68e52e4f.webp
image/webp · 149 KB