Challenge Hero 2
Registers visitors for a free challenge. A full-bleed photo carries the day count in huge numerals beside the hook. The join card overlaps the photo's lower edge and lets visitors tab through each day, with a progress track, to preview what they walk away with before they sign up.
Use it in a prompt
Use hero/challenge-hero-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/hero/challenge-hero-2.tsx. - Import it and pass your copy and images (Props tab):
import { ChallengeHero2 } from "@/components/funneldna/hero/challenge-hero-2"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/hero/challenge-hero-2/component.tsx 496 lines
// layout: spotlight-row
// Registers visitors for a free challenge. A full-bleed photo carries the day count in huge numerals beside the hook. The join card overlaps the photo's lower edge and lets visitors tab through each day, with a progress track, to preview what they walk away with before they sign up.
import * as React from 'react'
import { AlertCircle, Loader2, Lock } from 'lucide-react'
export type ChallengeHero2State = 'default' | 'hover' | 'active' | 'disabled' | 'error'
export type ChallengeHero2Day = {
/** Short day title, shown on the tab and in the spotlight */
title: string
/** What the visitor walks away with that day; reads straight after walkAwayLead */
walkAway: string
/** Overrides the generated Day N tab label */
label?: string
}
export type ChallengeHero2Field = {
name: string
label: string
type?: string
autoComplete?: string
placeholder?: string
defaultValue?: string
}
export type ChallengeHero2Props = {
/** Challenge name, set as the pre-headline over the photo */
name?: string
headline?: string
/** One tab per day. The big day count comes from this list. */
days?: ChallengeHero2Day[]
/** Word under the count when there are several days */
countUnit?: string
/** Word under the count when there is one day */
countUnitSingular?: string
/** Screen-reader text for the count. {count} is replaced with the number of days as text. */
countLabel?: string
/** The promise at the top of the join card */
promise?: string
/** Italic aside in the host's voice, under the promise */
aside?: string
/** Accessible name of the day tabs */
tabsLabel?: string
/** {day} is replaced with the one-based day number as text. */
dayLabel?: string
/** Chip in the spotlight. {day} and {count} are replaced as text. */
dayOfLabel?: string
/** Bold lead-in before each day's walk-away line */
walkAwayLead?: string
/** Zero-based day shown first */
defaultDay?: number
fields?: ChallengeHero2Field[]
/** First-person action on the button */
label?: string
/** Second line on the button: the price and format */
sublabel?: string
loadingLabel?: string
privacy?: string
error?: string
emailError?: string
/** {label} is replaced with the lower-case field label as text. */
requiredError?: string
/** Full-bleed photo (scene slot) behind the day count */
sceneImage?: string
sceneAlt?: string
disabled?: boolean
state?: ChallengeHero2State
/** Receives validated values. A returned promise shows the loading label; a rejection shows `error`. */
onSubmit?: (values: Record<string, string>) => void | Promise<void>
className?: string
style?: React.CSSProperties
}
export function ChallengeHero2({
name = 'Free Desk Posture Reset',
headline = 'Undo the desk slump right where you work',
days = DEFAULT_DAYS,
countUnit = 'days',
countUnitSingular = 'day',
countLabel = '{count}-day challenge',
promise = 'Join free and get one short routine a day you can do at your desk, sitting or standing.',
aside = '(No gym, no mat, no changing clothes. I built every move for a desk.)',
tabsLabel = 'Preview each day of the challenge',
dayLabel = 'Day {day}',
dayOfLabel = 'Day {day} of {count}',
walkAwayLead = 'Today you walk away with',
defaultDay = 0,
fields = DEFAULT_FIELDS,
label = 'Yes! I want the Posture Reset',
sublabel = 'Free · One short routine a day',
loadingLabel = 'Saving your spot…',
privacy = 'We respect your inbox. Unsubscribe anytime.',
error = 'We couldn’t complete your registration. Please try again.',
emailError = 'Please enter a valid email address.',
requiredError = 'Please enter your {label}.',
sceneImage,
sceneAlt = '',
disabled = false,
state = 'default',
onSubmit,
className,
style,
}: ChallengeHero2Props) {
const uid = React.useId().replace(/:/g, '')
const n = days.length
const unit = n === 1 ? countUnitSingular : countUnit
const isDisabled = disabled || state === 'disabled'
const emailName = fields.find((f) => f.type === 'email')?.name
const [active, setActive] = React.useState(defaultDay)
const [status, setStatus] = React.useState<Status>('idle')
const [errors, setErrors] = React.useState<Record<string, string>>(() =>
state === 'error' && emailName ? { [emailName]: emailError } : {},
)
const mounted = React.useRef(true)
const tabs = React.useRef<(HTMLButtonElement | null)[]>([])
React.useEffect(() => {
setStatus('idle')
setErrors(state === 'error' && emailName ? { [emailName]: emailError } : {})
}, [state, emailName, emailError])
React.useEffect(() => {
mounted.current = true
return () => {
mounted.current = false
}
}, [])
const current = Math.min(Math.max(0, active), Math.max(0, n - 1))
const loading = status === 'loading'
const live = !isDisabled && !loading
const headingId = `${uid}-h1`
const tabId = (i: number) => `${uid}-tab-${i}`
const panelId = (i: number) => `${uid}-panel-${i}`
const dayName = (d: ChallengeHero2Day, i: number) => d.label ?? fill(dayLabel, { day: String(i + 1) })
const pick = (i: number, focus = false) => {
if (!n) return
const next = (i + n) % n
setActive(next)
const el = tabs.current[next]
if (!el) return
if (focus) el.focus()
else if (typeof el.scrollIntoView === 'function') el.scrollIntoView({ block: 'nearest', inline: 'nearest' })
}
const onTabKey = (e: React.KeyboardEvent<HTMLButtonElement>, i: number) => {
const map: Record<string, number> = { ArrowRight: i + 1, ArrowLeft: i - 1, Home: 0, End: n - 1 }
if (!(e.key in map)) return
e.preventDefault()
pick(map[e.key], true)
}
const clear = (key: string) =>
setErrors((prev) => {
if (!prev[key]) return prev
const next = { ...prev }
delete next[key]
return next
})
const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault()
if (!live) return
const form = event.currentTarget
const data = new FormData(form)
const values: Record<string, string> = {}
const next: Record<string, string> = {}
for (const f of fields) {
const value = String(data.get(f.name) ?? '').trim()
values[f.name] = value
const isEmail = f.type === 'email'
if (!value) next[f.name] = isEmail ? emailError : fill(requiredError, { label: f.label.toLowerCase() })
else if (isEmail && !EMAIL.test(value)) next[f.name] = emailError
}
setErrors(next)
setStatus('idle')
const first = fields.find((f) => next[f.name])
if (first) {
const input = form.elements.namedItem(first.name)
if (input instanceof HTMLInputElement) input.focus()
return
}
try {
const result: unknown = onSubmit?.(values)
if (!result || typeof (result as PromiseLike<void>).then !== 'function') return
setStatus('loading')
await (result as PromiseLike<void>)
if (mounted.current) setStatus('idle')
} catch {
if (mounted.current) setStatus('error')
}
}
const btnClass = [
'c2-btn',
live && state === 'hover' ? 'is-hover' : '',
live && state === 'active' ? 'is-active' : '',
loading ? 'is-loading' : '',
]
.filter(Boolean)
.join(' ')
return (
<section
className={['cf-challenge-hero-2', className].filter(Boolean).join(' ')}
style={style}
aria-labelledby={headingId}
>
<style>{CSS}</style>
<div className='c2-stage'>
{sceneImage ? (
<img className='c2-photo' src={sceneImage} alt={sceneAlt} width={1600} height={900} loading='eager' decoding='async' />
) : null}
<div className='c2-scrim' aria-hidden='true' />
<div className='c2-head'>
{n > 0 ? (
<div className='c2-count'>
<span className='c2-sr'>{fill(countLabel, { count: String(n) })}</span>
<span className='c2-num' aria-hidden='true'>{n}</span>
<span className='c2-unit' aria-hidden='true'>{unit}</span>
</div>
) : null}
<div className='c2-titles'>
{name ? <p className='c2-name'>{name}</p> : null}
<h1 id={headingId} className='c2-h1'>{headline}</h1>
</div>
</div>
</div>
<div className='c2-cardwrap'>
<div className='c2-card'>
<div className='c2-promise'>
{promise ? <p className='c2-lead'>{promise}</p> : null}
{aside ? <p className='c2-aside'>{aside}</p> : null}
</div>
{n > 0 ? (
<div className='c2-days'>
<div className='c2-well'>
<div className='c2-panels'>
{days.map((d, i) => (
<div
key={i}
id={panelId(i)}
role='tabpanel'
aria-labelledby={tabId(i)}
tabIndex={i === current ? 0 : -1}
className={i === current ? 'c2-panel is-on' : 'c2-panel'}
>
<div className='c2-panel-in'>
<span className='c2-chip'>{fill(dayOfLabel, { day: String(i + 1), count: String(n) })}</span>
<h2 className='c2-h3'>{d.title}</h2>
<p className='c2-walk'>
<strong>{walkAwayLead}</strong> {d.walkAway}
</p>
</div>
</div>
))}
</div>
<div
className='c2-progress'
aria-hidden='true'
style={{ gridTemplateColumns: `repeat(${n}, minmax(0, 1fr))` }}
>
{days.map((_, i) => (
<span key={i} className={i <= current ? 'c2-seg is-done' : 'c2-seg'} />
))}
</div>
</div>
<div className='c2-tabs' role='tablist' aria-label={tabsLabel}>
{days.map((d, i) => (
<button
key={i}
ref={(el) => {
tabs.current[i] = el
}}
type='button'
role='tab'
id={tabId(i)}
aria-selected={i === current}
aria-controls={panelId(i)}
tabIndex={i === current ? 0 : -1}
className='c2-tab'
onClick={() => pick(i)}
onKeyDown={(e) => onTabKey(e, i)}
>
<span className='c2-tab-day'>{dayName(d, i)}</span>
<span className='c2-tab-title'>{keepWords(d.title)}</span>
</button>
))}
</div>
</div>
) : null}
<form key={state} className='c2-form' noValidate onSubmit={handleSubmit}>
{fields.map((f) => {
const id = `${uid}-${f.name}`
const err = errors[f.name]
const errId = `${id}-err`
return (
<div className='c2-field' key={f.name}>
<label className='c2-label' htmlFor={id}>{f.label}</label>
<input
id={id}
name={f.name}
type={f.type ?? 'text'}
autoComplete={f.autoComplete}
placeholder={placeholderFor(f)}
defaultValue={f.defaultValue}
disabled={isDisabled}
aria-invalid={err ? true : undefined}
aria-describedby={err ? errId : undefined}
className='c2-input'
onInput={() => clear(f.name)}
/>
{err ? (
<p id={errId} className='c2-err'>
<AlertCircle className='c2-ico' size={16} strokeWidth={2.5} aria-hidden='true' />
{err}
</p>
) : null}
</div>
)
})}
<button type='submit' className={btnClass} disabled={isDisabled || loading} aria-busy={loading || undefined}>
{loading ? (
<span className='c2-btn-load'>
<Loader2 className='c2-spin' size={20} strokeWidth={2.5} aria-hidden='true' />
{loadingLabel}
</span>
) : (
<>
<span className='c2-btn-label'>{label}</span>
{sublabel ? <span className='c2-btn-sub'>{sublabel}</span> : null}
</>
)}
</button>
{privacy ? (
<p className='c2-privacy'>
<Lock className='c2-ico' size={16} strokeWidth={2.5} aria-hidden='true' />
{privacy}
</p>
) : null}
{status === 'error' ? (
<p className='c2-formerr' role='alert'>
<AlertCircle className='c2-ico' size={16} strokeWidth={2.5} aria-hidden='true' />
{error}
</p>
) : null}
</form>
</div>
</div>
</section>
)
}
export default ChallengeHero2
type Status = 'idle' | 'loading' | 'error'
const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
const DEFAULT_DAYS: ChallengeHero2Day[] = [
{ title: 'Desk set-up', walkAway: 'a quick check for your screen height, chair and feet.' },
{ title: 'Neck release', walkAway: 'a gentle neck and upper-back release to do between calls.' },
{ title: 'Open chest', walkAway: 'a doorway stretch that counters the forward hunch.' },
{ title: 'Core wake-up', walkAway: 'three standing-desk moves to practise while you work.' },
{ title: 'Daily plan', walkAway: 'a short daily routine to keep going once the challenge ends.' },
]
const DEFAULT_FIELDS: ChallengeHero2Field[] = [
{ name: 'email', label: 'Email address', type: 'email', autoComplete: 'email', placeholder: 'you@example.com' },
]
function fill(template: string, values: Record<string, string>) {
return Object.keys(values).reduce((out, key) => out.split(`{${key}}`).join(values[key]), template)
}
/** Lets a short tab title wrap only between words, never at a hyphen ("set-/up"). */
function keepWords(text: string) {
const parts = text.split(' ')
return parts.map((w, i) => (
<React.Fragment key={i}>
<span className='c2-word'>{w}</span>
{i < parts.length - 1 ? ' ' : null}
</React.Fragment>
))
}
function placeholderFor(f: ChallengeHero2Field) {
if (f.placeholder) return f.placeholder
if (f.type === 'email') return 'you@example.com'
if (f.type === 'tel') return '(555) 123-4567'
if (/name/i.test(f.name)) return 'Jane Smith'
return ''
}
const CSS = `
.cf-challenge-hero-2{--c2-gutter:clamp(16px,5vw,48px);--c2-overlap:clamp(120px,11vw,160px);--c2-pad:clamp(20px,3vw,32px);--c2-shadow:var(--shadow,oklch(0.22 0.03 260));--c2-b:var(--button-bg,var(--cta));position:relative;isolation:isolate;overflow-x:clip;background:var(--surface);color:var(--ink);font-family:var(--font-body);padding-bottom:clamp(56px,7vw,96px)}
.cf-challenge-hero-2 *,.cf-challenge-hero-2 *::before,.cf-challenge-hero-2 *::after{box-sizing:border-box}
.cf-challenge-hero-2 :where(h1,h2,p){margin:0}
.cf-challenge-hero-2 .c2-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-challenge-hero-2 .c2-stage{position:relative;isolation:isolate;overflow:hidden;display:flex;align-items:flex-end;min-height:clamp(600px,46vw,700px);padding:clamp(56px,8vw,112px) var(--c2-gutter) calc(var(--c2-overlap) + 40px);background:var(--band);color:var(--band-ink)}
.cf-challenge-hero-2 .c2-photo{position:absolute;inset:0;z-index:-2;display:block;width:100%;height:100%;object-fit:cover;object-position:72% 38%}
.cf-challenge-hero-2 .c2-scrim{position:absolute;inset:0;z-index:-1;pointer-events:none;background:linear-gradient(90deg,oklch(from var(--band) l c h / .94) 0%,oklch(from var(--band) l c h / .9) 44%,oklch(from var(--band) l c h / .72) 62%,oklch(from var(--band) l c h / 0) 86%),linear-gradient(0deg,oklch(from var(--band) l c h / .5) 0%,oklch(from var(--band) l c h / 0) 42%)}
.cf-challenge-hero-2 .c2-head{width:100%;max-width:1120px;margin:0 auto;display:grid;grid-template-columns:auto minmax(0,36rem);justify-content:start;align-items:end;column-gap:clamp(24px,3vw,44px)}
.cf-challenge-hero-2 .c2-head>*{animation:c2-rise .45s cubic-bezier(.2,.7,.2,1) both}
.cf-challenge-hero-2 .c2-head>*:nth-child(2){animation-delay:.07s}
.cf-challenge-hero-2 .c2-count{display:flex;flex-direction:column;align-items:flex-start;min-width:0}
.cf-challenge-hero-2 .c2-num{display:block;margin-left:-.04em;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(9rem,15vw,14.5rem);line-height:.86;letter-spacing:-.05em;font-variant-numeric:lining-nums tabular-nums}
.cf-challenge-hero-2 .c2-unit{display:block;margin-top:12px;font-family:var(--font-display);font-weight:800;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:.08em;text-transform:uppercase}
.cf-challenge-hero-2 .c2-titles{min-width:0;padding-bottom:4px}
.cf-challenge-hero-2 .c2-name{margin-bottom:12px;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:700;text-wrap:balance}
.cf-challenge-hero-2 .c2-h1{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(2.5rem,5vw,4.5rem);line-height:1.04;letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);text-wrap:balance}
.cf-challenge-hero-2 .c2-cardwrap{position:relative;z-index:1;margin-top:calc(-1 * var(--c2-overlap));padding:0 var(--c2-gutter)}
.cf-challenge-hero-2 .c2-card{max-width:1120px;margin:0 auto;display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,.9fr);grid-template-areas:'days promise' 'days form';grid-template-rows:auto 1fr;column-gap:clamp(24px,4vw,56px);row-gap:24px;align-items:start;padding:var(--c2-pad);background:var(--card);color:var(--ink);border:1px solid var(--card-border,color-mix(in oklch,var(--accent) 18%,var(--card)));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-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)));animation:c2-rise .45s .14s cubic-bezier(.2,.7,.2,1) both}
.cf-challenge-hero-2 .c2-promise{grid-area:promise;min-width:0}
.cf-challenge-hero-2 .c2-days{grid-area:days;min-width:0;align-self:stretch;display:flex;flex-direction:column}
.cf-challenge-hero-2 .c2-form{grid-area:form;min-width:0}
.cf-challenge-hero-2 .c2-lead{font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;text-wrap:pretty}
.cf-challenge-hero-2 .c2-aside{margin-top:12px;color:var(--muted);font-style:italic;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;text-wrap:pretty}
.cf-challenge-hero-2 .c2-well{flex:1 1 auto;display:flex;flex-direction:column;padding:clamp(20px,2.4vw,28px);border-radius:10px;background:color-mix(in oklch,var(--ink) 4%,var(--card))}
.cf-challenge-hero-2 .c2-panels{display:grid}
.cf-challenge-hero-2 .c2-panel{grid-area:1/1;min-width:0;visibility:hidden}
.cf-challenge-hero-2 .c2-panel.is-on{visibility:visible}
.cf-challenge-hero-2 .c2-panel:focus-visible{outline:3px solid oklch(from var(--field-focus,var(--accent)) l c h / .5);outline-offset:6px;border-radius:6px}
.cf-challenge-hero-2 .c2-panel.is-on .c2-panel-in{animation:c2-rise .45s cubic-bezier(.2,.7,.2,1) both}
.cf-challenge-hero-2 .c2-chip{display:inline-flex;align-items:center;min-height:28px;padding:4px 12px;border-radius:999px;background:var(--accent-fill,var(--accent));color:var(--accent-fill-ink,var(--card));font-size:.875rem;font-weight:800;line-height:1.2;letter-spacing:.04em;font-variant-numeric:lining-nums tabular-nums}
.cf-challenge-hero-2 .c2-h3{margin-top:12px;font-family:var(--font-display);font-weight:800;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-.01em;text-wrap:balance}
.cf-challenge-hero-2 .c2-walk{margin-top:12px;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;text-wrap:pretty}
.cf-challenge-hero-2 .c2-walk strong{font-weight:700}
.cf-challenge-hero-2 .c2-progress{display:grid;gap:6px;margin-top:auto;padding-top:20px}
.cf-challenge-hero-2 .c2-seg{display:block;height:6px;border-radius:999px;background:color-mix(in oklch,var(--ink) 12%,var(--card));transition:background .3s ease}
.cf-challenge-hero-2 .c2-seg.is-done{background:var(--accent-fill,var(--accent))}
.cf-challenge-hero-2 .c2-tabs{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(96px,1fr);gap:8px;margin:10px -6px 0;padding:6px;overflow-x:auto;overscroll-behavior-x:contain;scrollbar-width:thin;scrollbar-color:color-mix(in oklch,var(--ink) 22%,var(--card)) transparent}
.cf-challenge-hero-2 .c2-tab{appearance:none;display:flex;flex-direction:column;align-items:flex-start;justify-content:flex-start;gap:4px;min-width:0;min-height:68px;margin:0;padding:10px 12px;border:1.5px solid transparent;border-radius:10px;background:color-mix(in oklch,var(--ink) 5%,var(--card));color:var(--ink);font-family:var(--font-body);text-align:left;cursor:pointer;scroll-snap-align:start;transition:background .16s ease,border-color .16s ease,box-shadow .16s ease,transform .16s ease}
.cf-challenge-hero-2 .c2-tab-day{font-size:.875rem;font-weight:800;line-height:1.2;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);font-variant-numeric:lining-nums}
.cf-challenge-hero-2 .c2-tab-title{font-size:.9375rem;font-weight:600;line-height:1.3}
.cf-challenge-hero-2 .c2-word{white-space:nowrap}
@media (hover:hover){.cf-challenge-hero-2 .c2-tab:hover{background:color-mix(in oklch,var(--ink) 8%,var(--card))}}
.cf-challenge-hero-2 .c2-tab[aria-selected='true']{background:color-mix(in oklch,var(--accent) 10%,var(--card));border-color:var(--accent);box-shadow:var(--shadow-sm,0 1px 2px oklch(0.22 0.03 260 / .2));transform:translateY(-1px)}
.cf-challenge-hero-2 .c2-tab[aria-selected='true'] .c2-tab-day{color:var(--ink)}
.cf-challenge-hero-2 .c2-tab:active{transform:translateY(0)}
.cf-challenge-hero-2 .c2-tab:focus-visible{outline:3px solid oklch(from var(--field-focus,var(--accent)) l c h / .5);outline-offset:2px}
.cf-challenge-hero-2 .c2-field+.c2-field{margin-top:16px}
.cf-challenge-hero-2 .c2-label{display:block;margin-bottom:8px;color:var(--label-ink,var(--ink));font-size:clamp(1.0625rem,1.25vw,1.125rem);font-weight:700;line-height:1.3}
.cf-challenge-hero-2 .c2-input{display:block;width:100%;min-height:56px;margin:0;padding:0 16px;font-family:var(--font-body);font-size:1.0625rem;font-weight:500;line-height:1.2;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));box-shadow:inset 0 1px 2px oklch(from var(--c2-shadow) l c h / .08);transition:border-color .16s ease,box-shadow .16s ease}
.cf-challenge-hero-2 .c2-input::placeholder{color:color-mix(in oklch,var(--field-ink) 65%,var(--field));opacity:1}
@media (hover:hover){.cf-challenge-hero-2 .c2-input:not(:disabled):not(:focus):hover{border-color:color-mix(in oklch,var(--ink) 38%,transparent)}}
.cf-challenge-hero-2 .c2-input:focus{outline:none;border-color:var(--field-focus,var(--accent));box-shadow:0 0 0 3px oklch(from var(--field-focus,var(--accent)) l c h / .35)}
.cf-challenge-hero-2 .c2-input[aria-invalid='true']{border-color:var(--danger)}
.cf-challenge-hero-2 .c2-input[aria-invalid='true']:focus{box-shadow:0 0 0 3px oklch(from var(--danger) l c h / .3)}
.cf-challenge-hero-2 .c2-input:disabled{cursor:not-allowed;background:color-mix(in oklch,var(--field-ink) 5%,var(--field))}
.cf-challenge-hero-2 .c2-err{margin-top:8px;color:var(--danger);font-size:.9375rem;font-weight:600;line-height:1.4;text-wrap:pretty}
.cf-challenge-hero-2 .c2-ico{display:inline-block;flex:none;vertical-align:-.15em;margin-inline-end:.4em}
.cf-challenge-hero-2 .c2-btn{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;width:100%;min-height:72px;margin:16px 0 0;padding:12px 24px;border:0;border-radius:var(--button-radius,var(--radius,12px));font-family:var(--button-font,var(--font-display));color:var(--button-ink,var(--cta-ink));text-align:center;text-shadow:var(--button-text-shadow,none);background:linear-gradient(oklch(from var(--c2-b) calc(l + .04) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .02) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--c2-b) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--c2-b) calc(l - .16) c h),0 1px 2px oklch(from var(--c2-shadow) l c h / .3),0 8px 16px -6px oklch(from var(--c2-shadow) l c h / .45));cursor:pointer;transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
.cf-challenge-hero-2 .c2-btn-label{display:block;font-size:clamp(1.125rem,1.55vw,1.375rem);font-weight:var(--button-weight,800);line-height:1.15;text-transform:var(--button-case,none);text-wrap:balance}
.cf-challenge-hero-2 .c2-btn-sub{display:block;font-family:var(--font-body);font-size:.9375rem;font-weight:600;line-height:1.3;text-transform:none;text-wrap:balance}
.cf-challenge-hero-2 .c2-btn-load{display:inline-flex;align-items:center;justify-content:center;gap:8px;font-size:clamp(1.125rem,1.55vw,1.375rem);font-weight:var(--button-weight,800);line-height:1.15}
.cf-challenge-hero-2 .c2-btn.is-hover,.cf-challenge-hero-2 .c2-btn:not(:disabled):hover{background:linear-gradient(oklch(from var(--c2-b) calc(l - .01) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--c2-b) calc(l + .12) c h / .7),inset 0 -3px 0 oklch(from var(--c2-b) calc(l - .18) c h),0 1px 2px oklch(from var(--c2-shadow) l c h / .34),0 10px 18px -6px oklch(from var(--c2-shadow) l c h / .52));transform:translateY(-1px)}
.cf-challenge-hero-2 .c2-btn.is-active,.cf-challenge-hero-2 .c2-btn:not(:disabled):active{background:linear-gradient(oklch(from var(--c2-b) calc(l - .05) c h),oklch(from var(--button-bg-2,var(--cta-2)) calc(l - .08) c h));box-shadow:inset 0 2px 4px oklch(from var(--c2-shadow) l c h / .35),inset 0 -2px 0 oklch(from var(--c2-b) calc(l - .16) c h),0 1px 2px oklch(from var(--c2-shadow) l c h / .3);transform:translateY(1px)}
.cf-challenge-hero-2 .c2-btn:focus-visible{outline:3px solid oklch(from var(--field-focus,var(--accent)) l c h / .6);outline-offset:3px}
.cf-challenge-hero-2 .c2-btn:disabled:not(.is-loading){background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));text-shadow:none;box-shadow:var(--button-2-shadow,var(--shadow-sm));cursor:not-allowed;transform:none}
.cf-challenge-hero-2 .c2-btn.is-loading{cursor:progress}
.cf-challenge-hero-2 .c2-spin{animation:c2-spin .8s linear infinite}
.cf-challenge-hero-2 .c2-privacy{margin-top:12px;color:var(--muted);font-size:.9375rem;font-weight:500;line-height:1.4;text-align:center;text-wrap:pretty}
.cf-challenge-hero-2 .c2-formerr{margin-top:12px;padding:12px 16px;border-radius:10px;background:var(--danger-soft);color:var(--danger);font-size:.9375rem;font-weight:600;line-height:1.4;text-wrap:pretty}
@keyframes c2-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes c2-spin{to{transform:rotate(360deg)}}
@media (min-width:861px) and (max-width:1180px){
.cf-challenge-hero-2 .c2-scrim{background:linear-gradient(90deg,oklch(from var(--band) l c h / .94) 0%,oklch(from var(--band) l c h / .9) 58%,oklch(from var(--band) l c h / .6) 84%,oklch(from var(--band) l c h / .35) 100%),linear-gradient(0deg,oklch(from var(--band) l c h / .5) 0%,oklch(from var(--band) l c h / 0) 42%)}
.cf-challenge-hero-2 .c2-head{grid-template-columns:auto minmax(0,30rem)}
}
@media (max-width:860px){
.cf-challenge-hero-2 .c2-stage{display:block;min-height:0;padding:0;background:var(--surface);color:var(--ink)}
.cf-challenge-hero-2 .c2-photo{position:relative;inset:auto;z-index:auto;height:auto;aspect-ratio:4/3;object-position:70% 40%}
.cf-challenge-hero-2 .c2-scrim{display:none}
.cf-challenge-hero-2 .c2-head{grid-template-columns:auto minmax(0,1fr);align-items:start;column-gap:16px;padding:24px var(--c2-gutter) 0}
.cf-challenge-hero-2 .c2-num{font-size:clamp(5rem,22vw,6.5rem);color:var(--accent)}
.cf-challenge-hero-2 .c2-unit{margin-top:8px;font-size:.875rem;color:var(--accent)}
.cf-challenge-hero-2 .c2-h1{font-size:clamp(2rem,8.2vw,2.5rem)}
.cf-challenge-hero-2 .c2-cardwrap{margin-top:24px}
.cf-challenge-hero-2 .c2-card{grid-template-columns:minmax(0,1fr);grid-template-rows:none;grid-template-areas:'promise' 'days' 'form';row-gap:24px}
.cf-challenge-hero-2 .c2-tabs{grid-auto-columns:136px;margin:10px calc(-1 * var(--c2-pad)) 0;padding:6px var(--c2-pad);scroll-padding-inline:var(--c2-pad);scroll-snap-type:x mandatory}
.cf-challenge-hero-2 .c2-btn{padding:12px 16px}
}
@media (prefers-reduced-motion:reduce){
.cf-challenge-hero-2 .c2-head>*,.cf-challenge-hero-2 .c2-card,.cf-challenge-hero-2 .c2-panel.is-on .c2-panel-in{animation:none}
.cf-challenge-hero-2 .c2-spin{animation:none}
.cf-challenge-hero-2 .c2-tab,.cf-challenge-hero-2 .c2-btn,.cf-challenge-hero-2 .c2-input,.cf-challenge-hero-2 .c2-seg{transition:none}
.cf-challenge-hero-2 .c2-tab[aria-selected='true'],.cf-challenge-hero-2 .c2-btn.is-hover,.cf-challenge-hero-2 .c2-btn.is-active,.cf-challenge-hero-2 .c2-btn:not(:disabled):hover,.cf-challenge-hero-2 .c2-btn:not(:disabled):active{transform:none}
}
`
pieces/hero/challenge-hero-2/specimen.tsx 45 lines
import __studioImagecba3d9a3 from "../assets/efeb54a68f03b46f.webp";
// Specimen: the fictional 5-Day Desk Posture Reset on the photo-led challenge hero.
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
import { ChallengeHero2, type ChallengeHero2State } from '../challenge-hero-2'
export const states = ['default', 'hover', 'active', 'disabled', 'error']
const DAYS = [
{ title: 'Desk set-up', walkAway: 'a quick check for your screen height, chair and feet.' },
{ title: 'Neck release', walkAway: 'a gentle neck and upper-back release to do between calls.' },
{ title: 'Open chest', walkAway: 'a doorway stretch that counters the forward hunch.' },
{ title: 'Core wake-up', walkAway: 'three standing-desk moves to practise while you work.' },
{ title: 'Daily plan', walkAway: 'a short daily routine to keep going once the challenge ends.' },
]
export default function ChallengeHero2Specimen({ state = 'default' }: { state?: ChallengeHero2State }) {
const reg = defaults.sample.registration
return (
<ChallengeHero2
state={state}
name='Free Desk Posture Reset'
headline='Undo the desk slump right where you work'
days={DAYS}
promise='Join free and get one short routine a day you can do at your desk, sitting or standing.'
aside='(No gym, no mat, no changing clothes. I built every move for a desk.)'
label='Yes! I want the Posture Reset'
sublabel='Free · One short routine a day'
privacy={reg.privacy}
error={reg.error}
fields={[
{
name: 'email',
label: 'Email address',
type: 'email',
autoComplete: 'email',
placeholder: 'you@example.com',
defaultValue: state === 'error' ? 'dana.r@example' : undefined,
},
]}
sceneImage={slot('scene', __studioImagecba3d9a3)}
sceneAlt='A woman stretching her arms overhead at a standing desk in a bright home office'
/>
)
}
| Name | Type | Details |
|---|---|---|
name OptionalChallengeHero2 |
string |
Default 'Free Desk Posture Reset'
|
headline OptionalChallengeHero2 |
string |
Default 'Undo the desk slump right where you work'
|
days OptionalChallengeHero2 |
ChallengeHero2Day[] |
Default DEFAULT_DAYS
|
countUnit OptionalChallengeHero2 |
string |
Default 'days'
|
countUnitSingular OptionalChallengeHero2 |
string |
Default 'day'
|
countLabel OptionalChallengeHero2 |
string |
Default '{count}-day challenge'
|
promise OptionalChallengeHero2 |
string |
Default 'Join free and get one short routine a day you can do at your desk, sitting or standing.'
|
aside OptionalChallengeHero2 |
string |
Default '(No gym, no mat, no changing clothes. I built every move for a desk.)'
|
tabsLabel OptionalChallengeHero2 |
string |
Default 'Preview each day of the challenge'
|
dayLabel OptionalChallengeHero2 |
string |
Default 'Day {day}'
|
dayOfLabel OptionalChallengeHero2 |
string |
Default 'Day {day} of {count}'
|
walkAwayLead OptionalChallengeHero2 |
string |
Default 'Today you walk away with'
|
defaultDay OptionalChallengeHero2 |
number |
Default 0
|
fields OptionalChallengeHero2 |
ChallengeHero2Field[] |
Default DEFAULT_FIELDS
|
label OptionalChallengeHero2 |
string |
Default 'Yes! I want the Posture Reset'
|
sublabel OptionalChallengeHero2 |
string |
Default 'Free · One short routine a day'
|
loadingLabel OptionalChallengeHero2 |
string |
Default 'Saving your spot…'
|
privacy OptionalChallengeHero2 |
string |
Default 'We respect your inbox. Unsubscribe anytime.'
|
error OptionalChallengeHero2 |
string |
Default 'We couldn’t complete your registration. Please try again.'
|
emailError OptionalChallengeHero2 |
string |
Default 'Please enter a valid email address.'
|
requiredError OptionalChallengeHero2 |
string |
Default 'Please enter your {label}.'
|
sceneImage OptionalChallengeHero2 |
string |
|
sceneAlt OptionalChallengeHero2 |
string |
Default ''
|
disabled OptionalChallengeHero2 |
boolean |
Default false
|
state OptionalChallengeHero2 |
ChallengeHero2State |
Default 'default'
|
onSubmit OptionalChallengeHero2 |
(values: Record<string, string>) => void | Promise<void> |
|
className OptionalChallengeHero2 |
string |
|
style OptionalChallengeHero2 |
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-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.
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
efeb54a68f03b46f.webp
image/webp · 44.8 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB