Donation Picker 2
One-place gift card: a full-bleed photo of the one stretch of river a gift pays for, cut on a diagonal, with a
Use it in a prompt
Use offer/donation-picker-2 from the FunnelDNA library. Follow the skill and theme contract. Ask me for the copy, images, and brand details you need; do not invent proof.
Paste into Claude or ChatGPT with FunnelDNA connected (MCP setup), or alongside the skill.
Use it in code
- Save
component.tsx(Code tab) ascomponents/funneldna/offer/donation-picker-2.tsx. - Import it and pass your copy and images (Props tab):
import { DonationPicker2 } from "@/components/funneldna/offer/donation-picker-2"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/offer/donation-picker-2/component.tsx 609 lines
// layout: diagonal-split
// One-place gift card: a full-bleed photo of the one stretch of river a gift pays for, cut on a diagonal, with a
// single raised card breaking its lower edge. The visitor picks a gift, sees what it does, covers the fee and gives (onSubmit).
import * as React from 'react';
import { AlertCircle, Check, HandHeart, MapPin, Repeat, Waves } from 'lucide-react';
export type GiftFrequency = 'once' | 'monthly';
export type DonationGift = {
/** One-time amount, a plain number in the page currency */
amount: number;
/** What the gift does, written to follow the amount: “buys gloves for two new volunteers.” */
impact?: React.ReactNode;
/** Monthly amount, when it differs from the one-time amount */
monthlyAmount?: number;
/** What the monthly gift does, written to follow the amount */
monthlyImpact?: React.ReactNode;
};
export type DonationFee = {
/** Percentage of the gift, e.g. 2.9 */
percent?: number;
/** Fixed amount per gift, e.g. 0.3 */
fixed?: number;
};
export type DonationGiftValues = {
amount: number;
/** Fee added by the donor (0 when not covered) */
fee: number;
total: number;
frequency: GiftFrequency;
/** Index of the chosen preset, or null for a typed amount */
gift: number | null;
coverFee: boolean;
};
export type DonationPicker2Copy = {
frequencyLabel: string;
once: string;
monthly: string;
giftsLabel: string;
perMonth: string;
customLabel: string;
customPlaceholder: string;
/** Follows a typed amount in the impact line */
customImpact: string;
impactEmpty: string;
/** Placeholders: {fee}, {amount} */
feeLabel: string;
feePending: string;
totalOnce: string;
totalMonthly: string;
/** Placeholders: {gift}, {fee} */
breakdown: string;
chooseHint: string;
give: string;
giveMonthly: string;
errorNumber: string;
/** Placeholder: {min} */
errorMin: string;
};
export type DonationPicker2Props = {
/** The one place the gift goes, shown above the headline */
place?: React.ReactNode;
headline?: React.ReactNode;
lead?: React.ReactNode;
/** One-sentence paragraphs; a one-word line is set large for emphasis */
story?: React.ReactNode[];
/** scene slot: the place, with the people doing the work */
image?: string;
imageAlt?: string;
/** object-position for the photo’s focal point */
imagePosition?: string;
cardTitle?: React.ReactNode;
/** Preset gifts, lowest first (three fit the row) */
gifts?: DonationGift[];
defaultGift?: number;
defaultFrequency?: GiftFrequency;
currency?: string;
minAmount?: number;
/** Card processing fee; the cover-the-fee option shows only when this is supplied */
fee?: DonationFee;
defaultCoverFee?: boolean;
monthlyNudge?: React.ReactNode;
taxNote?: React.ReactNode;
copy?: Partial<DonationPicker2Copy>;
state?: 'default' | 'hover' | 'active' | 'disabled' | 'error';
disabled?: boolean;
/** Receives the validated gift; the page wires checkout */
onSubmit?: (values: DonationGiftValues) => void;
className?: string;
};
export function DonationPicker2(props: DonationPicker2Props) {
const {
place,
headline = 'Your gift goes to one place you can see',
lead = 'Pick an amount and see exactly what it pays for.',
story = [],
image,
imageAlt = '',
imagePosition = '62% 42%',
cardTitle = 'Choose how you’ll help',
gifts = DEFAULT_GIFTS,
defaultGift = 1,
defaultFrequency = 'once',
currency = '$',
minAmount = 5,
fee,
defaultCoverFee = false,
monthlyNudge,
taxNote,
copy: copyProp,
state = 'default',
disabled = false,
onSubmit,
className,
} = props;
const copy: DonationPicker2Copy = { ...DEFAULT_COPY, ...copyProp };
const uid = React.useId();
const startGift = gifts.length ? Math.min(Math.max(0, defaultGift), gifts.length - 1) : null;
const giftFor = (s: DonationPicker2Props['state']) => (s === 'error' || s === 'disabled' ? null : startGift);
const [frequency, setFrequency] = React.useState<GiftFrequency>(defaultFrequency);
const [giftIdx, setGiftIdx] = React.useState<number | null>(() => giftFor(state));
const [custom, setCustom] = React.useState(state === 'error' ? ERROR_SAMPLE : '');
const [touched, setTouched] = React.useState(state === 'error');
const [coverFee, setCoverFee] = React.useState(defaultCoverFee);
const customRef = React.useRef<HTMLInputElement>(null);
const firstRun = React.useRef(true);
React.useEffect(() => {
if (firstRun.current) {
firstRun.current = false;
return;
}
setGiftIdx(giftFor(state));
setCustom(state === 'error' ? ERROR_SAMPLE : '');
setTouched(state === 'error');
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [state]);
const monthly = frequency === 'monthly';
const amountOf = (g: DonationGift) => (monthly ? g.monthlyAmount ?? g.amount : g.amount);
const parsed = parseAmount(custom, currency, minAmount);
const gift = giftIdx === null ? undefined : gifts[giftIdx];
const amount = gift ? amountOf(gift) : parsed.value;
const valid = gift ? true : parsed.error === null && parsed.value !== null;
const isOff = disabled;
const feeAmount =
fee && valid && amount !== null ? round2((amount * (fee.percent ?? 0)) / 100 + (fee.fixed ?? 0)) : 0;
const feeAdded = Boolean(fee && coverFee);
const total = valid && amount !== null ? round2(amount + (feeAdded ? feeAmount : 0)) : 0;
const showError = parsed.error === 'number' || (parsed.error === 'min' && touched);
const errorText =
parsed.error === 'number' ? copy.errorNumber : fill(copy.errorMin, { min: money(minAmount, currency) });
let impactAmount = '';
let impactNode: React.ReactNode = copy.impactEmpty;
if (gift) {
impactAmount = money(amountOf(gift), currency);
impactNode = (monthly ? gift.monthlyImpact ?? gift.impact : gift.impact) ?? copy.customImpact;
} else if (valid && amount !== null) {
impactAmount = money(amount, currency);
impactNode = copy.customImpact;
}
const impactKey = frequency + '-' + (giftIdx ?? (valid ? 'custom' : 'none'));
const pickGift = (i: number) => {
setGiftIdx(i);
setCustom('');
setTouched(false);
};
const onCustom = (e: React.ChangeEvent<HTMLInputElement>) => {
setCustom(e.target.value);
setGiftIdx(null);
};
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
if (isOff) return;
if (!valid || amount === null) {
setTouched(true);
customRef.current?.focus();
return;
}
onSubmit?.({
amount,
fee: feeAdded ? feeAmount : 0,
total,
frequency,
gift: giftIdx,
coverFee: feeAdded,
});
};
const rootClass = [
'cf-donation-picker-2',
state === 'hover' ? 'is-hover' : '',
state === 'active' ? 'is-active' : '',
className ?? '',
]
.filter(Boolean)
.join(' ');
return (
<section className={rootClass} aria-labelledby={uid + '-h'}>
<style>{CSS}</style>
<div className='dp-wrap'>
<div className='dp-photo'>
{image ? (
<img src={image} alt={imageAlt} width={1600} height={1200} style={{ objectPosition: imagePosition }} />
) : null}
<span className='dp-scrim' aria-hidden='true' />
</div>
<div className='dp-head'>
{place ? (
<p className='dp-place dp-in'>
<MapPin className='dp-inline' size={16} strokeWidth={2.5} aria-hidden='true' />
{place}
</p>
) : null}
<h2 id={uid + '-h'} className='dp-title dp-in'>
{headline}
</h2>
{lead ? <p className='dp-lead dp-in'>{lead}</p> : null}
</div>
<form
className='dp-card dp-in'
onSubmit={handleSubmit}
noValidate
aria-labelledby={cardTitle ? uid + '-ct' : undefined}
aria-label={cardTitle ? undefined : copy.giftsLabel}
>
{cardTitle ? (
<h3 id={uid + '-ct'} className='dp-card-title'>
{cardTitle}
</h3>
) : null}
<div
className='dp-freq'
role='radiogroup'
aria-label={copy.frequencyLabel}
data-monthly={monthly ? 'true' : 'false'}
>
<span className='dp-freq-thumb' aria-hidden='true' />
{(['once', 'monthly'] as const).map((f) => (
<label key={f} className={'dp-freq-opt' + (frequency === f ? ' is-on' : '')}>
<input
className='dp-sr'
type='radio'
name={uid + '-freq'}
value={f}
checked={frequency === f}
onChange={() => setFrequency(f)}
disabled={isOff}
/>
{f === 'monthly' ? <Repeat size={16} strokeWidth={2.5} aria-hidden='true' /> : null}
{f === 'once' ? copy.once : copy.monthly}
</label>
))}
</div>
{monthlyNudge ? <p className='dp-nudge'>{monthlyNudge}</p> : null}
<div className='dp-gifts' role='radiogroup' aria-label={copy.giftsLabel}>
{gifts.map((g, i) => {
const on = giftIdx === i;
return (
<label key={i} className={'dp-gift' + (on ? ' is-on' : '')}>
<input
className='dp-sr'
type='radio'
name={uid + '-gift'}
value={i}
checked={on}
onChange={() => pickGift(i)}
disabled={isOff}
/>
<span className='dp-gift-amt'>{money(amountOf(g), currency)}</span>
{monthly ? <span className='dp-gift-per'>{copy.perMonth}</span> : null}
{on ? (
<span className='dp-gift-tick' aria-hidden='true'>
<Check size={14} strokeWidth={3} />
</span>
) : null}
</label>
);
})}
</div>
<div className='dp-impact' aria-live='polite'>
<span className='dp-impact-icon' aria-hidden='true'>
<Waves size={20} strokeWidth={2.5} />
</span>
<p key={impactKey} className='dp-impact-text'>
{impactAmount ? (
<>
<strong>
{impactAmount}
{monthly ? copy.perMonth : ''}
</strong>{' '}
</>
) : null}
{impactNode}
</p>
</div>
<div className='dp-custom'>
<label htmlFor={uid + '-amt'} className='dp-field-label'>
{copy.customLabel}
</label>
<div
className={
'dp-field' + (giftIdx === null && valid ? ' is-on' : '') + (showError ? ' is-error' : '')
}
>
<span className='dp-field-pre' aria-hidden='true'>
{currency}
</span>
<input
ref={customRef}
id={uid + '-amt'}
type='text'
inputMode='decimal'
autoComplete='off'
placeholder={copy.customPlaceholder}
value={custom}
onChange={onCustom}
onBlur={() => {
if (custom.trim()) setTouched(true);
}}
onKeyDown={(e) => {
if (e.key === 'Enter') setTouched(true);
}}
aria-invalid={showError || undefined}
aria-describedby={showError ? uid + '-err' : undefined}
disabled={isOff}
/>
{monthly && custom.trim() ? <span className='dp-field-suf'>{copy.perMonth}</span> : null}
</div>
{showError ? (
<p id={uid + '-err'} className='dp-err' role='alert'>
<AlertCircle size={16} strokeWidth={2.5} aria-hidden='true' />
{errorText}
</p>
) : null}
</div>
{fee ? (
<label className='dp-fee'>
<input
className='dp-sr'
type='checkbox'
checked={coverFee}
onChange={(e) => setCoverFee(e.target.checked)}
disabled={isOff}
/>
<span className='dp-box' aria-hidden='true'>
<Check size={16} strokeWidth={3} />
</span>
<span>
{valid && amount !== null
? fillNodes(copy.feeLabel, {
fee: money(feeAmount, currency, true),
amount: money(amount, currency),
})
: copy.feePending}
</span>
</label>
) : null}
{taxNote ? <p className='dp-note'>{taxNote}</p> : null}
<div className='dp-give'>
<div className='dp-sum'>
<span className='dp-sum-label'>
{valid ? (monthly ? copy.totalMonthly : copy.totalOnce) : copy.chooseHint}
</span>
<span className={'dp-sum-num' + (valid ? '' : ' is-empty')}>
{money(total, currency)}
{valid && monthly ? <span className='dp-sum-per'>{copy.perMonth}</span> : null}
</span>
{valid && feeAdded && amount !== null ? (
<span className='dp-sum-break'>
{fill(copy.breakdown, { gift: money(amount, currency), fee: money(feeAmount, currency, true) })}
</span>
) : null}
</div>
<button type='submit' className='dp-btn' disabled={isOff || !valid}>
<HandHeart size={20} strokeWidth={2.5} aria-hidden='true' />
<span>{monthly ? copy.giveMonthly : copy.give}</span>
</button>
</div>
</form>
{story.length ? (
<div className='dp-story dp-in'>
{story.map((s, i) => (
<p key={i} className={isPunch(s) ? 'dp-punch' : undefined}>
{s}
</p>
))}
</div>
) : null}
</div>
</section>
);
}
export default DonationPicker2;
const ERROR_SAMPLE = '3';
const DEFAULT_GIFTS: DonationGift[] = [{ amount: 25 }, { amount: 50 }, { amount: 100 }];
const DEFAULT_COPY: DonationPicker2Copy = {
frequencyLabel: 'How often would you like to give?',
once: 'One time',
monthly: 'Monthly',
giftsLabel: 'Choose your gift',
perMonth: '/mo',
customLabel: 'Or give another amount',
customPlaceholder: '75',
customImpact: 'helps pay for the work you see here.',
impactEmpty: 'Pick an amount to see what your gift does.',
feeLabel: 'Add {fee} to cover card fees, so all {amount} goes to the work',
feePending: 'Cover the card processing fee',
totalOnce: 'Your gift today',
totalMonthly: 'Your gift each month',
breakdown: '{gift} gift + {fee} card fee',
chooseHint: 'Choose an amount to continue',
give: 'Give now',
giveMonthly: 'Give monthly',
errorNumber: 'Enter the amount in numbers, like 75.',
errorMin: 'The smallest gift we can take is {min}.',
};
function round2(n: number) {
return Math.round(n * 100) / 100;
}
function money(n: number, currency: string, cents = false) {
const hasCents = cents || Math.round(n * 100) % 100 !== 0;
return (
currency +
n.toLocaleString('en-US', { minimumFractionDigits: hasCents ? 2 : 0, maximumFractionDigits: 2 })
);
}
function parseAmount(
raw: string,
currency: string,
min: number
): { value: number | null; error: 'number' | 'min' | null } {
let s = raw.trim();
if (currency && s.startsWith(currency)) s = s.slice(currency.length).trim();
s = s.split(',').join('');
if (s === '') return { value: null, error: null };
if (!/^[0-9]+([.][0-9]{0,2})?$/.test(s) && !/^[.][0-9]{1,2}$/.test(s)) return { value: null, error: 'number' };
const n = Number(s);
if (!Number.isFinite(n) || n < min) return { value: n, error: 'min' };
return { value: n, error: null };
}
function fill(template: string, map: Record<string, string>) {
return template.replace(/[{]([a-z]+)[}]/gi, (m: string, k: string) => (k in map ? map[k] : m));
}
function fillNodes(template: string, map: Record<string, string>): React.ReactNode[] {
return template.split(/([{][a-z]+[}])/i).map((part, i) => {
const key = part.slice(1, -1);
return part.startsWith('{') && part.endsWith('}') && key in map ? <strong key={i}>{map[key]}</strong> : part;
});
}
function isPunch(s: React.ReactNode) {
return typeof s === 'string' && s.trim().length > 0 && !s.trim().includes(' ');
}
const CSS = `
.cf-donation-picker-2{--dp-gutter:clamp(16px,5vw,48px);--dp-photo-h:clamp(600px,52vw,760px);--dp-pad:clamp(20px,3vw,32px);--dp-ink:var(--ink,#141a2a);--dp-card:var(--card,#fff);--dp-accent:var(--accent,#2563c9);--dp-sh:var(--shadow,oklch(0.22 0.03 260));--dp-well:color-mix(in oklch,var(--dp-ink) 4%,var(--dp-card));--dp-line:oklch(from var(--dp-ink) l c h / .12);position:relative;isolation:isolate;overflow-x:clip;background:var(--surface,#fff);color:var(--dp-ink);font-family:var(--font-body,system-ui,sans-serif);padding:clamp(56px,8vw,112px) 0 clamp(64px,8.5vw,120px)}
.cf-donation-picker-2 *,.cf-donation-picker-2 *::before,.cf-donation-picker-2 *::after{box-sizing:border-box}
.cf-donation-picker-2 .dp-wrap{max-width:calc(1120px + 2 * var(--dp-gutter));margin:0 auto;padding:0 var(--dp-gutter);display:flex;flex-direction:column}
.cf-donation-picker-2 .dp-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;opacity:0}
.cf-donation-picker-2 .dp-head{order:1;width:100%;max-width:560px;margin:0 auto 24px}
.cf-donation-picker-2 .dp-place{margin:0 0 12px;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted,#4b5565);text-wrap:pretty}
.cf-donation-picker-2 .dp-inline{display:inline-block;vertical-align:-.15em;margin-inline-end:.4em;color:var(--dp-accent)}
.cf-donation-picker-2 .dp-title{margin:0;font-family:var(--font-display,system-ui,sans-serif);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}
.cf-donation-picker-2 .dp-lead{margin:16px 0 0;max-width:54ch;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--muted,#4b5565);text-wrap:pretty}
.cf-donation-picker-2 .dp-photo{order:2;position:relative;margin:0 calc(-1 * var(--dp-gutter));aspect-ratio:4 / 3;overflow:hidden;background:var(--band,#1b2a4a);clip-path:polygon(0 0,100% 0,100% 86%,0 100%)}
.cf-donation-picker-2 .dp-photo img{position:absolute;inset:0;display:block;width:100%;height:100%;object-fit:cover}
.cf-donation-picker-2 .dp-scrim{position:absolute;inset:0;display:none}
.cf-donation-picker-2 .dp-card{order:3;position:relative;z-index:1;width:100%;max-width:560px;margin:-72px auto 0;display:flex;flex-direction:column;gap:20px;padding:var(--dp-pad);background:var(--dp-card);color:var(--dp-ink);border:1px solid var(--card-border,oklch(from var(--dp-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(--dp-sh) l c h / .22),0 12px 24px -8px oklch(from var(--dp-sh) l c h / .32)))}
.cf-donation-picker-2 .dp-card-title{margin:0;font-family:var(--font-display,system-ui,sans-serif);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;font-weight:var(--display-weight,800);letter-spacing:-.01em;text-transform:var(--display-case,none);text-wrap:balance}
.cf-donation-picker-2 .dp-freq{position:relative;display:grid;grid-template-columns:1fr 1fr;padding:4px;border-radius:var(--radius,12px);background:color-mix(in oklch,var(--dp-ink) 6%,var(--dp-card))}
.cf-donation-picker-2 .dp-freq-thumb{position:absolute;top:4px;bottom:4px;left:4px;width:calc(50% - 4px);border-radius:calc(var(--radius,12px) - 3px);background:oklch(from var(--dp-card) calc(l + .1) c h);box-shadow:var(--shadow-sm,0 1px 1px oklch(from var(--dp-sh) l c h / .18),0 1px 3px oklch(from var(--dp-sh) l c h / .14));transition:transform .28s cubic-bezier(.2,.7,.2,1)}
.cf-donation-picker-2 .dp-freq[data-monthly='true'] .dp-freq-thumb{transform:translateX(100%)}
.cf-donation-picker-2 .dp-freq-opt{position:relative;z-index:1;display:flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:0 12px;border-radius:calc(var(--radius,12px) - 3px);font-size:1rem;line-height:1.2;font-weight:700;color:var(--muted,#4b5565);cursor:pointer;transition:color .16s ease}
.cf-donation-picker-2 .dp-freq-opt:hover{color:var(--dp-ink)}
.cf-donation-picker-2 .dp-freq-opt.is-on{color:var(--dp-ink);font-weight:800}
.cf-donation-picker-2 .dp-freq-opt:has(input:focus-visible){outline:3px solid oklch(from var(--dp-accent) l c h / .55);outline-offset:-1px}
.cf-donation-picker-2 .dp-freq-opt:has(input:disabled){cursor:not-allowed}
.cf-donation-picker-2 .dp-nudge{margin:-8px 0 0;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted,#4b5565);text-wrap:pretty}
.cf-donation-picker-2 .dp-gifts{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.cf-donation-picker-2 .dp-gift{position:relative;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;min-height:84px;padding:12px;border-radius:var(--radius,12px);background:var(--dp-well);box-shadow:inset 0 0 0 1px var(--dp-line);color:var(--dp-ink);text-align:center;cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background-color .16s ease}
.cf-donation-picker-2 .dp-gift:hover{background:color-mix(in oklch,var(--dp-ink) 7%,var(--dp-card));box-shadow:inset 0 0 0 1px oklch(from var(--dp-ink) l c h / .32)}
.cf-donation-picker-2 .dp-gift.is-on{background:color-mix(in oklch,var(--dp-accent) 10%,var(--dp-card));box-shadow:inset 0 0 0 2px var(--dp-accent),var(--shadow-md,0 1px 2px oklch(from var(--dp-sh) l c h / .22),0 4px 10px -2px oklch(from var(--dp-sh) l c h / .2));transform:translateY(-2px)}
.cf-donation-picker-2 .dp-gift:active{transform:translateY(0) scale(.98)}
.cf-donation-picker-2 .dp-gift:has(input:focus-visible){outline:3px solid oklch(from var(--dp-accent) l c h / .55);outline-offset:3px}
.cf-donation-picker-2 .dp-gift:has(input:disabled){cursor:not-allowed;opacity:.6}
.cf-donation-picker-2 .dp-gift-amt{font-family:var(--font-display,system-ui,sans-serif);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;font-weight:800;letter-spacing:-.01em;font-variant-numeric:lining-nums tabular-nums}
.cf-donation-picker-2 .dp-gift-per{font-size:.875rem;line-height:1.2;font-weight:800;color:var(--muted,#4b5565)}
.cf-donation-picker-2 .dp-gift.is-on .dp-gift-per{color:var(--dp-ink)}
.cf-donation-picker-2 .dp-gift-tick{position:absolute;top:8px;right:8px;display:grid;place-items:center;width:20px;height:20px;border-radius:999px;background:var(--accent-fill,var(--dp-accent));color:var(--accent-fill-ink,#fff);animation:dp-pop .3s cubic-bezier(.2,.7,.2,1) both}
.cf-donation-picker-2 .dp-impact{display:flex;align-items:flex-start;gap:12px;min-height:76px;padding:16px;border-radius:10px;background:var(--dp-well)}
.cf-donation-picker-2 .dp-impact-icon{flex:none;display:grid;place-items:center;width:40px;height:40px;border-radius:999px;background:var(--accent-fill,var(--dp-accent));color:var(--accent-fill-ink,#fff)}
.cf-donation-picker-2 .dp-impact-text{margin:0;align-self:center;font-size:1.0625rem;line-height:1.4;font-weight:500;color:var(--dp-ink);text-wrap:pretty;animation:dp-rise .45s cubic-bezier(.2,.7,.2,1) both}
.cf-donation-picker-2 .dp-impact-text strong{font-weight:800;font-variant-numeric:lining-nums tabular-nums}
.cf-donation-picker-2 .dp-field-label{display:block;margin:0 0 8px;font-size:1rem;line-height:1.3;font-weight:700;color:var(--label-ink,var(--dp-ink))}
.cf-donation-picker-2 .dp-field{display:flex;align-items:center;height:56px;overflow:hidden;background:var(--field,#fff);color:var(--field-ink,#141a2a);border:1px solid var(--field-border,color-mix(in oklch,var(--dp-ink) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));transition:border-color .16s ease,box-shadow .16s ease}
.cf-donation-picker-2 .dp-field:hover{border-color:color-mix(in oklch,var(--dp-ink) 40%,transparent)}
.cf-donation-picker-2 .dp-field.is-on{border-color:var(--dp-accent);box-shadow:inset 0 0 0 1px var(--dp-accent)}
.cf-donation-picker-2 .dp-field:focus-within{border-color:var(--field-focus,var(--dp-accent));box-shadow:0 0 0 3px oklch(from var(--field-focus,var(--dp-accent)) l c h / .35)}
.cf-donation-picker-2 .dp-field.is-error{border-color:var(--danger,#c0362c);box-shadow:inset 0 0 0 1px var(--danger,#c0362c)}
.cf-donation-picker-2 .dp-field.is-error:focus-within{box-shadow:0 0 0 3px oklch(from var(--danger,#c0362c) l c h / .3)}
.cf-donation-picker-2 .dp-field-pre,.cf-donation-picker-2 .dp-field-suf{flex:none;font-size:1.0625rem;font-weight:700;color:color-mix(in oklch,var(--field-ink,#141a2a) 65%,var(--field,#fff))}
.cf-donation-picker-2 .dp-field-pre{padding-left:16px}
.cf-donation-picker-2 .dp-field-suf{padding-right:16px}
.cf-donation-picker-2 .dp-field input{flex:1;min-width:0;height:100%;padding:0 16px 0 6px;border:0;background:var(--field,#fff);color:var(--field-ink,#141a2a);font:inherit;font-size:1.0625rem;font-weight:700;font-variant-numeric:tabular-nums;outline:none}
.cf-donation-picker-2 .dp-field input::placeholder{color:color-mix(in oklch,var(--field-ink,#141a2a) 65%,var(--field,#fff));opacity:1;font-weight:500}
.cf-donation-picker-2 .dp-field input:disabled{cursor:not-allowed}
.cf-donation-picker-2 .dp-err{margin:8px 0 0;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--danger,#c0362c);text-wrap:pretty}
.cf-donation-picker-2 .dp-err svg{display:inline-block;vertical-align:-.15em;margin-inline-end:.4em}
.cf-donation-picker-2 .dp-fee{position:relative;display:flex;align-items:flex-start;gap:12px;font-size:1rem;line-height:1.4;font-weight:500;color:var(--dp-ink);cursor:pointer;text-wrap:pretty}
.cf-donation-picker-2 .dp-fee strong{font-weight:800;font-variant-numeric:tabular-nums}
.cf-donation-picker-2 .dp-box{flex:none;display:grid;place-items:center;width:24px;height:24px;margin-top:-1px;border-radius:calc(var(--radius,12px) / 2);border:2px solid oklch(from var(--dp-ink) l c h / .42);background:var(--field,#fff);color:transparent;transition:background-color .16s ease,border-color .16s ease}
.cf-donation-picker-2 .dp-fee:hover .dp-box{border-color:oklch(from var(--dp-ink) l c h / .7)}
.cf-donation-picker-2 .dp-fee input:checked + .dp-box{background:var(--accent-fill,var(--dp-accent));border-color:var(--accent-fill,var(--dp-accent));color:var(--accent-fill-ink,#fff)}
.cf-donation-picker-2 .dp-fee input:focus-visible + .dp-box{outline:3px solid oklch(from var(--dp-accent) l c h / .55);outline-offset:2px}
.cf-donation-picker-2 .dp-fee:has(input:disabled){cursor:not-allowed;opacity:.6}
.cf-donation-picker-2 .dp-note{margin:-4px 0 0;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted,#4b5565);text-wrap:pretty}
.cf-donation-picker-2 .dp-give{display:flex;flex-direction:column;gap:16px;padding-top:8px}
.cf-donation-picker-2 .dp-sum{display:flex;flex-direction:column;align-items:flex-start;min-width:0}
.cf-donation-picker-2 .dp-sum-label{font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted,#4b5565);text-wrap:pretty}
.cf-donation-picker-2 .dp-sum-num{margin-top:8px;font-family:var(--font-display,system-ui,sans-serif);font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1;font-weight:800;letter-spacing:-.03em;font-variant-numeric:lining-nums tabular-nums;white-space:nowrap;color:var(--dp-ink)}
.cf-donation-picker-2 .dp-sum-num.is-empty{color:var(--muted,#4b5565)}
.cf-donation-picker-2 .dp-sum-per{margin-left:4px;font-family:var(--font-body,system-ui,sans-serif);font-size:1.0625rem;font-weight:700;letter-spacing:0;color:var(--muted,#4b5565)}
.cf-donation-picker-2 .dp-sum-break{margin-top:12px;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted,#4b5565);font-variant-numeric:tabular-nums}
.cf-donation-picker-2 .dp-btn{--dp-b:var(--button-bg,var(--cta,#d63a2f));--dp-b2:var(--button-bg-2,var(--cta-2,#b92e24));display:inline-flex;align-items:center;justify-content:center;gap:10px;width:100%;min-height:64px;padding:0 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));font-family:var(--button-font,var(--font-display,system-ui,sans-serif));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);white-space:nowrap;color:var(--button-ink,var(--cta-ink,#fff));text-shadow:var(--button-text-shadow,none);background:linear-gradient(oklch(from var(--dp-b) calc(l + .04) c h),oklch(from var(--dp-b2) calc(l - .02) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--dp-b) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--dp-b) calc(l - .16) c h),0 1px 2px oklch(from var(--dp-sh) l c h / .3),0 8px 16px -6px oklch(from var(--dp-sh) l c h / .45));cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
.cf-donation-picker-2 .dp-btn:not(:disabled):hover,.cf-donation-picker-2.is-hover .dp-btn:not(:disabled){background:linear-gradient(oklch(from var(--dp-b) calc(l - .01) c h),oklch(from var(--dp-b2) calc(l - .07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--dp-b) calc(l + .1) c h / .6),inset 0 -3px 0 oklch(from var(--dp-b) calc(l - .2) c h),0 1px 2px oklch(from var(--dp-sh) l c h / .32),0 10px 18px -6px oklch(from var(--dp-sh) l c h / .55));transform:translateY(-1px)}
.cf-donation-picker-2 .dp-btn:not(:disabled):active,.cf-donation-picker-2.is-active .dp-btn:not(:disabled){transform:translateY(1px);background:linear-gradient(oklch(from var(--dp-b) calc(l - .04) c h),oklch(from var(--dp-b2) calc(l - .08) c h));box-shadow:inset 0 2px 4px oklch(from var(--dp-b) calc(l - .22) c h / .55),inset 0 -2px 0 oklch(from var(--dp-b) calc(l - .16) c h),0 1px 1px oklch(from var(--dp-sh) l c h / .3)}
.cf-donation-picker-2 .dp-btn:focus-visible{outline:3px solid oklch(from var(--dp-accent) l c h / .6);outline-offset:3px}
.cf-donation-picker-2 .dp-btn:disabled{background:var(--button-2-bg,var(--secondary,#e7eaf0));color:color-mix(in oklch,var(--button-2-ink,var(--secondary-ink,#141a2a)) 80%,var(--button-2-bg,var(--secondary,#e7eaf0)));text-shadow:none;box-shadow:none;cursor:not-allowed}
.cf-donation-picker-2 .dp-story{order:4;display:flex;flex-direction:column;gap:12px;width:100%;max-width:560px;margin:40px auto 0}
.cf-donation-picker-2 .dp-story p{margin:0;max-width:60ch;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;color:var(--dp-ink);text-wrap:pretty}
.cf-donation-picker-2 .dp-story p:first-child{font-weight:700}
.cf-donation-picker-2 .dp-story .dp-punch{font-family:var(--font-display,system-ui,sans-serif);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;font-weight:var(--display-weight,800);letter-spacing:-.01em}
@media (min-width:600px) and (max-width:899.98px){
.cf-donation-picker-2 .dp-photo{aspect-ratio:16 / 10}
}
@media (max-width:599.98px){
.cf-donation-picker-2 .dp-gifts{gap:8px}
.cf-donation-picker-2 .dp-gift{min-height:76px;padding:12px 8px}
.cf-donation-picker-2 .dp-sum-num{margin-top:4px}
.cf-donation-picker-2 .dp-sum-break{margin-top:8px}
.cf-donation-picker-2 .dp-btn{gap:8px;padding:0 20px}
}
@media (min-width:900px){
.cf-donation-picker-2{padding-top:0}
.cf-donation-picker-2 .dp-wrap{display:grid;grid-template-columns:minmax(0,1fr) minmax(400px,480px);grid-template-rows:auto 1fr;column-gap:clamp(32px,5vw,72px);align-items:start}
.cf-donation-picker-2 .dp-photo{position:absolute;top:0;left:0;right:0;z-index:-1;height:var(--dp-photo-h);margin:0;aspect-ratio:auto;clip-path:polygon(0 0,100% 0,100% 74%,0 100%)}
.cf-donation-picker-2 .dp-scrim{display:block;background:linear-gradient(to top,oklch(from var(--band,#1b2a4a) l c h / .92) 0%,oklch(from var(--band,#1b2a4a) l c h / .78) 42%,oklch(from var(--band,#1b2a4a) l c h / .36) 68%,oklch(from var(--band,#1b2a4a) l c h / 0) 88%),linear-gradient(90deg,oklch(from var(--band,#1b2a4a) l c h / .72) 0%,oklch(from var(--band,#1b2a4a) l c h / .48) 40%,oklch(from var(--band,#1b2a4a) l c h / 0) 72%)}
.cf-donation-picker-2 .dp-head{grid-column:1;grid-row:1;display:flex;flex-direction:column;justify-content:flex-end;min-height:var(--dp-photo-h);max-width:none;margin:0;padding:clamp(56px,8vw,112px) 0 clamp(104px,12vw,180px);color:var(--band-ink,#fff)}
.cf-donation-picker-2 .dp-head .dp-place,.cf-donation-picker-2 .dp-head .dp-lead,.cf-donation-picker-2 .dp-head .dp-inline{color:var(--band-ink,#fff)}
.cf-donation-picker-2 .dp-head .dp-title,.cf-donation-picker-2 .dp-head .dp-place,.cf-donation-picker-2 .dp-head .dp-lead{text-shadow:0 1px 2px oklch(from var(--dp-sh) l c h / .45)}
.cf-donation-picker-2 .dp-card{grid-column:2;grid-row:1 / span 2;max-width:none;margin:calc(var(--dp-photo-h) * .42) 0 0}
.cf-donation-picker-2 .dp-story{grid-column:1;grid-row:2;max-width:none;margin:0;padding-top:48px}
}
@keyframes dp-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes dp-pop{from{transform:scale(.9)}to{transform:scale(1)}}
.cf-donation-picker-2 .dp-in{animation:dp-rise .45s cubic-bezier(.2,.7,.2,1) both}
.cf-donation-picker-2 .dp-head .dp-in:nth-child(2){animation-delay:.07s}
.cf-donation-picker-2 .dp-head .dp-in:nth-child(3){animation-delay:.14s}
.cf-donation-picker-2 .dp-card.dp-in{animation-delay:.21s}
.cf-donation-picker-2 .dp-story.dp-in{animation-delay:.28s}
@media (prefers-reduced-motion:reduce){
.cf-donation-picker-2 *,.cf-donation-picker-2 *::before,.cf-donation-picker-2 *::after{animation:none !important;transition:none !important}
}
`;
pieces/offer/donation-picker-2/specimen.tsx 61 lines
import __studioImage38e56bfa from "../assets/6ee43e154a8b7806.webp";
import * as React from 'react';
import { slot } from '../../slots';
import { DonationPicker2, type DonationPicker2Props } from '../donation-picker-2';
export const states = ['default', 'hover', 'active', 'disabled', 'error'];
export default function DonationPicker2Specimen({ state }: { state?: DonationPicker2Props['state'] }) {
return (
<DonationPicker2
state={state}
image={slot(
'scene',
__studioImage38e56bfa
)}
imageAlt='Volunteers in waders pulling a tyre and litter out of a shallow river bend at dawn'
imagePosition='64% 40%'
place='The Mill Bend, Calder River'
headline='Give the Mill Bend its river back'
lead='Two miles of water our crew knows by heart. Your gift goes to work right here.'
story={[
'Every Saturday at dawn, our volunteers wade into this same bend of the Calder.',
'They haul out what the floods leave behind: tyres, carts, fishing line and plastic.',
'Your gift buys the gloves, the grabbers and the skip that carries it all away.',
'One bend. One crew. One river.',
'Yours.',
]}
cardTitle='Fund a Saturday on the Mill Bend'
gifts={[
{
amount: 25,
impact: 'buys gloves and grabbers for two new volunteers.',
monthlyAmount: 10,
monthlyImpact: 'keeps one volunteer kitted out all year.',
},
{
amount: 60,
impact: 'pays for the skip that hauls one Saturday’s litter off the bank.',
monthlyAmount: 25,
monthlyImpact: 'covers a skip every few months, rain or shine.',
},
{
amount: 150,
impact: 'funds a full Saturday cleanup: tools, skip and safety kit.',
monthlyAmount: 50,
monthlyImpact: 'keeps the crew on the water every Saturday of the month.',
},
]}
defaultGift={1}
currency='$'
minAmount={5}
fee={{ percent: 2.9, fixed: 0.3 }}
monthlyNudge='Monthly gifts keep the crew on the water all year, not just in spring.'
taxNote='Riverkeep Collective is a registered nonprofit. Gifts are tax-deductible as allowed by law.'
copy={{
customImpact: 'goes to work on the Mill Bend wherever the crew needs it most.',
feeLabel: 'Add {fee} to cover card fees, so all {amount} reaches the river',
}}
/>
);
}
| Name | Type | Details |
|---|---|---|
place OptionalDonationPicker2 |
React.ReactNode |
|
headline OptionalDonationPicker2 |
React.ReactNode |
|
lead OptionalDonationPicker2 |
React.ReactNode |
|
story OptionalDonationPicker2 |
React.ReactNode[] |
|
image OptionalDonationPicker2 |
string |
|
imageAlt OptionalDonationPicker2 |
string |
|
imagePosition OptionalDonationPicker2 |
string |
|
cardTitle OptionalDonationPicker2 |
React.ReactNode |
|
gifts OptionalDonationPicker2 |
DonationGift[] |
|
defaultGift OptionalDonationPicker2 |
number |
|
defaultFrequency OptionalDonationPicker2 |
GiftFrequency |
|
currency OptionalDonationPicker2 |
string |
|
minAmount OptionalDonationPicker2 |
number |
|
fee OptionalDonationPicker2 |
DonationFee |
|
defaultCoverFee OptionalDonationPicker2 |
boolean |
|
monthlyNudge OptionalDonationPicker2 |
React.ReactNode |
|
taxNote OptionalDonationPicker2 |
React.ReactNode |
|
copy OptionalDonationPicker2 |
Partial<DonationPicker2Copy> |
|
state OptionalDonationPicker2 |
'default' | 'hover' | 'active' | 'disabled' | 'error' |
|
disabled OptionalDonationPicker2 |
boolean |
|
onSubmit OptionalDonationPicker2 |
(values: DonationGiftValues) => void |
|
className OptionalDonationPicker2 |
string |
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-ink- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field--field-border--field-focus--field-ink--field-radius- Form inputs: background, ink, border, radius and focus colour.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
scene- A wide atmosphere photo behind or beside the copy.
-
6ee43e154a8b7806.webp
image/webp · 251 KB