Donation Thanks Hero 1
Donation thank-you first screen: confirms the gift by name, amount and place over a documentary photo of the work,
Use it in a prompt
Use hero/donation-thanks-hero from the FunnelDNA library. Follow the skill and theme contract. Ask me for the copy, images, and brand details you need; do not invent proof.
Paste into Claude or ChatGPT with FunnelDNA connected (MCP setup), or alongside the skill.
Use it in code
- Save
component.tsx(Code tab) ascomponents/funneldna/hero/donation-thanks-hero.tsx. - Import it and pass your copy and images (Props tab):
import { DonationThanksHero } from "@/components/funneldna/hero/donation-thanks-hero"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/hero/donation-thanks-hero/component.tsx 750 lines
// layout: split-contrast
// Donation thank-you first screen: confirms the gift by name, amount and place over a documentary photo of the work,
// counts up what the gift becomes, sets receipt and field-update expectations, then turns the donor into the messenger.
import * as React from 'react';
import { AlertCircle, CalendarDays, Check, Copy, Mail, Share, Share2, X } from 'lucide-react';
import { Divider, FX_HOST } from '../fx/fx';
export type ShareChannel = 'copy' | 'email' | 'native';
export type DonationThanksHeroState = 'default' | 'hover' | 'active' | 'disabled' | 'error';
// Every visible word. Braced placeholders are replaced as text: {firstName}, {amount}, {place}, {email}, {sender},
// {updateWhen}, {url}.
export type DonationThanksCopy = {
thanks: string;
thanksAnon: string;
gift: string;
giftNoPlace: string;
giftNoAmount: string;
giftBare: string;
receipt: string;
receiptNoSender: string;
update: string;
shareLabel: string;
shareNote: string;
sheetTitle: string;
messageLabel: string;
messagePlaceholder: string;
linkNote: string;
copyLabel: string;
copyLabelNoLink: string;
copiedLabel: string;
copyError: string;
emailLabel: string;
emailSubject: string;
nativeLabel: string;
closeLabel: string;
psLabel: string;
};
const DEFAULT_COPY: DonationThanksCopy = {
thanks: 'Thank you, {firstName}.',
thanksAnon: 'Thank you.',
gift: 'Your {amount} gift is on its way to {place}.',
giftNoPlace: 'Your {amount} gift is on its way.',
giftNoAmount: 'Your gift is on its way to {place}.',
giftBare: 'Your gift is on its way.',
receipt: 'Your tax receipt is on its way to {email} from {sender}.',
receiptNoSender: 'Your tax receipt is on its way to {email}.',
update: 'Your first field update arrives {updateWhen}.',
shareLabel: 'Share why you gave',
shareNote: 'Your note is already written. Edit it or send it as is.',
sheetTitle: 'Your note, ready to send',
messageLabel: 'Your note',
messagePlaceholder: 'Tell a friend why this cause matters to you…',
linkNote: 'Your link is added at the end: {url}',
copyLabel: 'Copy note and link',
copyLabelNoLink: 'Copy note',
copiedLabel: 'Copied. Paste it anywhere.',
copyError: 'We couldn’t copy automatically. Select your note above and copy it.',
emailLabel: 'Email it to a friend',
emailSubject: 'Why I gave today',
nativeLabel: 'More ways to share',
closeLabel: 'Close share options',
psLabel: 'P.S.',
};
const DEFAULT_MESSAGE = 'I just gave to a cause I care about. Here’s why it matters to me, and where you can give too:';
const DEFAULT_PS = 'A few honest words from you can mean more to a friend than anything we could say.';
export type DonationThanksHeroProps = {
firstName?: string; // donor first name; omitted gives a plain thank-you
amount?: string; // gift amount as supplied, e.g. '$120'; a leading currency symbol is set as a superscript
place?: string; // where the gift goes
giftNote?: string; // short line under the headline, e.g. 'One-time gift · Nov 22, 2026'
sceneImage?: string; // slot 'scene': documentary photo of the work the gift funds
sceneImageAlt?: string;
scenePosition?: string; // object-position focal point of the photo
impact?: string; // impact sentence; '{figure}' marks the counted figure. Omit to make no impact claim.
impactFigure?: number; // supplied number that counts up inside the impact sentence
locale?: string; // number formatting locale
receiptEmail?: string;
receiptSender?: string;
updateWhen?: string; // when the first field update arrives, e.g. 'by January 15'
shareUrl?: string;
shareMessage?: string; // pre-written note the donor can edit before sharing
psLine?: React.ReactNode; // P.S. under the action; empty hides it
copy?: Partial<DonationThanksCopy>;
disabled?: boolean;
state?: DonationThanksHeroState;
onAction?: () => void; // fired when the share sheet opens
onShare?: (channel: ShareChannel, message: string) => void;
className?: string;
};
export function DonationThanksHero({
firstName,
amount,
place,
giftNote,
sceneImage,
sceneImageAlt = '',
scenePosition = '50% 65%',
impact,
impactFigure,
locale = 'en-US',
receiptEmail,
receiptSender,
updateWhen,
shareUrl,
shareMessage = DEFAULT_MESSAGE,
psLine = DEFAULT_PS,
copy,
disabled,
state = 'default',
onAction,
onShare,
className,
}: DonationThanksHeroProps) {
const c: DonationThanksCopy = { ...DEFAULT_COPY, ...copy };
const uid = React.useId().replace(/:/g, '');
const headId = 'dth-h-' + uid;
const sheetId = 'dth-s-' + uid;
const titleId = 'dth-t-' + uid;
const msgId = 'dth-m-' + uid;
const errId = 'dth-e-' + uid;
const isDisabled = Boolean(disabled) || state === 'disabled';
const [open, setOpen] = React.useState(state === 'active' || state === 'error');
const [message, setMessage] = React.useState(shareMessage);
const [copied, setCopied] = React.useState(false);
const [copyError, setCopyError] = React.useState(state === 'error');
const [canNative, setCanNative] = React.useState(false);
const triggerRef = React.useRef<HTMLButtonElement>(null);
const sheetRef = React.useRef<HTMLDivElement>(null);
const timer = React.useRef<ReturnType<typeof setTimeout> | null>(null);
React.useEffect(() => {
setOpen(state === 'active' || state === 'error');
setCopyError(state === 'error');
}, [state]);
React.useEffect(() => {
setMessage(shareMessage);
}, [shareMessage]);
React.useEffect(() => {
setCanNative(typeof navigator !== 'undefined' && typeof navigator.share === 'function');
return () => {
if (timer.current) clearTimeout(timer.current);
};
}, []);
const sheetOpen = open && !isDisabled;
const composed = [message.trim(), shareUrl ?? ''].filter(Boolean).join(' ');
const mailto = 'mailto:?subject=' + encodeURIComponent(c.emailSubject) + '&body=' + encodeURIComponent(composed);
const toggle = () => {
if (isDisabled) return;
if (open) {
setOpen(false);
return;
}
setOpen(true);
setCopied(false);
setCopyError(false);
onAction?.();
if (typeof window !== 'undefined') window.requestAnimationFrame(() => sheetRef.current?.focus());
};
const close = () => {
setOpen(false);
triggerRef.current?.focus();
};
const doCopy = async () => {
if (!composed) return;
try {
if (typeof navigator === 'undefined' || !navigator.clipboard || !navigator.clipboard.writeText) throw new Error('unavailable');
await navigator.clipboard.writeText(composed);
setCopyError(false);
setCopied(true);
onShare?.('copy', composed);
if (timer.current) clearTimeout(timer.current);
timer.current = setTimeout(() => setCopied(false), 2400);
} catch {
setCopied(false);
setCopyError(true);
}
};
const doNative = () => {
if (typeof navigator === 'undefined' || typeof navigator.share !== 'function' || !composed) return;
navigator
.share({ title: c.emailSubject, text: message.trim(), url: shareUrl || undefined })
.then(() => onShare?.('native', composed))
.catch(() => undefined);
};
const giftTemplate = amount && place ? c.gift : amount ? c.giftNoPlace : place ? c.giftNoAmount : c.giftBare;
const giftNode = fill(giftTemplate, { amount: amount ? <Amount value={amount} /> : '', place: place ?? '' });
const thanksNode = firstName ? fill(c.thanks, { firstName }) : c.thanksAnon;
const impactText = (impact ?? '').trim();
const wantsFigure = impactText.includes('{figure}');
const figureOk = typeof impactFigure === 'number' && Number.isFinite(impactFigure) && impactFigure >= 0;
const showImpact = impactText !== '' && (!wantsFigure || figureOk);
const facts: React.ReactNode[] = [];
if (receiptEmail) {
facts.push(
<li key='receipt'>
<Mail className='cf-dth-ico' size={18} strokeWidth={2.5} aria-hidden='true' />
<span className='cf-dth-txt'>
{fill(receiptSender ? c.receipt : c.receiptNoSender, {
email: <strong>{receiptEmail}</strong>,
sender: <strong>{receiptSender}</strong>,
})}
</span>
</li>,
);
}
if (updateWhen) {
facts.push(
<li key='update'>
<CalendarDays className='cf-dth-ico' size={18} strokeWidth={2.5} aria-hidden='true' />
<span className='cf-dth-txt'>{fill(c.update, { updateWhen: <strong>{updateWhen}</strong> })}</span>
</li>,
);
}
const btnClass = ['cf-dth-btn', state === 'hover' ? 'is-hover' : ''].filter(Boolean).join(' ');
return (
<section className={['cf-dth', className].filter(Boolean).join(' ')} aria-labelledby={headId}>
<style>{CSS}</style>
<div className='cf-dth-grid'>
<div className='cf-dth-stripe' aria-hidden='true' />
<div className='cf-dth-media' style={FX_HOST}>
{sceneImage ? (
<img
className='cf-dth-photo'
src={sceneImage}
alt={sceneImageAlt}
style={{ objectPosition: scenePosition }}
loading='eager'
decoding='async'
/>
) : null}
<div className='cf-dth-scrim' aria-hidden='true' />
<div className='cf-dth-wave' aria-hidden='true'>
<Divider shape='wave' tone='surface' height={56} />
</div>
<div className='cf-dth-copy'>
<h1 id={headId} className='cf-dth-h1'>
<span className='cf-dth-thanks cf-dth-rise'>{thanksNode}</span>
<span className='cf-dth-gift cf-dth-rise' style={{ animationDelay: '0.07s' }}>
{giftNode}
</span>
</h1>
{giftNote ? (
<p className='cf-dth-note cf-dth-rise' style={{ animationDelay: '0.14s' }}>
{giftNote}
</p>
) : null}
</div>
</div>
<div className='cf-dth-body'>
{showImpact ? (
<p className='cf-dth-impact cf-dth-rise' style={{ animationDelay: '0.14s' }}>
{wantsFigure ? fill(impactText, { figure: <CountFigure value={impactFigure as number} locale={locale} /> }) : impactText}
</p>
) : null}
{facts.length ? (
<ul className='cf-dth-facts cf-dth-rise' style={{ animationDelay: '0.21s' }}>
{facts}
</ul>
) : null}
<div className='cf-dth-action cf-dth-rise' style={{ animationDelay: '0.28s' }}>
<button
ref={triggerRef}
type='button'
className={btnClass}
aria-expanded={sheetOpen}
aria-controls={sheetOpen ? sheetId : undefined}
disabled={isDisabled}
onClick={toggle}
>
<Share2 size={20} strokeWidth={2.5} aria-hidden='true' />
<span>{c.shareLabel}</span>
</button>
{c.shareNote ? <p className='cf-dth-reassure'>{c.shareNote}</p> : null}
{sheetOpen ? (
<div
id={sheetId}
ref={sheetRef}
className='cf-dth-sheet'
role='region'
aria-labelledby={titleId}
tabIndex={-1}
onKeyDown={(e) => {
if (e.key === 'Escape') {
e.stopPropagation();
close();
}
}}
>
<div className='cf-dth-sheet-head'>
<h2 id={titleId} className='cf-dth-sheet-title'>
{c.sheetTitle}
</h2>
<button type='button' className='cf-dth-close' aria-label={c.closeLabel} onClick={close}>
<X size={20} strokeWidth={2.5} aria-hidden='true' />
</button>
</div>
<label htmlFor={msgId} className='cf-dth-label'>
{c.messageLabel}
</label>
<textarea
id={msgId}
className='cf-dth-field'
rows={4}
value={message}
placeholder={c.messagePlaceholder}
aria-describedby={copyError ? errId : undefined}
onChange={(e) => {
setMessage(e.target.value);
setCopied(false);
}}
/>
{shareUrl ? <p className='cf-dth-link'>{fill(c.linkNote, { url: shareUrl })}</p> : null}
<div className='cf-dth-opts'>
<button
type='button'
className={['cf-dth-opt', copied ? 'is-done' : ''].filter(Boolean).join(' ')}
disabled={!composed}
onClick={doCopy}
>
{copied ? (
<Check size={20} strokeWidth={2.5} aria-hidden='true' />
) : (
<Copy size={20} strokeWidth={2.5} aria-hidden='true' />
)}
<span>{copied ? c.copiedLabel : shareUrl ? c.copyLabel : c.copyLabelNoLink}</span>
</button>
<a className='cf-dth-opt' href={mailto} onClick={() => onShare?.('email', composed)}>
<Mail size={20} strokeWidth={2.5} aria-hidden='true' />
<span>{c.emailLabel}</span>
</a>
{canNative ? (
<button type='button' className='cf-dth-opt' disabled={!composed} onClick={doNative}>
<Share size={20} strokeWidth={2.5} aria-hidden='true' />
<span>{c.nativeLabel}</span>
</button>
) : null}
</div>
{copyError ? (
<p id={errId} className='cf-dth-err' role='alert'>
<AlertCircle className='cf-dth-ico' size={16} strokeWidth={2.5} aria-hidden='true' />
<span className='cf-dth-txt'>{c.copyError}</span>
</p>
) : null}
<span className='cf-sr' aria-live='polite'>
{copied ? c.copiedLabel : ''}
</span>
</div>
) : null}
</div>
{psLine ? (
<p className='cf-dth-ps'>
<strong>{c.psLabel}</strong>
{psLine}
</p>
) : null}
</div>
</div>
</section>
);
}
export default DonationThanksHero;
const useIsoLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
// Replaces {name} placeholders with text or nodes.
function fill(template: string, values: Record<string, React.ReactNode>): React.ReactNode[] {
const out: React.ReactNode[] = [];
let i = 0;
while (i < template.length) {
const a = template.indexOf('{', i);
const b = a < 0 ? -1 : template.indexOf('}', a);
if (a < 0 || b < 0) {
out.push(template.slice(i));
break;
}
if (a > i) out.push(template.slice(i, a));
const name = template.slice(a + 1, b);
out.push(name in values ? values[name] : template.slice(a, b + 1));
i = b + 1;
}
return out.map((node, idx) => <React.Fragment key={idx}>{node}</React.Fragment>);
}
// Sets a leading currency symbol as a superscript beside the figure.
function Amount({ value }: { value: string }) {
const m = /^([^0-9 ]{1,3}) ?([0-9][0-9.,]*)$/.exec(value.trim());
if (!m) return <span className='cf-dth-amt'>{value}</span>;
return (
<span className='cf-dth-amt'>
<span className='cf-dth-cur'>{m[1]}</span>
{m[2]}
</span>
);
}
function decimalsOf(n: number): number {
const s = String(n);
const i = s.indexOf('.');
return i < 0 ? 0 : Math.min(3, s.length - i - 1);
}
// The impact figure: final value for assistive tech and as the width holder; the visible copy counts up once.
function CountFigure({ value, locale }: { value: number; locale: string }) {
const ref = React.useRef<HTMLSpanElement>(null);
const shown = useCountUp(value, ref);
const fmt = React.useMemo(() => {
const dec = decimalsOf(value);
try {
return new Intl.NumberFormat(locale, { minimumFractionDigits: dec, maximumFractionDigits: dec });
} catch {
return new Intl.NumberFormat('en-US', { minimumFractionDigits: dec, maximumFractionDigits: dec });
}
}, [value, locale]);
const final = fmt.format(value);
return (
<span ref={ref} className='cf-dth-fig'>
<span className='cf-dth-fig-hold' aria-hidden='true'>
{final}
</span>
<span aria-hidden='true'>{fmt.format(shown)}</span>
<span className='cf-sr'>{final}</span>
</span>
);
}
function useCountUp(target: number, ref: React.RefObject<HTMLElement | null>): number {
const [value, setValue] = React.useState(target);
useIsoLayoutEffect(() => {
setValue(target);
const el = ref.current;
if (!el || typeof window === 'undefined' || target <= 0) return undefined;
const reduce = typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
if (reduce || typeof IntersectionObserver === 'undefined') return undefined;
const dec = decimalsOf(target);
let raf = 0;
let started = false;
setValue(0);
const io = new IntersectionObserver(
(entries) => {
if (started || !entries.some((e) => e.isIntersecting)) return;
started = true;
io.disconnect();
const t0 = performance.now();
const tick = (now: number) => {
const p = Math.min(1, (now - t0) / 1400);
const eased = 1 - Math.pow(1 - p, 3);
setValue(p >= 1 ? target : Number((target * eased).toFixed(dec)));
if (p < 1) raf = window.requestAnimationFrame(tick);
};
raf = window.requestAnimationFrame(tick);
},
{ threshold: 0.6 },
);
io.observe(el);
return () => {
io.disconnect();
window.cancelAnimationFrame(raf);
};
}, [target]);
return value;
}
const CSS = `
.cf-dth {
--dth-gutter: clamp(16px, 5vw, 48px);
--dth-top: clamp(56px, 8vw, 112px);
--dth-bottom: clamp(64px, 8.5vw, 120px);
--dth-edge: max(var(--dth-gutter), calc((100vw - 1240px) / 2));
--dth-slant: 96px;
--dth-shadow: var(--shadow, oklch(0.22 0.03 260));
position: relative;
background: var(--surface);
color: var(--ink);
font-family: var(--font-body);
overflow: hidden;
}
.cf-dth *, .cf-dth *::before, .cf-dth *::after { box-sizing: border-box; }
.cf-dth-grid { display: grid; grid-template-columns: minmax(0, 1fr); }
.cf-dth-stripe { display: none; }
.cf-dth-media {
position: relative;
isolation: isolate;
overflow: hidden;
display: flex;
flex-direction: column;
background: var(--band);
color: var(--band-ink);
padding: var(--dth-top) var(--dth-gutter) calc(56px + clamp(160px, 44vw, 260px));
}
.cf-dth-photo { position: absolute; inset: 0; z-index: -3; display: block; width: 100%; height: 100%; object-fit: cover; }
.cf-dth-scrim {
position: absolute;
inset: 0;
z-index: -2;
background: linear-gradient(180deg, oklch(from var(--band) l c h / 0.92) 0%, oklch(from var(--band) l c h / 0.86) 58%, oklch(from var(--band) l c h / 0.3) 100%);
}
.cf-dth-wave { position: absolute; left: 0; right: 0; bottom: -1px; height: 56px; z-index: -1; overflow: hidden; pointer-events: none; }
.cf-dth-copy { position: relative; }
.cf-dth-h1 {
margin: 0;
font-family: var(--font-display);
font-weight: var(--display-weight, 800);
letter-spacing: var(--display-tracking, -0.025em);
text-transform: var(--display-case, none);
color: var(--band-ink);
}
.cf-dth-thanks { display: block; font-size: clamp(2.5rem, 5.4vw, 4.875rem); line-height: 1.04; text-wrap: balance; }
.cf-dth-gift { display: block; margin-top: clamp(14px, 1.75vw, 26px); font-size: clamp(2rem, 3.6vw, 3.25rem); line-height: 1.06; text-wrap: balance; }
.cf-dth-amt { white-space: nowrap; }
.cf-dth-cur { font-size: 0.55em; vertical-align: 0.6em; line-height: 0; margin-inline-end: 0.04em; }
.cf-dth-note { margin: 24px 0 0; font-size: 0.9375rem; font-weight: 600; line-height: 1.4; color: var(--band-ink); text-wrap: pretty; }
.cf-dth-body { min-width: 0; padding: 40px var(--dth-gutter) var(--dth-bottom); }
.cf-dth-impact {
margin: 0;
max-width: 34rem;
font-family: var(--font-display);
font-weight: 700;
font-size: clamp(1.3125rem, 1.8vw, 1.625rem);
line-height: 1.3;
letter-spacing: -0.01em;
color: var(--ink);
text-wrap: pretty;
}
.cf-dth-fig {
position: relative;
display: inline-grid;
margin-inline: 0.06em;
font-size: clamp(2.5rem, 4.2vw, 3.75rem);
line-height: 1;
font-weight: var(--display-weight, 800);
letter-spacing: -0.03em;
font-variant-numeric: tabular-nums;
color: var(--accent);
}
.cf-dth-fig > span { grid-area: 1 / 1; }
.cf-dth-fig-hold { visibility: hidden; }
.cf-dth-facts {
list-style: none;
display: grid;
gap: 12px;
max-width: 34rem;
margin: 28px 0 0;
padding: 24px 0 0;
border-top: 1px solid oklch(from var(--ink) l c h / 0.14);
font-size: clamp(1.0625rem, 1.25vw, 1.125rem);
line-height: 1.5;
color: var(--ink);
}
.cf-dth-facts:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.cf-dth-facts li { display: flex; align-items: flex-start; justify-content: flex-start; gap: 0.5em; }
.cf-dth-facts strong { font-weight: 700; overflow-wrap: anywhere; }
.cf-dth-txt { flex: 0 1 auto; min-width: 0; text-wrap: pretty; }
.cf-dth-ico { flex: none; display: block; margin-top: calc((1.5em - 18px) / 2); color: var(--accent); }
.cf-dth-action { max-width: 34rem; margin-top: 40px; }
.cf-dth-action:first-child { margin-top: 0; }
.cf-dth-btn {
--dth-b: var(--button-bg, var(--cta));
--dth-b2: var(--button-bg-2, var(--cta-2));
appearance: none;
margin: 0;
border: 0;
cursor: pointer;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 10px;
width: 100%;
min-height: 72px;
padding: 0 28px;
border-radius: var(--button-radius, var(--radius, 12px));
font-family: var(--button-font, var(--font-display));
font-weight: var(--button-weight, 800);
text-transform: var(--button-case, none);
font-size: clamp(1.125rem, 1.55vw, 1.375rem);
line-height: 1.15;
text-align: center;
color: var(--button-ink, var(--cta-ink));
text-shadow: var(--button-text-shadow, none);
background: linear-gradient(oklch(from var(--dth-b) calc(l + 0.04) c h), oklch(from var(--dth-b2) calc(l - 0.02) c h));
box-shadow: inset 0 1px 0 oklch(from var(--dth-b) calc(l + 0.14) c h / 0.7), inset 0 -3px 0 oklch(from var(--dth-b) calc(l - 0.16) c h), var(--button-shadow, 0 1px 2px oklch(from var(--dth-shadow) l c h / 0.3), 0 8px 16px -6px oklch(from var(--dth-shadow) l c h / 0.4));
transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
-webkit-tap-highlight-color: transparent;
}
.cf-dth-btn svg { flex: none; }
.cf-dth-btn::after { content: ''; flex: none; width: 20px; height: 1px; }
.cf-dth-btn:hover:not(:disabled), .cf-dth-btn.is-hover:not(:disabled) {
transform: translateY(-1px);
background: linear-gradient(oklch(from var(--dth-b) calc(l - 0.01) c h), oklch(from var(--dth-b2) calc(l - 0.07) c h));
box-shadow: inset 0 1px 0 oklch(from var(--dth-b) calc(l + 0.12) c h / 0.7), inset 0 -3px 0 oklch(from var(--dth-b) calc(l - 0.2) c h), var(--button-shadow, 0 1px 2px oklch(from var(--dth-shadow) l c h / 0.32), 0 12px 20px -8px oklch(from var(--dth-shadow) l c h / 0.46));
}
.cf-dth-btn:active:not(:disabled), .cf-dth-btn[aria-expanded=true]:not(:disabled) {
transform: translateY(1px);
box-shadow: inset 0 2px 4px oklch(from var(--dth-b) calc(l - 0.2) c h / 0.45), inset 0 -2px 0 oklch(from var(--dth-b) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--dth-shadow) l c h / 0.3);
}
.cf-dth-btn:focus-visible { outline: 3px solid oklch(from var(--field-focus, var(--accent)) l c h / 0.55); outline-offset: 3px; }
.cf-dth-btn:disabled {
cursor: not-allowed;
transform: none;
background: var(--button-2-bg, var(--secondary));
color: var(--button-2-ink, var(--secondary-ink));
text-shadow: none;
box-shadow: none;
}
.cf-dth-reassure { margin: 12px 0 0; font-size: 0.9375rem; font-weight: 500; line-height: 1.4; color: var(--muted); text-align: center; text-wrap: pretty; }
.cf-dth-sheet {
margin-top: 16px;
padding: clamp(20px, 3vw, 28px);
background: var(--card);
color: var(--ink);
border: 1px solid var(--card-border, oklch(from var(--ink) l c h / 0.12));
border-radius: var(--card-radius, var(--radius, 14px));
box-shadow: var(--card-shadow, var(--shadow-md, 0 1px 2px oklch(from var(--dth-shadow) l c h / 0.22), 0 4px 10px -2px oklch(from var(--dth-shadow) l c h / 0.2)));
animation: cf-dth-in 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.cf-dth-sheet:focus { outline: none; }
.cf-dth-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.cf-dth-sheet-title {
margin: 8px 0 0;
font-family: var(--font-display);
font-weight: var(--display-weight, 800);
font-size: clamp(1.3125rem, 1.8vw, 1.625rem);
line-height: 1.15;
letter-spacing: -0.01em;
color: var(--ink);
text-wrap: balance;
}
.cf-dth-close {
flex: none;
appearance: none;
margin: -6px -6px 0 0;
border: 0;
width: 44px;
height: 44px;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 10px;
background: transparent;
color: var(--ink);
cursor: pointer;
transition: background 0.16s ease;
}
.cf-dth-close:hover { background: color-mix(in oklch, var(--ink) 6%, var(--card)); }
.cf-dth-close:focus-visible, .cf-dth-opt:focus-visible { outline: 3px solid oklch(from var(--field-focus, var(--accent)) l c h / 0.55); outline-offset: 2px; }
.cf-dth-label { display: block; margin: 16px 0 8px; font-size: 1rem; font-weight: 700; line-height: 1.3; color: var(--label-ink, var(--ink)); }
.cf-dth-field {
display: block;
width: 100%;
min-height: 128px;
resize: vertical;
margin: 0;
padding: 14px 16px;
font-family: var(--font-body);
font-size: 1.0625rem;
line-height: 1.5;
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));
transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.cf-dth-field::placeholder { color: color-mix(in oklch, var(--field-ink) 65%, var(--field)); opacity: 1; }
.cf-dth-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 / 0.35); }
.cf-dth-link { margin: 8px 0 0; font-size: 0.9375rem; font-weight: 500; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
.cf-dth-opts { display: grid; gap: 8px; margin-top: 16px; }
.cf-dth-opt {
appearance: none;
margin: 0;
cursor: pointer;
display: flex;
align-items: center;
gap: 12px;
width: 100%;
min-height: 56px;
padding: 0 18px;
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-weight: var(--button-weight, 800);
text-transform: var(--button-case, none);
font-size: 1.0625rem;
line-height: 1.2;
text-align: start;
text-decoration: none;
transition: background 0.16s ease, transform 0.16s ease;
}
.cf-dth-opt svg { flex: none; }
.cf-dth-opt:hover:not(:disabled) { background: oklch(from var(--button-2-bg, var(--secondary)) calc(l - 0.035) c h); }
.cf-dth-opt:active:not(:disabled) { transform: translateY(1px); }
.cf-dth-opt:disabled { cursor: not-allowed; opacity: 0.6; }
.cf-dth-opt.is-done svg { color: var(--success); }
.cf-dth-err { display: flex; align-items: flex-start; justify-content: flex-start; gap: 0.5em; margin: 12px 0 0; font-size: 0.9375rem; font-weight: 600; line-height: 1.4; color: var(--danger); }
.cf-dth-err .cf-dth-ico { margin-top: calc((1.4em - 16px) / 2); color: var(--danger); }
.cf-dth-ps { max-width: 34rem; margin: 40px 0 0; font-size: clamp(1.0625rem, 1.25vw, 1.125rem); line-height: 1.5; color: var(--ink); text-wrap: pretty; }
.cf-dth-ps strong { font-weight: 800; margin-inline-end: 0.3em; }
.cf-dth .cf-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-dth-rise { animation: cf-dth-in 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes cf-dth-in { from { opacity: 0.82; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (min-width: 960px) {
.cf-dth-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); min-height: clamp(680px, 84vh, 820px); }
.cf-dth-stripe {
display: block;
grid-column: 1;
grid-row: 1;
justify-self: start;
width: calc(100% + 28px);
background: var(--accent-fill, var(--accent));
clip-path: polygon(0 0, 100% 0, calc(100% - var(--dth-slant)) 100%, 0 100%);
}
.cf-dth-media {
grid-column: 1;
grid-row: 1;
padding: var(--dth-top) calc(var(--dth-slant) + 40px) var(--dth-bottom) var(--dth-edge);
clip-path: polygon(0 0, 100% 0, calc(100% - var(--dth-slant)) 100%, 0 100%);
}
.cf-dth-scrim { background: linear-gradient(180deg, oklch(from var(--band) l c h / 0.9) 0%, oklch(from var(--band) l c h / 0.82) 60%, oklch(from var(--band) l c h / 0.18) 100%); }
.cf-dth-wave { display: none; }
.cf-dth-body { grid-column: 2; grid-row: 1; padding: var(--dth-top) var(--dth-edge) var(--dth-bottom) 72px; }
.cf-dth-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
.cf-dth-rise, .cf-dth-sheet { animation: none; }
.cf-dth-btn, .cf-dth-opt, .cf-dth-close, .cf-dth-field { transition: none; }
.cf-dth-btn:hover:not(:disabled), .cf-dth-btn.is-hover:not(:disabled), .cf-dth-btn:active:not(:disabled), .cf-dth-btn[aria-expanded=true]:not(:disabled), .cf-dth-opt:active:not(:disabled) { transform: none; }
}
`;
pieces/hero/donation-thanks-hero/specimen.tsx 33 lines
import __studioImagef1c46958 from "../assets/7bc7010c4f4b70c9.webp";
// Specimen: the thank-you first screen for a fictional donor to the fictional Clearwater Wells Project.
import { DonationThanksHero, type DonationThanksHeroState } from '../donation-thanks-hero';
import { slot } from '../../slots';
export const states = ['default', 'hover', 'active', 'disabled', 'error'];
export default function DonationThanksHeroSpecimen({ state = 'default' }: { state?: DonationThanksHeroState }) {
return (
<DonationThanksHero
state={state}
firstName='Maya'
amount='$120'
place='Kisumu County'
giftNote='One-time gift · November 22, 2026'
sceneImage={slot(
'scene',
__studioImagef1c46958,
)}
sceneImageAlt='Volunteers filling a community water tank in Kisumu County'
scenePosition='50% 72%'
impact='Your gift becomes {figure} litres of clean water: enough to keep one family in clean water for six months.'
impactFigure={21600}
receiptEmail='maya.r@example.com'
receiptSender='receipts@clearwaterwells.org'
updateWhen='by January 15, 2027, with photos from the tank your gift helps fill'
shareUrl='https://clearwaterwells.org/give'
shareMessage='I just gave $120 to Clearwater Wells Project. It keeps one family in clean water for six months. If that matters to you too, here’s where I gave:'
psLine='Your note reaches people who already trust you. One honest sentence about why you gave can help the next family get clean water.'
copy={{ emailSubject: 'Why I gave to Clearwater Wells Project' }}
/>
);
}
| Name | Type | Details |
|---|---|---|
firstName OptionalDonationThanksHero |
string |
|
amount OptionalDonationThanksHero |
string |
|
place OptionalDonationThanksHero |
string |
|
giftNote OptionalDonationThanksHero |
string |
|
sceneImage OptionalDonationThanksHero |
string |
|
sceneImageAlt OptionalDonationThanksHero |
string |
Default ''
|
scenePosition OptionalDonationThanksHero |
string |
Default '50% 65%'
|
impact OptionalDonationThanksHero |
string |
|
impactFigure OptionalDonationThanksHero |
number |
|
locale OptionalDonationThanksHero |
string |
Default 'en-US'
|
receiptEmail OptionalDonationThanksHero |
string |
|
receiptSender OptionalDonationThanksHero |
string |
|
updateWhen OptionalDonationThanksHero |
string |
|
shareUrl OptionalDonationThanksHero |
string |
|
shareMessage OptionalDonationThanksHero |
string |
Default DEFAULT_MESSAGE
|
psLine OptionalDonationThanksHero |
React.ReactNode |
Default DEFAULT_PS
|
copy OptionalDonationThanksHero |
Partial<DonationThanksCopy> |
|
disabled OptionalDonationThanksHero |
boolean |
|
state OptionalDonationThanksHero |
DonationThanksHeroState |
Default 'default'
|
onAction OptionalDonationThanksHero |
() => void |
|
onShare OptionalDonationThanksHero |
(channel: ShareChannel, message: string) => void |
|
className OptionalDonationThanksHero |
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.
scene- A wide atmosphere photo behind or beside the copy.
-
7bc7010c4f4b70c9.webp
image/webp · 129 KB