Commitment Pledge 2
Turns a registrant into a live attendee: they block out every challenge morning, tile by tile, then lock in the whole week.
Use it in a prompt
Use forms/commitment-pledge-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/forms/commitment-pledge-2.tsx. - Import it and pass your copy and images (Props tab):
import { CommitmentPledge2 } from "@/components/funneldna/forms/commitment-pledge-2"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/forms/commitment-pledge-2/component.tsx 501 lines
// layout: bento-grid
// Turns a registrant into a live attendee: they block out every challenge morning, tile by tile, then lock in the whole week.
'use client'
import * as React from 'react'
import { AlertCircle, CalendarCheck, CalendarPlus, Check, Loader2, Lock } from 'lucide-react'
import { Spot } from '../fx/fx'
import calendarSpot from '../fx/spots/calendar'
export type CommitmentPledge2Day = {
/** Short day label, e.g. 'Day 1'. */
label: string
/** Day name, e.g. 'Monday'. */
day: string
/** Live start time, e.g. '7:00 AM ET'. The leading number is set large and the rest small. */
time: string
/** Optional focus for the day, e.g. 'Hips and low back'. */
note?: string
}
export type CommitmentPledge2State = 'default' | 'hover' | 'active' | 'disabled' | 'error' | 'success'
export type CommitmentPledge2Copy = typeof defaultCopy
export type CommitmentPledge2Props = {
/** Every visible word. Templates accept {count}, {total}, {remaining} and {missing} as text. */
copy?: Partial<CommitmentPledge2Copy>
/** One tile per live day. Day names and times come from here. */
days?: CommitmentPledge2Day[]
/** Replaces the headline built from copy.headlineLead, headlineMark and headlineTail. */
headline?: React.ReactNode
/** scene slot: the after-state photo beside the promise. Omit it and the promise spans the row. */
sceneImage?: string
sceneAlt?: string
/** Plain caption under the photo. */
caption?: string
/** fx Spot illustration above the headline (an imported spot asset). An empty string hides it. */
spotImage?: string
/** Indexes of the days that start ticked. */
defaultChecked?: number[]
disabled?: boolean
/** 'success', 'hover' and 'active' show every day blocked and the button live. */
state?: CommitmentPledge2State
/** Called with the ticked days once every day is blocked. Return a promise to show the loading label. */
onSubmit?: (pledge: { days: CommitmentPledge2Day[] }) => void | Promise<void>
/** Add-to-calendar click, with the days ticked so far. */
onAction?: (days: CommitmentPledge2Day[]) => void
className?: string
style?: React.CSSProperties
}
export function CommitmentPledge2({
copy: copyOverrides,
days = DEFAULT_DAYS,
headline,
sceneImage,
sceneAlt = '',
caption = '',
spotImage = calendarSpot,
defaultChecked,
disabled = false,
state = 'default',
onSubmit,
onAction,
className,
style,
}: CommitmentPledge2Props) {
const copy = { ...defaultCopy, ...copyOverrides }
const uid = React.useId().replace(/:/g, '')
const total = days.length
const isDisabled = disabled || state === 'disabled'
const presetAll = state === 'success' || state === 'hover' || state === 'active'
const presetKey = defaultChecked ? defaultChecked.join(',') : ''
const [checked, setChecked] = React.useState<boolean[]>(() => seed(total, presetAll, defaultChecked))
const [tried, setTried] = React.useState(state === 'error')
const [loading, setLoading] = React.useState(false)
const mounted = React.useRef(true)
const inputs = React.useRef<Array<HTMLInputElement | null>>([])
React.useEffect(() => {
setChecked(seed(total, presetAll, defaultChecked))
setTried(state === 'error')
setLoading(false)
}, [state, total, presetKey])
React.useEffect(() => {
mounted.current = true
return () => {
mounted.current = false
}
}, [])
const count = checked.filter(Boolean).length
const all = total > 0 && count === total
const remaining = Math.max(total - count, 0)
const picked = days.filter((_, i) => checked[i])
const missing = days.filter((_, i) => !checked[i]).map((d) => d.day)
const showError = tried && !all && !isDisabled
const vars = { count, total, remaining, missing: joinList(missing, copy.and) }
const force = state === 'hover' || state === 'active' ? state : undefined
const rem3 = total % 3
const rem2 = total % 2
let hint = text(copy.hintRemaining, vars)
let kind: 'idle' | 'ready' | 'error' | 'disabled' = 'idle'
if (isDisabled) {
hint = copy.disabledNote
kind = 'disabled'
} else if (showError) {
hint = missing.length === total ? text(copy.errorNone, vars) : text(copy.errorMissing, vars)
kind = 'error'
} else if (all) {
hint = copy.hintReady
kind = 'ready'
}
function toggle(index: number, on: boolean) {
setChecked((prev) => days.map((_, j) => (j === index ? on : Boolean(prev[j]))))
}
async function handleSubmit(event: React.FormEvent<HTMLFormElement>) {
event.preventDefault()
if (isDisabled || loading) return
if (!all) {
setTried(true)
const first = days.findIndex((_, i) => !checked[i])
if (first >= 0) inputs.current[first]?.focus()
return
}
const result = onSubmit?.({ days: picked }) as Promise<void> | undefined
if (!result || typeof result.then !== 'function') return
setLoading(true)
try {
await result
} catch {
// The caller reports failures; this piece only resets its button.
} finally {
if (mounted.current) setLoading(false)
}
}
const headlineNode = headline ?? (
<>
{text(copy.headlineLead, vars)} <span className='cp2-mark'>{text(copy.headlineMark, vars)}</span>{' '}
{text(copy.headlineTail, vars)}
</>
)
return (
<section
className={['cf-commitment-pledge-2', className].filter(Boolean).join(' ')}
data-force={force}
data-disabled={isDisabled || undefined}
style={style}
aria-labelledby={uid + '-h'}
>
<style dangerouslySetInnerHTML={{ __html: CSS }} />
<form className='cp2-wrap' noValidate onSubmit={handleSubmit}>
<div className='cp2-grid' data-photo={sceneImage ? 'yes' : 'no'}>
<div className='cp2-card cp2-promise cp2-rise'>
{spotImage ? (
<div className='cp2-spot'>
<Spot src={spotImage} size={72} />
</div>
) : null}
<h2 id={uid + '-h'} className='cp2-h2'>
{headlineNode}
</h2>
{copy.lead ? <p className='cp2-lead'>{text(copy.lead, vars)}</p> : null}
{copy.subhead ? <h3 className='cp2-sub'>{text(copy.subhead, vars)}</h3> : null}
{copy.body ? <p className='cp2-body'>{text(copy.body, vars)}</p> : null}
</div>
{sceneImage ? (
<figure className='cp2-photo cp2-rise' style={{ '--i': 1 } as React.CSSProperties}>
<img src={sceneImage} alt={sceneAlt} width={1024} height={1024} loading='lazy' decoding='async' />
{caption ? <figcaption>{caption}</figcaption> : null}
</figure>
) : null}
<div className='cp2-days' role='group' aria-labelledby={uid + '-g'}>
<span id={uid + '-g'} className='cp2-sr'>
{text(copy.groupLabel, vars)}
</span>
{days.map((d, i) => {
const on = Boolean(checked[i])
const [num, suffix] = splitTime(d.time)
return (
<label
key={d.label + i}
className='cp2-day cp2-rise'
data-checked={on || undefined}
data-error={(showError && !on) || undefined}
style={
{
'--i': i + 1,
'--cp2-span': String(rem3 && i >= total - rem3 ? 12 / rem3 : 4),
'--cp2-span-md': String(rem2 && i === total - 1 ? 2 : 1),
} as React.CSSProperties
}
>
<input
ref={(el) => {
inputs.current[i] = el
}}
className='cp2-input'
type='checkbox'
checked={on}
disabled={isDisabled || loading}
aria-describedby={uid + '-hint'}
onChange={(event) => toggle(i, event.target.checked)}
/>
<span className='cp2-day-top'>
<span className='cp2-day-n'>{d.label}</span>
<span className='cp2-chip' aria-hidden='true'>
<CalendarCheck size={16} strokeWidth={2.5} />
{copy.blockedChip}
</span>
</span>
<span className='cp2-day-name'>{d.day}</span>
<span className='cp2-time'>
<span className='cp2-t-num'>{num}</span>
{suffix ? <span className='cp2-t-suf'>{suffix}</span> : null}
</span>
{d.note ? <span className='cp2-note'>{d.note}</span> : null}
<span className='cp2-check'>
<span className='cp2-box' aria-hidden='true'>
<Check size={16} strokeWidth={3} />
</span>
<span>{copy.checkLabel}</span>
</span>
</label>
)
})}
</div>
<div className='cp2-card cp2-action cp2-rise' style={{ '--i': 4 } as React.CSSProperties}>
<div className='cp2-action-in'>
<div className='cp2-meter'>
<p className='cp2-count' aria-live='polite' aria-atomic='true'>
<span key={count} className='cp2-count-num' data-ready={all || undefined}>
{text(copy.countValue, vars)}
</span>
<span className='cp2-count-unit'>{text(copy.countUnit, vars)}</span>
</p>
<div className='cp2-segs' aria-hidden='true'>
{days.map((d, i) => (
<span key={d.label + i} data-on={checked[i] || undefined} />
))}
</div>
<p id={uid + '-hint'} className='cp2-hint' data-kind={kind} role={kind === 'error' ? 'alert' : undefined}>
{kind === 'error' ? <AlertCircle className='cp2-ico' size={18} strokeWidth={2.5} aria-hidden='true' /> : null}
{kind === 'disabled' ? <Lock className='cp2-ico' size={18} strokeWidth={2.5} aria-hidden='true' /> : null}
{hint}
</p>
</div>
<div className='cp2-actions'>
<button
type='submit'
className='cp2-cta'
disabled={isDisabled}
aria-describedby={uid + '-hint'}
aria-busy={loading || undefined}
>
{loading ? (
<>
<Loader2 className='cp2-spin' size={20} strokeWidth={2.5} aria-hidden='true' />
{copy.loadingLabel}
</>
) : (
<>
{!all || isDisabled ? <Lock size={20} strokeWidth={2.5} aria-hidden='true' /> : null}
{copy.label}
</>
)}
</button>
<button type='button' className='cp2-cal' disabled={isDisabled} onClick={() => onAction?.(picked)}>
<CalendarPlus size={20} strokeWidth={2.5} aria-hidden='true' />
{copy.calendarLabel}
</button>
{copy.reassurance ? <p className='cp2-reassure'>{copy.reassurance}</p> : null}
</div>
</div>
</div>
</div>
</form>
</section>
)
}
export default CommitmentPledge2
const defaultCopy = {
headlineLead: 'Block out',
headlineMark: 'all {total} mornings',
headlineTail: 'before your week fills them',
lead: 'The challenge works when you show up live. Claim each morning now, so nothing else takes it.',
subhead: 'Put it on your calendar and you’ll protect it.',
body: 'A morning you’ve already said yes to is easy to keep. Tick every day you’ll be there, then lock in your week.',
groupLabel: 'Block your {total} live mornings',
checkLabel: 'I’ll be there',
blockedChip: 'Blocked',
countValue: '{count} of {total}',
countUnit: 'days blocked',
hintRemaining: 'Tick {remaining} more to lock in your week.',
hintReady: 'Every morning is blocked. Lock it in.',
errorMissing: 'Tick {missing} to lock in your week.',
errorNone: 'Tick all {total} mornings to lock in your week.',
disabledNote: 'Your mornings open as soon as your registration is confirmed.',
label: 'Lock In My Week',
loadingLabel: 'Locking in your week…',
calendarLabel: 'Add to Calendar',
reassurance: 'Takes 10 seconds.',
and: 'and',
}
const DEFAULT_DAYS: CommitmentPledge2Day[] = [
{ label: 'Day 1', day: 'Monday', time: '7:00 AM' },
{ label: 'Day 2', day: 'Tuesday', time: '7:00 AM' },
{ label: 'Day 3', day: 'Wednesday', time: '7:00 AM' },
{ label: 'Day 4', day: 'Thursday', time: '7:00 AM' },
{ label: 'Day 5', day: 'Friday', time: '7:00 AM' },
]
function seed(total: number, all: boolean, picked?: number[]) {
return Array.from({ length: total }, (_, i) => all || (picked ? picked.includes(i) : false))
}
function text(template: string, vars: Record<string, string | number>) {
return template.replace(/\{(\w+)\}/g, (match, key: string) => (key in vars ? String(vars[key]) : match))
}
function joinList(items: string[], and: string) {
if (items.length <= 1) return items.join('')
return items.slice(0, -1).join(', ') + ' ' + and + ' ' + items[items.length - 1]
}
function splitTime(time: string): [string, string] {
const match = time.trim().match(/^([\d:.]+)\s*(.*)$/)
return match ? [match[1], match[2]] : [time, '']
}
const CSS = `
.cf-commitment-pledge-2{
--cp2-gap:clamp(12px,1.6vw,16px);
--cp2-radius:var(--card-radius,var(--radius,14px));
--cp2-shadow:var(--shadow,oklch(0.22 0.03 260));
--cp2-tile:color-mix(in oklch,var(--band-ink) 7%,var(--band));
--cp2-tile-hover:color-mix(in oklch,var(--band-ink) 12%,var(--band));
--cp2-line:oklch(from var(--band-ink) l c h / .16);
--cp2-soft:color-mix(in oklch,var(--band-ink) 82%,var(--band));
--cp2-fill:var(--accent-fill,var(--accent));
--cp2-fill-ink:var(--accent-fill-ink,var(--card));
--cp2-marker:var(--marker,oklch(from color-mix(in oklch,var(--warning) 32%,var(--card)) l calc(c + .09) h));
position:relative;isolation:isolate;box-sizing:border-box;
background:var(--band);color:var(--band-ink);font-family:var(--font-body);
padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) clamp(64px,8.5vw,120px);
overflow-x:clip;
}
.cf-commitment-pledge-2 *,.cf-commitment-pledge-2 *::before,.cf-commitment-pledge-2 *::after{box-sizing:border-box}
.cf-commitment-pledge-2 :where(h2,h3,p,figure){margin:0}
.cf-commitment-pledge-2 .cp2-sr,.cf-commitment-pledge-2 .cp2-input{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;opacity:0}
.cf-commitment-pledge-2 .cp2-wrap{max-width:1120px;margin:0 auto}
.cf-commitment-pledge-2 .cp2-grid{position:relative;display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:var(--cp2-gap);align-items:stretch}
.cf-commitment-pledge-2 .cp2-days{display:contents}
.cf-commitment-pledge-2 .cp2-card{min-width:0;background:var(--card);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--ink) l c h / .12));border-radius:var(--cp2-radius);box-shadow:var(--card-shadow,var(--shadow-md,0 1px 2px oklch(0.22 0.03 260 / .22),0 4px 10px -2px oklch(0.22 0.03 260 / .2)));padding:clamp(20px,3vw,32px)}
.cf-commitment-pledge-2 .cp2-promise{grid-column:1 / span 7;grid-row:1;display:flex;flex-direction:column;padding:clamp(24px,4vw,48px)}
.cf-commitment-pledge-2 .cp2-grid[data-photo=no] .cp2-promise{grid-column:1 / -1}
.cf-commitment-pledge-2 .cp2-spot{margin-bottom:24px;line-height:0}
.cf-commitment-pledge-2 .cp2-h2{font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06;color:var(--ink);text-wrap:balance}
.cf-commitment-pledge-2 .cp2-mark{background:linear-gradient(180deg,transparent 30%,var(--cp2-marker) 30%,var(--cp2-marker) 96%,transparent 96%);-webkit-box-decoration-break:clone;box-decoration-break:clone;padding:0 .08em}
.cf-commitment-pledge-2 .cp2-lead{margin-top:16px;max-width:60ch;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--ink);text-wrap:pretty}
.cf-commitment-pledge-2 .cp2-sub{margin-top:28px;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(--accent);text-wrap:balance}
.cf-commitment-pledge-2 .cp2-body{margin-top:8px;max-width:60ch;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;color:var(--muted);text-wrap:pretty}
.cf-commitment-pledge-2 .cp2-photo{grid-column:8 / span 5;grid-row:1;display:flex;flex-direction:column;min-width:0}
.cf-commitment-pledge-2 .cp2-photo img{display:block;width:100%;flex:1 1 0;height:0;min-height:280px;object-fit:cover;object-position:50% 40%;border-radius:var(--cp2-radius)}
.cf-commitment-pledge-2 .cp2-photo figcaption{margin-top:12px;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--cp2-soft);text-wrap:pretty}
.cf-commitment-pledge-2 .cp2-day{grid-column:span 4;position:relative;display:flex;flex-direction:column;gap:12px;min-width:0;padding:clamp(20px,2.4vw,28px);border-radius:var(--cp2-radius);background:var(--cp2-tile);color:var(--band-ink);border:1px solid var(--cp2-line);box-shadow:inset 0 1px 0 oklch(from var(--band-ink) l c h / .08);cursor:pointer;-webkit-tap-highlight-color:transparent;transition:background-color .2s ease,border-color .2s ease,color .2s ease,box-shadow .16s ease,translate .16s ease,scale .16s ease}
.cf-commitment-pledge-2 .cp2-day{grid-column:span var(--cp2-span,4)}
.cf-commitment-pledge-2 .cp2-day-top{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:30px}
.cf-commitment-pledge-2 .cp2-day-n{font-size:.875rem;line-height:1.2;font-weight:800;letter-spacing:.08em;text-transform:uppercase;white-space:nowrap;color:var(--cp2-soft)}
.cf-commitment-pledge-2 .cp2-chip{visibility:hidden;display:inline-flex;align-items:center;gap:6px;min-height:28px;padding:4px 12px;border-radius:999px;border:1.5px solid currentColor;font-size:.875rem;line-height:1.2;font-weight:800;white-space:nowrap}
.cf-commitment-pledge-2 .cp2-chip svg{flex:none}
.cf-commitment-pledge-2 .cp2-day-name{margin-top:4px;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}
.cf-commitment-pledge-2 .cp2-time{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 8px}
.cf-commitment-pledge-2 .cp2-t-num{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums}
.cf-commitment-pledge-2 .cp2-t-suf{font-size:.875rem;line-height:1.2;font-weight:800;letter-spacing:.06em;text-transform:uppercase}
.cf-commitment-pledge-2 .cp2-note{margin-top:8px;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--cp2-soft);text-wrap:pretty}
.cf-commitment-pledge-2 .cp2-check{margin-top:auto;display:flex;align-items:center;gap:12px;min-height:52px;padding:12px 16px;border-radius:10px;background:oklch(from var(--band-ink) l c h / .1);box-shadow:inset 0 0 0 1px oklch(from var(--band-ink) l c h / .14);font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.3;font-weight:700}
.cf-commitment-pledge-2 .cp2-box{flex:none;display:grid;place-items:center;width:26px;height:26px;border-radius:7px;border:2px solid currentColor;transition:background-color .2s ease,border-color .2s ease,color .2s ease}
.cf-commitment-pledge-2 .cp2-box svg{opacity:0;scale:.6;transition:opacity .2s ease,scale .2s ease}
.cf-commitment-pledge-2 .cp2-day[data-checked]{background:var(--cp2-fill);color:var(--cp2-fill-ink);border-color:oklch(from var(--cp2-fill) calc(l - .08) c h);box-shadow:inset 0 1px 0 oklch(from var(--cp2-fill) calc(l + .12) c h / .6),0 1px 2px oklch(from var(--cp2-shadow) l c h / .3),0 8px 16px -6px oklch(from var(--cp2-shadow) l c h / .4)}
.cf-commitment-pledge-2 .cp2-day[data-checked] .cp2-day-n,.cf-commitment-pledge-2 .cp2-day[data-checked] .cp2-note{color:var(--cp2-fill-ink)}
.cf-commitment-pledge-2 .cp2-day[data-checked] .cp2-chip{visibility:visible}
.cf-commitment-pledge-2 .cp2-day[data-checked] .cp2-check{background:transparent;box-shadow:inset 0 0 0 1.5px oklch(from var(--cp2-fill-ink) l c h / .45)}
.cf-commitment-pledge-2 .cp2-day[data-checked] .cp2-box{background:var(--cp2-fill-ink);border-color:var(--cp2-fill-ink);color:var(--cp2-fill)}
.cf-commitment-pledge-2 .cp2-day[data-checked] .cp2-box svg{opacity:1;scale:1}
@media (hover:hover){
.cf-commitment-pledge-2 .cp2-day:hover{background:var(--cp2-tile-hover);translate:0 -2px;box-shadow:inset 0 1px 0 oklch(from var(--band-ink) l c h / .1),0 1px 2px oklch(from var(--cp2-shadow) l c h / .3),0 8px 16px -6px oklch(from var(--cp2-shadow) l c h / .45)}
.cf-commitment-pledge-2 .cp2-day[data-checked]:hover{background:oklch(from var(--cp2-fill) calc(l - .04) c h)}
}
.cf-commitment-pledge-2 .cp2-day:active{translate:0 0;scale:.99}
.cf-commitment-pledge-2 .cp2-day:has(.cp2-input:focus-visible){outline:3px solid var(--band-ink);outline-offset:3px}
.cf-commitment-pledge-2 .cp2-day[data-error]{border-color:var(--danger);box-shadow:inset 0 0 0 1px var(--danger)}
.cf-commitment-pledge-2[data-disabled] .cp2-day,.cf-commitment-pledge-2[data-disabled] .cp2-day:hover,.cf-commitment-pledge-2[data-disabled] .cp2-day:active{cursor:not-allowed;opacity:.6;translate:none;scale:none;background:var(--cp2-tile)}
.cf-commitment-pledge-2 .cp2-action{grid-column:1 / -1;container-type:inline-size;display:flex;flex-direction:column;box-shadow:var(--shadow-lg,0 2px 4px oklch(0.22 0.03 260 / .22),0 12px 24px -8px oklch(0.22 0.03 260 / .32))}
.cf-commitment-pledge-2 .cp2-action-in{display:flex;flex-direction:column;gap:24px;flex:1}
.cf-commitment-pledge-2 .cp2-meter{display:flex;flex-direction:column;gap:12px}
.cf-commitment-pledge-2 .cp2-count{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 12px}
.cf-commitment-pledge-2 .cp2-count-num{display:inline-block;transform-origin:left center;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(2.5rem,4.2vw,3.75rem);line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums;color:var(--ink)}
.cf-commitment-pledge-2 .cp2-count-num[data-ready]{color:var(--accent)}
.cf-commitment-pledge-2 .cp2-count-unit{font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:700;color:var(--ink)}
.cf-commitment-pledge-2 .cp2-segs{display:flex;gap:6px}
.cf-commitment-pledge-2 .cp2-segs span{flex:1 1 0;height:10px;border-radius:999px;background:color-mix(in oklch,var(--ink) 10%,var(--card));transition:background-color .25s ease}
.cf-commitment-pledge-2 .cp2-segs span[data-on]{background:var(--cp2-fill)}
.cf-commitment-pledge-2 .cp2-hint{font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted);text-wrap:pretty}
.cf-commitment-pledge-2 .cp2-hint[data-kind=error]{color:var(--danger)}
.cf-commitment-pledge-2 .cp2-hint[data-kind=ready]{color:var(--success)}
.cf-commitment-pledge-2 .cp2-ico{display:inline-block;vertical-align:-0.2em;margin-inline-end:.4em}
.cf-commitment-pledge-2 .cp2-actions{display:flex;flex-direction:column;gap:12px;margin-top:auto}
.cf-commitment-pledge-2 .cp2-reassure{font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted);text-align:center;text-wrap:pretty}
@container (min-width:560px){
.cf-commitment-pledge-2 .cp2-action-in{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);column-gap:clamp(32px,5vw,64px);align-items:start}
.cf-commitment-pledge-2 .cp2-actions{margin-top:0}
}
.cf-commitment-pledge-2 .cp2-cta{
--cp2-bg:var(--button-bg,var(--cta));
--cp2-bg2:var(--button-bg-2,var(--cta-2));
appearance:none;border:0;margin:0;width:100%;min-height:64px;padding:0 28px;
display:inline-flex;align-items:center;justify-content:center;gap:10px;
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(--cp2-bg) calc(l + .04) c h),oklch(from var(--cp2-bg2) calc(l - .02) c h));
box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--cp2-bg) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--cp2-bg) calc(l - .16) c h),0 1px 2px oklch(from var(--cp2-shadow) l c h / .3),0 8px 16px -6px oklch(from var(--cp2-shadow) l c h / .4));
cursor:pointer;transition:background .16s ease,box-shadow .16s ease,translate .16s ease,color .16s ease;
}
.cf-commitment-pledge-2 .cp2-cta svg{flex:none}
.cf-commitment-pledge-2 .cp2-cta:not([aria-disabled=true]):not(:disabled):hover,
.cf-commitment-pledge-2[data-force=hover] .cp2-cta:not([aria-disabled=true]):not(:disabled){
background:linear-gradient(oklch(from var(--cp2-bg) calc(l - .01) c h),oklch(from var(--cp2-bg2) calc(l - .07) c h));
translate:0 -1px;
box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--cp2-bg) calc(l + .12) c h / .7),inset 0 -3px 0 oklch(from var(--cp2-bg) calc(l - .18) c h),0 1px 2px oklch(from var(--cp2-shadow) l c h / .32),0 10px 18px -6px oklch(from var(--cp2-shadow) l c h / .48));
}
.cf-commitment-pledge-2 .cp2-cta:not([aria-disabled=true]):not(:disabled):active,
.cf-commitment-pledge-2[data-force=active] .cp2-cta:not([aria-disabled=true]):not(:disabled){
background:linear-gradient(oklch(from var(--cp2-bg) calc(l - .04) c h),oklch(from var(--cp2-bg2) calc(l - .1) c h));
translate:0 1px;
box-shadow:inset 0 2px 3px oklch(from var(--cp2-bg) calc(l - .22) c h / .5),inset 0 -2px 0 oklch(from var(--cp2-bg) calc(l - .16) c h),0 1px 1px oklch(from var(--cp2-shadow) l c h / .3);
}
.cf-commitment-pledge-2 .cp2-cta:focus-visible,.cf-commitment-pledge-2 .cp2-cal:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:3px}
.cf-commitment-pledge-2 .cp2-cta:disabled{background:color-mix(in oklch,var(--ink) 7%,var(--card));color:var(--ink);text-shadow:none;box-shadow:inset 0 0 0 1px oklch(from var(--ink) l c h / .12);cursor:not-allowed;translate:none}
.cf-commitment-pledge-2 .cp2-cal{appearance:none;margin:0;width:100%;min-height:56px;padding:0 16px;display:inline-flex;align-items:center;justify-content:center;gap:8px;border-radius:var(--button-radius,var(--radius,12px));border:1px solid var(--button-2-border,transparent);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.125rem;line-height:1.15;text-align:center;cursor:pointer;transition:background .16s ease,translate .16s ease}
.cf-commitment-pledge-2 .cp2-cal svg{flex:none}
.cf-commitment-pledge-2 .cp2-cal:not(:disabled):hover{background:oklch(from var(--button-2-bg,var(--secondary)) calc(l - .04) c h)}
.cf-commitment-pledge-2 .cp2-cal:not(:disabled):active{background:oklch(from var(--button-2-bg,var(--secondary)) calc(l - .07) c h);translate:0 1px}
.cf-commitment-pledge-2 .cp2-cal:disabled{opacity:.55;cursor:not-allowed}
@keyframes cp2-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes cp2-pop{from{transform:scale(.9)}to{transform:scale(1)}}
@keyframes cp2-spin{to{transform:rotate(360deg)}}
.cf-commitment-pledge-2 .cp2-spin{animation:cp2-spin .8s linear infinite}
@media (prefers-reduced-motion:no-preference){
.cf-commitment-pledge-2 .cp2-rise{animation:cp2-rise .45s cubic-bezier(.2,.7,.2,1) both;animation-delay:calc(min(var(--i,0),4) * .07s)}
.cf-commitment-pledge-2 .cp2-day[data-checked] .cp2-chip{animation:cp2-pop .3s ease both}
.cf-commitment-pledge-2 .cp2-count-num{animation:cp2-pop .3s ease both}
}
@media (max-width:1023px){
.cf-commitment-pledge-2 .cp2-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.cf-commitment-pledge-2 .cp2-promise,.cf-commitment-pledge-2 .cp2-photo{grid-column:1 / -1;grid-row:auto}
.cf-commitment-pledge-2 .cp2-photo img{flex:none;height:auto;min-height:0;aspect-ratio:16 / 9}
.cf-commitment-pledge-2 .cp2-day{grid-column:span var(--cp2-span-md,1)}
.cf-commitment-pledge-2 .cp2-action{grid-column:1 / -1}
}
@media (max-width:639px){
.cf-commitment-pledge-2 .cp2-grid{grid-template-columns:minmax(0,1fr)}
.cf-commitment-pledge-2 .cp2-day,.cf-commitment-pledge-2 .cp2-action{grid-column:1 / -1}
.cf-commitment-pledge-2 .cp2-photo img{aspect-ratio:4 / 3}
.cf-commitment-pledge-2 .cp2-day{display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:'top top' 'name time' 'note note' 'check check';column-gap:16px;row-gap:12px;align-items:center}
.cf-commitment-pledge-2 .cp2-day-top{grid-area:top}
.cf-commitment-pledge-2 .cp2-day-name{grid-area:name;margin-top:0}
.cf-commitment-pledge-2 .cp2-time{grid-area:time;align-self:center;justify-content:flex-end;flex-wrap:nowrap}
.cf-commitment-pledge-2 .cp2-note{grid-area:note}
.cf-commitment-pledge-2 .cp2-check{grid-area:check;margin-top:8px}
}
@media (prefers-reduced-motion:reduce){
.cf-commitment-pledge-2 *,.cf-commitment-pledge-2 *::before,.cf-commitment-pledge-2 *::after{transition:none !important;animation:none !important}
}
`
pieces/forms/commitment-pledge-2/specimen.tsx 37 lines
import __studioImage93ac52c2 from "../assets/8473a15c9525c898.webp";
import * as React from 'react'
import { CommitmentPledge2, type CommitmentPledge2Day, type CommitmentPledge2State } from '../commitment-pledge-2'
import { slot } from '../../slots'
export const states = ['default', 'hover', 'active', 'disabled', 'error', 'success']
const days: CommitmentPledge2Day[] = [
{ label: 'Day 1', day: 'Monday', time: '7:00 AM ET', note: 'Hips and low back' },
{ label: 'Day 2', day: 'Tuesday', time: '7:00 AM ET', note: 'Spine and shoulders' },
{ label: 'Day 3', day: 'Wednesday', time: '7:00 AM ET', note: 'Ankles and knees' },
{ label: 'Day 4', day: 'Thursday', time: '7:00 AM ET', note: 'Neck and upper back' },
{ label: 'Day 5', day: 'Friday', time: '7:00 AM ET', note: 'Full-body flow' },
]
export default function CommitmentPledge2Specimen({ state = 'default' }: { state?: CommitmentPledge2State }) {
return (
<CommitmentPledge2
state={state}
days={days}
defaultChecked={[0, 1, 2, 3]}
sceneImage={slot(
'scene',
__studioImage93ac52c2,
)}
sceneAlt='A woman doing a kneeling hip stretch on a mat beside a sunny window'
caption='Twenty minutes on the mat, live, before the day gets loud.'
copy={{
lead: 'The Morning Mobility 5-Day Challenge runs live at 7:00 AM. Claim each morning now, so nothing else takes it.',
reassurance: 'Takes 10 seconds. The challenge is free.',
}}
onSubmit={() => undefined}
onAction={() => undefined}
/>
)
}
| Name | Type | Details |
|---|---|---|
copy OptionalCommitmentPledge2 |
Partial<CommitmentPledge2Copy> |
|
days OptionalCommitmentPledge2 |
CommitmentPledge2Day[] |
Default DEFAULT_DAYS
|
headline OptionalCommitmentPledge2 |
React.ReactNode |
|
sceneImage OptionalCommitmentPledge2 |
string |
|
sceneAlt OptionalCommitmentPledge2 |
string |
Default ''
|
caption OptionalCommitmentPledge2 |
string |
Default ''
|
spotImage OptionalCommitmentPledge2 |
string |
Default calendarSpot
|
defaultChecked OptionalCommitmentPledge2 |
number[] |
|
disabled OptionalCommitmentPledge2 |
boolean |
Default false
|
state OptionalCommitmentPledge2 |
CommitmentPledge2State |
Default 'default'
|
onSubmit OptionalCommitmentPledge2 |
(pledge: { days: CommitmentPledge2Day[] }) => void | Promise<void> |
|
onAction OptionalCommitmentPledge2 |
(days: CommitmentPledge2Day[]) => void |
|
className OptionalCommitmentPledge2 |
string |
|
style OptionalCommitmentPledge2 |
React.CSSProperties |
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-focus- Form inputs: background, ink, border, radius and focus colour.
--marker- The highlighter colour behind key phrases.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
scene- A wide atmosphere photo behind or beside the copy.
-
321240b3188e2da4.webp
image/webp · 18.7 KB
-
8473a15c9525c898.webp
image/webp · 117 KB