Giveaway Entry 1
Giveaway entry block: the prize, its value and the close date set as a scoreboard that ends on the entry form. After entry, a share panel turns each referred friend into bonus entries.
Use it in a prompt
Use forms/giveaway-entry 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-entry.tsx. - Import it and pass your copy and images (Props tab):
import { GiveawayEntry } from "@/components/funneldna/forms/giveaway-entry"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/forms/giveaway-entry/component.tsx 682 lines
// layout: fact-scoreboard
// Giveaway entry block: the prize, its value and the close date set as a scoreboard that ends on the entry form. After entry, a share panel turns each referred friend into bonus entries.
import React, { useEffect, useId, useRef, useState } from 'react';
import { AlertCircle, Check, Copy, Loader2, Lock, Mail, Share2 } from 'lucide-react';
export type GiveawayEntryValues = { name: string; email: string };
export type GiveawayPrizeItem = {
name: string;
detail?: string;
/** Value pill, e.g. $49 (supplied facts only). */
value?: string;
/** Item photo src (slot item-n). */
image?: string;
imageAlt?: string;
};
/** An extra scoreboard tile: a supplied number or fact and what it means. */
export type GiveawayFact = { value: string; label: string };
export type GiveawayEntryCopy = {
prizeValueLabel: string;
/** Small line under the prize value label; empty hides it. */
prizeValueNote: string;
endsLabel: string;
/** Placeholders: {weekday}, {time}, {zone}. */
endsNote: string;
itemsHeading: string;
formTitle: string;
formLead: string;
nameLabel: string;
namePlaceholder: string;
emailLabel: string;
emailPlaceholder: string;
buttonLabel: string;
pendingLabel: string;
/** Line under the button; empty hides it. */
reassurance: string;
legal: string;
rulesLabel: string;
nameError: string;
emailError: string;
submitError: string;
shareTitle: string;
/** Placeholder: {count}; used when bonusEntries is above 1. */
shareLead: string;
/** Used when bonusEntries is 1. */
shareLeadOne: string;
/** Used when bonusEntries is not set. */
shareLeadGeneric: string;
linkLabel: string;
linkPlaceholder: string;
copyLabel: string;
copiedLabel: string;
copyFallback: string;
emailShareLabel: string;
shareSubject: string;
/** Placeholder: {link}. */
shareBody: string;
};
export type GiveawayEntryProps = {
headline?: React.ReactNode;
lead?: React.ReactNode;
prizeName?: string;
prizeDetail?: string;
/** Flag on the prize tile, e.g. Grand prize. Empty hides it. */
prizeLabel?: string;
/** Slot product: the prize shot on a transparent background. */
prizeImage?: string;
prizeImageAlt?: string;
/** Supplied prize value, e.g. $97. Empty hides the tile. */
prizeValue?: string;
/** Supplied close date-time, ISO 8601 with offset, e.g. 2026-12-15T23:59:00-06:00. Empty hides the tile. */
endsAt?: string;
/** The giveaway time zone (IANA), e.g. America/Chicago. The close date is shown in it. */
timeZone?: string;
locale?: string;
/** Extra scoreboard tiles, supplied facts only. */
facts?: GiveawayFact[];
/** What the winner gets, numbered. */
items?: GiveawayPrizeItem[];
/** Closing line under the prize contents, e.g. how the winner is picked. */
drawNote?: string;
/** Bonus entries per referred friend, as set by the rules. */
bonusEntries?: number;
/** Base URL the referral code is added to (defaults to the current page). */
shareUrl?: string;
/** A ready-made referral link from the builder; overrides the local one. */
referralLink?: string;
/** Controlled entry state; omit to show the share panel after a successful submit. */
entered?: boolean;
rulesHref?: string;
copy?: Partial<GiveawayEntryCopy>;
/** Validated entry. Return false or throw to show the retry message. */
onSubmit?: (values: GiveawayEntryValues) => void | boolean | Promise<void | boolean>;
/** Called when the visitor copies or emails their link. */
onShare?: (link: string, method: 'copy' | 'email') => void;
state?: 'default' | 'hover' | 'active' | 'disabled' | 'error' | 'success';
className?: string;
};
export function GiveawayEntry(props: GiveawayEntryProps) {
const {
headline = 'Enter for your chance to win',
lead = 'Add your name and email for a free entry, then share your link for bonus entries.',
prizeName = '',
prizeDetail = '',
prizeLabel = 'Grand prize',
prizeImage = '',
prizeImageAlt,
prizeValue = '',
endsAt = '',
timeZone = 'UTC',
locale = 'en-US',
facts = [],
items = [],
drawNote = '',
bonusEntries,
shareUrl,
referralLink,
entered,
rulesHref = '#official-rules',
onSubmit,
onShare,
state = 'default',
className = '',
} = props;
const copy: GiveawayEntryCopy = { ...DEFAULT_COPY, ...props.copy };
const uid = useId().replace(/[^a-zA-Z0-9_-]/g, '');
const id = (key: string) => `gw-${key}-${uid}`;
const [values, setValues] = useState<GiveawayEntryValues>(() => sampleValues(state));
const [errors, setErrors] = useState<FieldErrors>(() => (state === 'error' ? check(sampleValues(state)) : CLEAR));
const [attempted, setAttempted] = useState(state === 'error');
const [status, setStatus] = useState<Status>(state === 'success' ? 'entered' : 'idle');
const [failed, setFailed] = useState(false);
const [copied, setCopied] = useState(false);
const [copyHint, setCopyHint] = useState(false);
const mounted = useRef(true);
const justEntered = useRef(false);
const prizeRef = useRef<HTMLElement>(null);
const nameRef = useRef<HTMLInputElement>(null);
const emailRef = useRef<HTMLInputElement>(null);
const linkRef = useRef<HTMLInputElement>(null);
const shareHeadingRef = useRef<HTMLHeadingElement>(null);
useEffect(() => {
mounted.current = true;
return () => {
mounted.current = false;
};
}, []);
useEffect(() => {
const start = sampleValues(state);
setValues(start);
setErrors(state === 'error' ? check(start) : CLEAR);
setAttempted(state === 'error');
setStatus(state === 'success' ? 'entered' : 'idle');
setFailed(false);
setCopied(false);
setCopyHint(false);
}, [state]);
useEffect(() => {
if (!copied) return;
const timer = window.setTimeout(() => setCopied(false), 2200);
return () => window.clearTimeout(timer);
}, [copied]);
const isEntered = entered ?? status === 'entered';
const disabled = state === 'disabled';
const pending = status === 'pending';
useEffect(() => {
if (isEntered && justEntered.current) {
justEntered.current = false;
shareHeadingRef.current?.focus();
}
}, [isEntered]);
const update = (field: keyof GiveawayEntryValues) => (event: React.ChangeEvent<HTMLInputElement>) => {
const next = { ...values, [field]: event.target.value };
setValues(next);
if (attempted) setErrors(check(next));
if (failed) setFailed(false);
};
const recheck = () => {
if (attempted) setErrors(check(values));
};
async function submit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault();
if (disabled || pending) return;
const found = check(values);
setAttempted(true);
setErrors(found);
if (found.name || found.email) {
(found.name ? nameRef : emailRef).current?.focus();
return;
}
setFailed(false);
setStatus('pending');
try {
const result = await onSubmit?.({ name: values.name.trim(), email: values.email.trim() });
if (!mounted.current) return;
if (result === false) {
setStatus('idle');
setFailed(true);
return;
}
justEntered.current = true;
setStatus('entered');
} catch {
if (!mounted.current) return;
setStatus('idle');
setFailed(true);
}
}
function tilt(event: React.PointerEvent<HTMLElement>) {
const el = prizeRef.current;
if (!el || event.pointerType !== 'mouse') return;
if (window.matchMedia?.('(prefers-reduced-motion: reduce)')?.matches) return;
const box = el.getBoundingClientRect();
const x = (event.clientX - box.left) / box.width - 0.5;
const y = (event.clientY - box.top) / box.height - 0.5;
el.style.setProperty('--gw-ry', `${(x * 6).toFixed(2)}deg`);
el.style.setProperty('--gw-rx', `${(y * -6).toFixed(2)}deg`);
el.style.setProperty('--gw-lift', '-4px');
}
function untilt() {
const el = prizeRef.current;
if (!el) return;
el.style.removeProperty('--gw-ry');
el.style.removeProperty('--gw-rx');
el.style.removeProperty('--gw-lift');
}
const link = referralLink || referralFor(shareUrl, values.email);
const shareLead =
bonusEntries === undefined
? copy.shareLeadGeneric
: bonusEntries === 1
? copy.shareLeadOne
: fill(copy.shareLead, { count: String(bonusEntries) });
const mailto = `mailto:?subject=${encodeURIComponent(copy.shareSubject)}&body=${encodeURIComponent(fill(copy.shareBody, { link }))}`;
async function copyLink() {
onShare?.(link, 'copy');
try {
if (!navigator.clipboard?.writeText) throw new Error('clipboard unavailable');
await navigator.clipboard.writeText(link);
if (!mounted.current) return;
setCopyHint(false);
setCopied(true);
} catch {
linkRef.current?.focus();
linkRef.current?.select();
if (mounted.current) setCopyHint(true);
}
}
const ends = formatEnds(endsAt, timeZone, locale);
const stats: Stat[] = [];
if (prizeValue) {
stats.push({ key: 'value', visual: <Superscript value={prizeValue} />, spoken: prizeValue, label: copy.prizeValueLabel, note: copy.prizeValueNote });
}
if (ends) {
stats.push({
key: 'ends',
visual: <time dateTime={ends.iso}>{ends.day}</time>,
spoken: ends.full,
label: copy.endsLabel,
note: fill(copy.endsNote, { weekday: ends.weekday, time: keepTogether(ends.time), zone: keepTogether(ends.zone) }),
});
}
facts.forEach((fact, index) => {
if (fact.value) stats.push({ key: `fact-${index}`, visual: fact.value, spoken: fact.value, label: fact.label });
});
const hasStats = stats.length > 0;
const hasItems = items.length > 0;
let tileIndex = 0;
const nextVars = () => ({ '--i': Math.min(tileIndex++, 4) }) as React.CSSProperties;
const forced = state === 'hover' ? ' is-hover' : state === 'active' ? ' is-active' : '';
return (
<section className={`cf-giveaway-entry${className ? ` ${className}` : ''}`} aria-labelledby={id('title')}>
<style>{CSS}</style>
<div className='gw-wrap'>
<header className='gw-head'>
<h2 id={id('title')} className='gw-h2'>{headline}</h2>
{lead ? <p className='gw-lead'>{lead}</p> : null}
</header>
<div className={`gw-board${hasStats ? '' : ' is-no-stats'}${hasItems ? '' : ' is-no-items'}`}>
<article ref={prizeRef} className='gw-tile gw-prize' style={nextVars()} onPointerMove={tilt} onPointerLeave={untilt}>
{prizeLabel ? <span className='gw-flag'>{prizeLabel}</span> : null}
{prizeImage ? (
<div className='gw-stage'>
<img className='gw-prize-img' src={prizeImage} alt={prizeImageAlt || prizeName} width={640} height={640} decoding='async' />
</div>
) : null}
{prizeName || prizeDetail ? (
<div className='gw-prize-copy'>
{prizeName ? <h3 className='gw-h3'>{prizeName}</h3> : null}
{prizeDetail ? <p className='gw-prize-detail'>{prizeDetail}</p> : null}
</div>
) : null}
</article>
{hasStats ? (
<div className='gw-stats'>
{stats.map((stat) => (
<div key={stat.key} className='gw-tile gw-stat' style={nextVars()}>
<p className='gw-num'>
<span aria-hidden='true'>{stat.visual}</span>
<span className='gw-sr'>{stat.spoken}</span>
</p>
<div className='gw-stat-meta'>
<p className='gw-stat-label'>{stat.label}</p>
{stat.note ? <p className='gw-stat-note'>{stat.note}</p> : null}
</div>
</div>
))}
</div>
) : null}
{hasItems ? (
<div className='gw-tile gw-items' style={nextVars()}>
{copy.itemsHeading ? <h3 className='gw-h3'>{copy.itemsHeading}</h3> : null}
<ol className='gw-list'>
{items.map((item, index) => (
<li key={`${item.name}-${index}`} className={`gw-item${item.image ? '' : ' is-text'}`}>
<span className='gw-idx' aria-hidden='true'>{index + 1}</span>
{item.image ? (
<img className='gw-thumb' src={item.image} alt={item.imageAlt || item.name} width={160} height={160} loading='lazy' decoding='async' />
) : null}
<div className='gw-item-copy'>
<p className='gw-item-name'>{item.name}</p>
{item.detail ? <p className='gw-item-detail'>{item.detail}</p> : null}
</div>
{item.value ? <span className='gw-pill'>{item.value}</span> : null}
</li>
))}
</ol>
{drawNote ? <p className='gw-draw'>{drawNote}</p> : null}
</div>
) : null}
<div className='gw-tile gw-action' style={nextVars()}>
{isEntered ? (
<div className='gw-share'>
<span className='gw-disc' aria-hidden='true'>
<Share2 size={20} strokeWidth={2.5} />
</span>
<h3 ref={shareHeadingRef} tabIndex={-1} className='gw-h3'>{copy.shareTitle}</h3>
<p className='gw-sub'>{shareLead}</p>
<label className='gw-label' htmlFor={id('link')}>{copy.linkLabel}</label>
<div className='gw-copyrow'>
<input
ref={linkRef}
id={id('link')}
className='gw-input gw-input--link'
type='url'
readOnly
value={link}
placeholder={copy.linkPlaceholder}
onFocus={(event) => event.currentTarget.select()}
/>
<button type='button' className={`gw-btn gw-btn--copy${copied ? ' is-copied' : ''}`} onClick={copyLink}>
{copied ? <Check size={20} strokeWidth={2.5} aria-hidden='true' /> : <Copy size={20} strokeWidth={2.5} aria-hidden='true' />}
<span>{copied ? copy.copiedLabel : copy.copyLabel}</span>
</button>
</div>
<p className={copyHint ? 'gw-hint' : 'gw-sr'} aria-live='polite'>
{copied ? copy.copiedLabel : copyHint ? copy.copyFallback : ''}
</p>
<a className='gw-link gw-mail' href={mailto} onClick={() => onShare?.(link, 'email')}>
<Mail size={18} strokeWidth={2.5} aria-hidden='true' />
{copy.emailShareLabel}
</a>
</div>
) : (
<form className='gw-form' noValidate onSubmit={submit} aria-labelledby={id('form')}>
<h3 id={id('form')} className='gw-h3'>{copy.formTitle}</h3>
{copy.formLead ? <p className='gw-sub'>{copy.formLead}</p> : null}
<fieldset className='gw-fields' disabled={disabled}>
<div className='gw-field'>
<label className='gw-label' htmlFor={id('name')}>{copy.nameLabel}</label>
<input
ref={nameRef}
id={id('name')}
name='name'
type='text'
autoComplete='name'
className='gw-input'
placeholder={copy.namePlaceholder}
value={values.name}
onChange={update('name')}
onBlur={recheck}
aria-invalid={errors.name || undefined}
aria-describedby={errors.name ? id('name-err') : undefined}
required
/>
{errors.name ? (
<p id={id('name-err')} className='gw-err'>
<AlertCircle size={16} strokeWidth={2.5} aria-hidden='true' />
{copy.nameError}
</p>
) : null}
</div>
<div className='gw-field'>
<label className='gw-label' htmlFor={id('email')}>{copy.emailLabel}</label>
<input
ref={emailRef}
id={id('email')}
name='email'
type='email'
inputMode='email'
autoComplete='email'
spellCheck={false}
className='gw-input'
placeholder={copy.emailPlaceholder}
value={values.email}
onChange={update('email')}
onBlur={recheck}
aria-invalid={errors.email || undefined}
aria-describedby={errors.email ? id('email-err') : undefined}
required
/>
{errors.email ? (
<p id={id('email-err')} className='gw-err'>
<AlertCircle size={16} strokeWidth={2.5} aria-hidden='true' />
{copy.emailError}
</p>
) : null}
</div>
</fieldset>
{failed ? (
<p className='gw-form-error' role='alert'>
<AlertCircle size={16} strokeWidth={2.5} aria-hidden='true' />
{copy.submitError}
</p>
) : null}
<button type='submit' className={`gw-btn${forced}`} disabled={disabled || pending} aria-busy={pending || undefined}>
{pending ? <Loader2 className='gw-spin' size={20} strokeWidth={2.5} aria-hidden='true' /> : null}
<span>{pending ? copy.pendingLabel : copy.buttonLabel}</span>
</button>
{copy.reassurance ? (
<p className='gw-reassure'>
<Lock size={16} strokeWidth={2.5} aria-hidden='true' />
{copy.reassurance}
</p>
) : null}
</form>
)}
{copy.legal || rulesHref ? (
<p className='gw-fine'>
{copy.legal}
{copy.legal && rulesHref ? ' ' : null}
{rulesHref ? <a className='gw-link' href={rulesHref}>{copy.rulesLabel}</a> : null}
</p>
) : null}
</div>
</div>
</div>
</section>
);
}
export default GiveawayEntry;
const DEFAULT_COPY: GiveawayEntryCopy = {
prizeValueLabel: 'Prize value',
prizeValueNote: '',
endsLabel: 'Entries close',
endsNote: '{weekday} · {time}\u00a0{zone}',
itemsHeading: 'Here’s everything the winner gets',
formTitle: 'Claim your free entry',
formLead: 'Add your name and email for one entry into the draw.',
nameLabel: 'Your name',
namePlaceholder: 'Jane Smith',
emailLabel: 'Email address',
emailPlaceholder: 'you@example.com',
buttonLabel: 'Enter The Giveaway',
pendingLabel: 'Saving your entry…',
reassurance: '',
legal: 'No purchase necessary to enter or win.',
rulesLabel: 'Read the official rules',
nameError: 'Please enter your name.',
emailError: 'Enter a valid email, like you@example.com.',
submitError: 'We couldn’t save your entry. Please try again.',
shareTitle: 'Get bonus entries for every friend who enters',
shareLead: 'Share your personal link. Each friend who enters with it adds {count} bonus entries to yours.',
shareLeadOne: 'Share your personal link. Each friend who enters with it adds 1 bonus entry to yours.',
shareLeadGeneric: 'Share your personal link. Each friend who enters with it earns you bonus entries.',
linkLabel: 'Your referral link',
linkPlaceholder: 'https://example.com/giveaway?ref=ABC123',
copyLabel: 'Copy My Link',
copiedLabel: 'Link Copied',
copyFallback: 'Your link is selected. Press Ctrl+C or ⌘C to copy it.',
emailShareLabel: 'Email it to a friend',
shareSubject: 'Enter this giveaway with me',
shareBody: 'I just entered this giveaway. Enter with my link: {link}',
};
const EMAIL_RE = /^[^@ ]+@[^@ ]+[.][^@ ]{2,}$/;
type Status = 'idle' | 'pending' | 'entered';
type FieldErrors = { name: boolean; email: boolean };
type Stat = { key: string; visual: React.ReactNode; spoken: string; label: string; note?: string };
const CLEAR: FieldErrors = { name: false, email: false };
function sampleValues(state?: string): GiveawayEntryValues {
if (state === 'error') return { name: '', email: 'jane@example' };
if (state === 'success') return { name: 'Jane Smith', email: 'jane@example.com' };
return { name: '', email: '' };
}
function check(values: GiveawayEntryValues): FieldErrors {
return { name: !values.name.trim(), email: !EMAIL_RE.test(values.email.trim()) };
}
function keepTogether(text: string) {
return text.replace(/\s+/g, '\u00a0');
}
function fill(template: string, map: Record<string, string>) {
return Object.keys(map).reduce((text, key) => text.split(`{${key}}`).join(map[key]), template);
}
function referralCode(seed: string) {
let hash = 2166136261;
for (let i = 0; i < seed.length; i += 1) {
hash ^= seed.charCodeAt(i);
hash = Math.imul(hash, 16777619);
}
return (hash >>> 0).toString(36).toUpperCase().padStart(6, '0').slice(-6);
}
function referralFor(base: string | undefined, email: string) {
let root = base || '';
if (!root && typeof window !== 'undefined' && /^https?:/.test(window.location.href)) {
root = window.location.origin + window.location.pathname;
}
if (!root) root = 'https://example.com/giveaway';
return `${root}${root.includes('?') ? '&' : '?'}ref=${referralCode(email.trim().toLowerCase() || 'entry')}`;
}
function formatEnds(iso: string, timeZone: string, locale: string) {
if (!iso) return null;
const date = new Date(iso);
if (Number.isNaN(date.getTime())) return null;
try {
const part = (options: Intl.DateTimeFormatOptions) => new Intl.DateTimeFormat(locale, { timeZone, ...options });
const zone =
part({ hour: 'numeric', timeZoneName: 'short' })
.formatToParts(date)
.find((p) => p.type === 'timeZoneName')?.value || timeZone;
return {
iso: date.toISOString(),
day: part({ month: 'short', day: 'numeric' }).format(date),
weekday: part({ weekday: 'short' }).format(date),
time: part({ hour: 'numeric', minute: '2-digit' }).format(date),
zone,
full: part({ dateStyle: 'full', timeStyle: 'long' }).format(date),
};
} catch {
return null;
}
}
// private
function Superscript({ value }: { value: string }) {
const match = value.match(/^([^0-9]*?)([0-9][0-9.,]*)(.*)$/);
if (!match) return <>{value}</>;
const [, lead, figure, tail] = match;
return (
<>
{lead.trim() ? <span className='gw-sup'>{lead.trim()}</span> : null}
{figure}
{tail ? <span className='gw-tail'>{tail}</span> : null}
</>
);
}
const S = '.cf-giveaway-entry';
const CSS = `
${S}{--gw-band:var(--band,oklch(0.27 0.067 256));--gw-band-ink:var(--band-ink,#ffffff);--gw-tile:color-mix(in oklab,var(--gw-band-ink) 7%,var(--gw-band));--gw-line:oklch(from var(--gw-band-ink) l c h / 0.14);--gw-soft-ink:color-mix(in oklab,var(--gw-band-ink) 84%,var(--gw-band));--gw-shadow:var(--shadow,oklch(0.22 0.03 260));--gw-btn:var(--button-bg,var(--cta,oklch(0.58 0.21 29)));--gw-btn-2:var(--button-bg-2,var(--cta-2,oklch(0.51 0.21 29)));--gw-link:var(--link,var(--accent,oklch(0.5 0.17 257)));--gw-focus:var(--field-focus,var(--accent,oklch(0.5 0.17 257)));position:relative;background:var(--gw-band);color:var(--gw-band-ink);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)}
${S} *,${S} *::before,${S} *::after{box-sizing:border-box}
${S} .gw-wrap{max-width:1120px;margin:0 auto}
${S} .gw-head{max-width:46rem;margin:0 auto clamp(32px,4vw,48px);text-align:center}
${S} .gw-h2{margin:0;font-family:var(--font-display,inherit);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);text-wrap:balance;color:var(--gw-band-ink)}
${S} .gw-lead{margin:16px auto 0;max-width:40rem;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;text-wrap:pretty;color:var(--gw-band-ink)}
${S} .gw-board{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;align-items:stretch}
${S} .gw-prize{grid-column:1/3}
${S} .gw-stats{grid-column:3/5;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
${S} .gw-stats>:last-child:nth-child(odd){grid-column:1/-1}
${S} .gw-items{grid-column:1/3}
${S} .gw-action{grid-column:3/5}
${S} .is-no-stats .gw-prize{grid-column:1/-1}
${S} .is-no-items .gw-action{grid-column:1/-1;justify-self:center;width:min(100%,40rem)}
${S} .gw-tile{position:relative;min-width:0;padding:clamp(20px,3vw,32px);border-radius:var(--card-radius,var(--radius,14px));background:var(--gw-tile);border:1px solid var(--gw-line);box-shadow:inset 0 1px 0 oklch(from var(--gw-band-ink) l c h / 0.06)}
${S} .gw-h3{margin:0;font-family:var(--font-display,inherit);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;font-weight:var(--display-weight,800);letter-spacing:-0.01em;text-transform:var(--display-case,none);text-wrap:balance}
${S} .gw-prize{display:flex;flex-direction:column;gap:16px;transition:border-color .16s ease}
${S} .gw-prize:hover{border-color:oklch(from var(--gw-band-ink) l c h / 0.24)}
${S} .gw-flag{align-self:flex-start;display:inline-flex;align-items:center;min-height:28px;padding:4px 12px;border-radius:999px;background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card,#ffffff));font-size:0.875rem;line-height:1.2;font-weight:800;letter-spacing:0.01em}
${S} .gw-stage{flex:1;display:grid;place-items:center;min-height:0;padding-block:4px;perspective:900px}
${S} .gw-prize-img{display:block;width:min(100%,clamp(220px,20vw,272px));height:auto;aspect-ratio:1/1;object-fit:contain;object-position:center;filter:drop-shadow(0 2px 3px oklch(from var(--gw-shadow) l c h / 0.45)) drop-shadow(0 14px 14px oklch(from var(--gw-shadow) l c h / 0.36))}
${S} .gw-prize .gw-h3{color:var(--gw-band-ink)}
${S} .gw-prize-detail{margin:8px 0 0;max-width:64ch;line-height:1.5;color:var(--gw-soft-ink);text-wrap:pretty}
${S} .gw-stat{container-type:inline-size;display:flex;flex-direction:column;gap:16px;min-height:clamp(150px,14vw,172px)}
${S} .gw-num{position:relative;margin:0;font-family:var(--font-display,inherit);font-size:clamp(2rem,28cqi,3.75rem);line-height:1;font-weight:var(--display-weight,800);letter-spacing:-0.03em;font-variant-numeric:tabular-nums;color:var(--gw-band-ink);overflow-wrap:anywhere}
${S} .gw-sup{display:inline-block;font-size:0.46em;line-height:1;vertical-align:0.82em;margin-right:0.04em;letter-spacing:0}
${S} .gw-tail{font-size:0.5em;letter-spacing:0}
${S} .gw-stat-meta{margin-top:auto}
${S} .gw-stat-label{margin:0;font-size:0.9375rem;line-height:1.4;font-weight:700;color:var(--gw-band-ink);text-wrap:pretty}
${S} .gw-stat-note{margin:4px 0 0;font-size:0.9375rem;line-height:1.4;font-weight:500;color:var(--gw-soft-ink);text-wrap:pretty}
${S} .gw-items{container-type:inline-size;display:flex;flex-direction:column}
${S} .gw-items .gw-h3{color:var(--gw-band-ink)}
${S} .gw-list{list-style:none;margin:24px 0 0;padding:0;display:grid;gap:20px}
${S} .gw-item{display:grid;grid-template-columns:auto 80px minmax(0,1fr) auto;column-gap:16px;row-gap:8px;align-items:start}
${S} .gw-item.is-text{grid-template-columns:auto minmax(0,1fr) auto}
${S} .gw-idx{min-width:1.1ch;font-family:var(--font-display,inherit);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;font-weight:var(--display-weight,800);font-variant-numeric:tabular-nums;color:var(--gw-band-ink)}
${S} .gw-thumb{display:block;width:80px;height:80px;border-radius:8px;object-fit:cover;object-position:center}
${S} .gw-item-name{margin:0;font-weight:700;line-height:1.35;color:var(--gw-band-ink);text-wrap:pretty}
${S} .gw-item-detail{margin:4px 0 0;font-size:0.9375rem;line-height:1.45;color:var(--gw-soft-ink);text-wrap:pretty}
${S} .gw-pill{display:inline-flex;align-items:center;min-height:28px;padding:4px 12px;border-radius:999px;background:oklch(from var(--gw-band-ink) l c h / 0.12);color:var(--gw-band-ink);font-size:0.875rem;line-height:1.2;font-weight:800;font-variant-numeric:tabular-nums;white-space:nowrap}
${S} .gw-draw{margin:auto 0 0;padding-top:24px;font-size:0.9375rem;line-height:1.45;font-weight:500;color:var(--gw-soft-ink);text-wrap:pretty}
@container (max-width:440px){${S} .gw-item{grid-template-columns:auto 64px minmax(0,1fr);column-gap:12px}${S} .gw-item.is-text{grid-template-columns:auto minmax(0,1fr)}${S} .gw-thumb{width:64px;height:64px}${S} .gw-pill{grid-column:3;justify-self:start}${S} .gw-item.is-text .gw-pill{grid-column:2}}
${S} .gw-tile.gw-action{container-type:inline-size;display:flex;flex-direction:column;background:var(--card,#ffffff);color:var(--ink,#101828);border:1px solid var(--card-border,oklch(from var(--ink,#101828) l c h / 0.12));box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(from var(--gw-shadow) l c h / 0.22),0 12px 24px -8px oklch(from var(--gw-shadow) l c h / 0.32)))}
${S} .gw-form,${S} .gw-share{display:flex;flex-direction:column}
${S} .gw-sub{margin:12px 0 0;line-height:1.5;color:var(--muted,#475467);text-wrap:pretty}
${S} .gw-fields{margin:24px 0 0;padding:0;border:0;min-width:0;display:grid;gap:16px}
${S} .gw-field{display:grid;gap:8px}
${S} .gw-label{display:block;font-size:1.0625rem;line-height:1.3;font-weight:700;color:var(--label-ink,var(--ink,#101828))}
${S} .gw-input{display:block;width:100%;height:56px;margin:0;padding:0 16px;font-family:inherit;font-size:1.0625rem;color:var(--field-ink,#101828);background:var(--field,#ffffff);border:1px solid var(--field-border,color-mix(in oklch,var(--ink,#101828) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));appearance:none;outline:none}
${S} .gw-input::placeholder{color:color-mix(in oklch,var(--field-ink,#101828) 65%,var(--field,#ffffff));opacity:1}
${S} .gw-input:hover:not(:disabled):not(:focus){border-color:color-mix(in oklch,var(--ink,#101828) 42%,transparent)}
${S} .gw-input:focus{border-color:var(--gw-focus);box-shadow:0 0 0 3px oklch(from var(--gw-focus) l c h / 0.35)}
${S} .gw-input[aria-invalid=true]{border-color:var(--danger,#b42318)}
${S} .gw-input[aria-invalid=true]:focus{box-shadow:0 0 0 3px oklch(from var(--danger,#b42318) l c h / 0.3)}
${S} .gw-input:disabled{cursor:not-allowed;background:color-mix(in oklch,var(--field-ink,#101828) 5%,var(--field,#ffffff))}
${S} .gw-input--link{font-size:0.9375rem;text-overflow:ellipsis;background:color-mix(in oklch,var(--field-ink,#101828) 4%,var(--field,#ffffff))}
${S} .gw-err{margin:0;font-size:0.9375rem;line-height:1.4;font-weight:600;color:var(--danger,#b42318);text-wrap:pretty}
${S} .gw-err svg,${S} .gw-reassure svg,${S} .gw-form-error svg,${S} .gw-link svg{display:inline-block;vertical-align:-0.15em;margin-inline-end:0.4em}
${S} .gw-form-error{margin:16px 0 0;padding:12px 16px;border-radius:10px;background:var(--danger-soft,color-mix(in oklch,var(--danger,#b42318) 14%,var(--card,#ffffff)));color:var(--danger,#b42318);font-size:0.9375rem;line-height:1.4;font-weight:600;text-wrap:pretty}
${S} .gw-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;width:100%;min-height:56px;margin:24px 0 0;padding:12px 28px;border:0;cursor:pointer;font-family:var(--button-font,var(--font-display,inherit));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-align:center;text-wrap:balance;color:var(--button-ink,var(--cta-ink,#ffffff));text-shadow:var(--button-text-shadow,none);border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from var(--gw-btn) calc(l + 0.04) c h),oklch(from var(--gw-btn-2) calc(l - 0.02) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--gw-btn) calc(l + 0.14) c h / 0.7),inset 0 -3px 0 oklch(from var(--gw-btn) calc(l - 0.16) c h),0 1px 2px oklch(from var(--gw-shadow) l c h / 0.3),0 8px 16px -6px oklch(from var(--gw-shadow) l c h / 0.42));-webkit-tap-highlight-color:transparent}
${S} .gw-btn svg{flex:none}
${S} .gw-btn:hover:not(:disabled),${S} .gw-btn.is-hover{background:linear-gradient(oklch(from var(--gw-btn) calc(l - 0.01) c h),oklch(from var(--gw-btn-2) calc(l - 0.07) c h));box-shadow:inset 0 1px 0 oklch(from var(--gw-btn) calc(l + 0.1) c h / 0.6),inset 0 -3px 0 oklch(from var(--gw-btn) calc(l - 0.2) c h),0 1px 2px oklch(from var(--gw-shadow) l c h / 0.32),0 12px 20px -6px oklch(from var(--gw-shadow) l c h / 0.48)}
${S} .gw-btn:active:not(:disabled),${S} .gw-btn.is-active{background:linear-gradient(oklch(from var(--gw-btn) calc(l - 0.06) c h),oklch(from var(--gw-btn-2) calc(l - 0.08) c h));box-shadow:inset 0 2px 5px oklch(from var(--gw-btn) calc(l - 0.24) c h / 0.55),inset 0 -2px 0 oklch(from var(--gw-btn) calc(l - 0.16) c h),0 1px 2px oklch(from var(--gw-shadow) l c h / 0.3)}
${S} .gw-btn:focus-visible{outline:3px solid var(--gw-focus);outline-offset:3px}
${S} .gw-btn[aria-busy=true]{cursor:progress}
${S} .gw-btn:disabled:not([aria-busy=true]){cursor:not-allowed;background:var(--secondary,#e4e7ec);color:var(--secondary-ink,#101828);text-shadow:none;box-shadow:var(--button-2-shadow,var(--shadow-sm,0 1px 2px oklch(from var(--gw-shadow) l c h / 0.2)))}
${S} .gw-btn--copy{width:auto;min-width:11.5rem;margin:0;font-size:1.125rem}
${S} .gw-reassure{margin:12px 0 0;text-align:center;font-size:0.9375rem;line-height:1.4;font-weight:500;color:var(--muted,#475467);text-wrap:pretty}
${S} .gw-disc{display:grid;place-items:center;width:40px;height:40px;margin-bottom:16px;border-radius:999px;background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card,#ffffff))}
${S} .gw-share .gw-h3:focus,${S} .gw-share .gw-h3:focus-visible{outline:none}
${S} .gw-share .gw-label{margin-top:24px}
${S} .gw-copyrow{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:12px;margin-top:8px}
@container (max-width:460px){${S} .gw-copyrow{grid-template-columns:minmax(0,1fr)}${S} .gw-btn--copy{width:100%}}
${S} .gw-hint{margin:8px 0 0;font-size:0.9375rem;line-height:1.4;font-weight:500;color:var(--muted,#475467);text-wrap:pretty}
${S} .gw-link{color:var(--gw-link);font-weight:700;text-decoration:underline;text-decoration-thickness:1.5px;text-decoration-color:oklch(from var(--gw-link) l c h / 0.45);text-underline-offset:0.18em;border-radius:4px}
${S} .gw-link:hover{color:oklch(from var(--gw-link) calc(l - 0.08) c h);text-decoration-color:currentColor}
${S} .gw-link:focus-visible{outline:3px solid var(--gw-focus);outline-offset:2px}
${S} .gw-mail{display:inline-flex;align-items:center;align-self:flex-start;min-height:44px;margin-top:12px}
${S} .gw-fine{margin:auto 0 0;padding-top:20px;text-align:center;font-size:0.9375rem;line-height:1.45;color:var(--muted,#475467);text-wrap:pretty}
${S} .gw-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
@media (max-width:860px){${S} .gw-board{grid-template-columns:minmax(0,1fr);gap:12px}${S} .gw-board>*{grid-column:1/-1}${S} .gw-stats{gap:12px}${S} .gw-prize{min-height:0}${S} .gw-stat{min-height:136px}}
@media (max-width:520px){${S} .gw-prize-img{width:min(100%,240px)}${S} .gw-stat{gap:12px}}
@keyframes gw-rise{from{opacity:0.82;transform:translateY(8px)}}
@keyframes gw-spin{to{transform:rotate(360deg)}}
@media (prefers-reduced-motion:no-preference){${S} .gw-tile{animation:gw-rise .45s cubic-bezier(.2,.7,.2,1) both;animation-delay:calc(var(--i,0) * .07s)}${S} .gw-share{animation:gw-rise .45s cubic-bezier(.2,.7,.2,1) both}${S} .gw-prize-img{transform:rotateX(var(--gw-rx,0deg)) rotateY(var(--gw-ry,0deg)) translateY(var(--gw-lift,0px));transition:transform .2s cubic-bezier(.2,.7,.2,1)}${S} .gw-btn{transition:transform .16s ease,box-shadow .16s ease,background .16s ease}${S} .gw-btn:hover:not(:disabled),${S} .gw-btn.is-hover{transform:translateY(-1px)}${S} .gw-btn:active:not(:disabled),${S} .gw-btn.is-active{transform:translateY(1px)}${S} .gw-spin{animation:gw-spin .8s linear infinite}${S} .gw-input{transition:border-color .16s ease,box-shadow .16s ease}}
`;
pieces/forms/giveaway-entry/specimen.tsx 44 lines
import __studioImage36933464 from "../assets/9a46d0254661d1b5.webp";
import React from 'react';
import { GiveawayEntry } from '../giveaway-entry';
import defaults from '../../studio-defaults.json';
import { slot } from '../../slots';
export const states = ['default', 'hover', 'active', 'disabled', 'error', 'success'];
type SpecimenState = 'default' | 'hover' | 'active' | 'disabled' | 'error' | 'success';
export default function GiveawayEntrySpecimen({ state = 'default' }: { state?: SpecimenState }) {
const sample = defaults.sample;
return (
<GiveawayEntry
state={state}
headline='Win everything you need to launch your first funnel'
lead={`Enter free for your chance to win ${sample.name}, then share your link to stack up bonus entries before the draw.`}
prizeLabel='Grand prize'
prizeName={sample.name}
prizeDetail='The guide, workbook, and checklist from the full kit, sent to the winner as an instant download.'
prizeImage={slot('product', __studioImage36933464)}
prizeImageAlt={`${sample.name}: the guide, workbook, and checklist`}
prizeValue={sample.regularPrice}
endsAt='2026-12-15T23:59:00-06:00'
timeZone='America/Chicago'
facts={[
{ value: '1', label: 'Winner, picked at random' },
{ value: '3', label: 'Bonus entries for every friend you refer' },
]}
items={sample.items.map((item) => ({
name: item.name,
detail: item.detail,
value: item.value,
image: item.image,
imageAlt: item.imageAlt,
}))}
drawNote='One winner is picked at random within 3 days of the close and contacted by email.'
bonusEntries={3}
shareUrl='https://funnelstarter.example/giveaway'
rulesHref='#official-rules'
copy={{ formLead: 'Two quick fields. One free entry into the draw.', reassurance: sample.registration.privacy }}
/>
);
}
| Name | Type | Details |
|---|---|---|
headline OptionalGiveawayEntry |
React.ReactNode |
|
lead OptionalGiveawayEntry |
React.ReactNode |
|
prizeName OptionalGiveawayEntry |
string |
|
prizeDetail OptionalGiveawayEntry |
string |
|
prizeLabel OptionalGiveawayEntry |
string |
|
prizeImage OptionalGiveawayEntry |
string |
|
prizeImageAlt OptionalGiveawayEntry |
string |
|
prizeValue OptionalGiveawayEntry |
string |
|
endsAt OptionalGiveawayEntry |
string |
|
timeZone OptionalGiveawayEntry |
string |
|
locale OptionalGiveawayEntry |
string |
|
facts OptionalGiveawayEntry |
GiveawayFact[] |
|
items OptionalGiveawayEntry |
GiveawayPrizeItem[] |
|
drawNote OptionalGiveawayEntry |
string |
|
bonusEntries OptionalGiveawayEntry |
number |
|
shareUrl OptionalGiveawayEntry |
string |
|
referralLink OptionalGiveawayEntry |
string |
|
entered OptionalGiveawayEntry |
boolean |
|
rulesHref OptionalGiveawayEntry |
string |
|
copy OptionalGiveawayEntry |
Partial<GiveawayEntryCopy> |
|
onSubmit OptionalGiveawayEntry |
(values: GiveawayEntryValues) => void | boolean | Promise<void | boolean> |
|
onShare OptionalGiveawayEntry |
(link: string, method: 'copy' | 'email') => void |
|
state OptionalGiveawayEntry |
'default' | 'hover' | 'active' | 'disabled' | 'error' | 'success' |
|
className OptionalGiveawayEntry |
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-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).
-
9a46d0254661d1b5.webp
image/webp · 180 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB