Challenge Hero 4
Cover-story challenge registration: a magazine spread where the host's portrait and own words sell the challenge, the days read as two editorial columns, and the join card waits at the foot beside a live 'starts in' countdown.
Use it in a prompt
Use hero/challenge-hero-4 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-4.tsx. - Import it and pass your copy and images (Props tab):
import { ChallengeHero4 } from "@/components/funneldna/hero/challenge-hero-4"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/hero/challenge-hero-4/component.tsx 623 lines
// layout: quote-led
// Cover-story challenge registration: a magazine spread where the host's portrait and own words sell the challenge, the days read as two editorial columns, and the join card waits at the foot beside a live 'starts in' countdown.
import * as React from 'react'
import { AlertCircle, Loader2, Lock } from 'lucide-react'
export type ChallengeHero4State = 'default' | 'hover' | 'active' | 'disabled' | 'error'
export type ChallengeHero4Day = {
/** One-line teaser for the day */
title: string
/** Overrides the generated Day N text read by screen readers */
label?: string
}
export type ChallengeHero4Lead = {
/** Bold lead-in phrase that opens the paragraph */
lead: string
text: string
}
export type ChallengeHero4Field = {
name: string
label: string
type?: string
autoComplete?: string
placeholder?: string
}
export type ChallengeHero4Units = {
days: string
hours: string
minutes: string
seconds: string
}
export type ChallengeHero4Props = {
/** Challenge name, set as the masthead nameplate */
name?: string
/** Short format line on the right of the masthead */
issue?: string
headline?: string
/** One continuous phrase inside the headline, set in the accent colour */
highlight?: string
/** Short standfirst paragraphs, each opening with a bold lead-in */
deck?: ChallengeHero4Lead[]
/** Host portrait (presenter slot). The portrait column hides when neither portrait nor quote is supplied. */
portraitImage?: string
portraitAlt?: string
/** Words before the host name in the caption under the portrait */
hostLabel?: string
hostName?: string
hostRole?: string
/** The host's own words, set as the large pull line. Hidden on phones. */
quote?: string
/** Attribution under the pull line. Defaults to the host name. */
quoteBy?: string
daysTitle?: string
/** One teaser per day, split into two columns */
days?: ChallengeHero4Day[]
/** {day} is replaced with the one-based day number as text. */
dayLabel?: string
/** Start time (ISO string, timestamp or Date). The countdown is hidden when absent or invalid. */
startsAt?: string | number | Date
/** Human start date under the countdown label, e.g. Monday, March 1 · 9am ET */
startLabel?: string
countdownLabel?: string
units?: ChallengeHero4Units
/** Shown in place of the numbers once the start time has passed */
startedLabel?: string
/** Accessible countdown text. {days}, {hours} and {minutes} are replaced with numbers as text. */
timerLabel?: string
cardTitle?: string
fields?: ChallengeHero4Field[]
label?: string
loadingLabel?: string
/** One short reassurance line under the button */
sublabel?: string
privacy?: string
error?: string
emailError?: string
/** {label} is replaced with the lower-case field label as text. */
requiredError?: string
disabled?: boolean
state?: ChallengeHero4State
/** 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 ChallengeHero4({
name = '7-Day Short Story Sprint',
issue = 'Free online writing challenge',
headline = 'Finish seven short stories in seven days',
highlight = 'seven short stories',
deck = DEFAULT_DECK,
portraitImage,
portraitAlt = 'Portrait of your challenge host',
hostLabel = 'Hosted by',
hostName,
hostRole,
quote,
quoteBy,
daysTitle = 'Seven days. Seven finished stories.',
days = DEFAULT_DAYS,
dayLabel = 'Day {day}',
startsAt,
startLabel,
countdownLabel = 'Starts in',
units = DEFAULT_UNITS,
startedLabel = 'Day 1 is open. Join and start today.',
timerLabel = 'Starts in {days} days, {hours} hours and {minutes} minutes',
cardTitle = 'Join the sprint free',
fields = DEFAULT_FIELDS,
label = 'Yes! I’m in the Sprint',
loadingLabel = 'Saving your seat…',
sublabel = 'Free · 20 minutes a day · Online',
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}.',
disabled = false,
state = 'default',
onSubmit,
className,
style,
}: ChallengeHero4Props) {
const uid = React.useId().replace(/:/g, '')
const isDisabled = disabled || state === 'disabled'
const fieldKey = fields.map((f) => `${f.name}:${f.type ?? ''}:${f.label}`).join('|')
const mounted = React.useRef(true)
const [status, setStatus] = React.useState<Status>('idle')
const [errors, setErrors] = React.useState<Record<string, string>>(() =>
seedErrors(state, fields, emailError, requiredError),
)
React.useEffect(() => {
setStatus('idle')
setErrors(seedErrors(state, fields, emailError, requiredError))
// fields are tracked through fieldKey, so a new array with the same fields keeps the typed state
}, [state, fieldKey, emailError, requiredError])
React.useEffect(() => {
mounted.current = true
return () => {
mounted.current = false
}
}, [])
const target = toTime(startsAt)
const [now, setNow] = React.useState<number>(() => Date.now())
React.useEffect(() => {
if (target === null) return
setNow(Date.now())
if (Date.now() >= target) return
const id = window.setInterval(() => {
const t = Date.now()
setNow(t)
if (t >= target) window.clearInterval(id)
}, 1000)
return () => window.clearInterval(id)
}, [target])
const showClock = target !== null
const remaining = target === null ? 0 : Math.max(0, target - now)
const started = showClock && remaining <= 0
const total = Math.floor(remaining / 1000)
const dd = Math.floor(total / 86400)
const hh = Math.floor((total % 86400) / 3600)
const mm = Math.floor((total % 3600) / 60)
const ss = total % 60
const parts: [number, string][] = [
[dd, units.days],
[hh, units.hours],
[mm, units.minutes],
[ss, units.seconds],
]
const loading = status === 'loading'
const live = !isDisabled && !loading
const aside = Boolean(portraitImage || quote)
const by = quoteBy ?? hostName
const half = Math.ceil(days.length / 2)
const cols = [days.slice(0, half), days.slice(half)].filter((c) => c.length > 0)
const clock = showClock ? (
<div className={aside ? 'c4-clock c4-in' : 'c4-clock'} style={aside ? delay(0.28) : undefined}>
{started ? (
<p className='c4-started' role='status'>
{startedLabel}
</p>
) : (
<>
<p className='c4-clock-label'>{countdownLabel}</p>
{startLabel ? <p className='c4-clock-date'>{startLabel}</p> : null}
<div
className='c4-units'
role='timer'
aria-label={fill(timerLabel, { days: String(dd), hours: String(hh), minutes: String(mm) })}
>
{parts.map(([v, u], k) => (
<div className='c4-unit' key={k} aria-hidden='true'>
<span
key={k === 3 ? `s${v}` : 'v'}
className={k === 3 ? 'c4-num is-tick' : 'c4-num'}
suppressHydrationWarning
>
{pad(v)}
</span>
<span className='c4-unitname'>{u}</span>
</div>
))}
</div>
</>
)}
</div>
) : null
const at = highlight ? headline.indexOf(highlight) : -1
const h1 =
at < 0 ? (
headline
) : (
<>
{headline.slice(0, at)}
<span className='c4-em'>{highlight}</span>
{headline.slice(at + highlight.length)}
</>
)
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 (!isThenable(result)) return
setStatus('loading')
await result
if (mounted.current) setStatus('idle')
} catch {
if (mounted.current) setStatus('error')
}
}
const btnClass = [
'c4-btn',
live && state === 'hover' ? 'is-hover' : '',
live && state === 'active' ? 'is-active' : '',
loading ? 'is-loading' : '',
]
.filter(Boolean)
.join(' ')
const errId = `${uid}-formerr`
return (
<section
className={['cf-challenge-hero-4', className].filter(Boolean).join(' ')}
style={style}
aria-labelledby={`${uid}-h`}
>
<style>{CSS}</style>
<div className='c4-wrap'>
<header className='c4-mast c4-in'>
<p className='c4-name'>{name}</p>
{issue ? <p className='c4-issue'>{issue}</p> : null}
</header>
<h1 id={`${uid}-h`} className='c4-h1 c4-in' style={delay(0.07)}>
{h1}
</h1>
<div className={aside ? 'c4-spread' : 'c4-spread no-aside'}>
{aside ? (
<div className='c4-aside'>
{portraitImage ? (
<figure className='c4-figure c4-in' style={delay(0.14)}>
<img
className='c4-photo'
src={portraitImage}
alt={portraitAlt}
width={880}
height={1100}
loading='eager'
decoding='async'
/>
{hostName ? (
<figcaption className='c4-cap'>
{hostLabel} <strong>{hostName}</strong>
{hostRole ? <> · {hostRole}</> : null}
</figcaption>
) : null}
</figure>
) : null}
{quote ? (
<figure className='c4-pull c4-in' style={delay(0.21)}>
<blockquote>
<p>
<span className='c4-qm' aria-hidden='true'>“</span>
{quote}
<span className='c4-qm' aria-hidden='true'>”</span>
</p>
</blockquote>
{by ? <figcaption className='c4-by'>{by}</figcaption> : null}
</figure>
) : null}
{clock}
</div>
) : null}
<div className='c4-main'>
{deck.length ? (
<div className='c4-deck c4-in' style={delay(0.14)}>
{deck.map((p, i) => (
<p key={i}>
<strong>{p.lead}</strong> {p.text}
</p>
))}
</div>
) : null}
{days.length ? (
<div className='c4-days c4-in' style={delay(0.21)}>
<h2 className='c4-days-h'>{daysTitle}</h2>
<div className='c4-daycols'>
{cols.map((col, c) => (
<ol className='c4-daylist' key={c} start={c * half + 1}>
{col.map((d, j) => {
const i = c * half + j
return (
<li className='c4-day' key={i}>
<span className='c4-dnum' aria-hidden='true'>
{i + 1}
</span>
<span className='c4-dtitle'>
<span className='c4-sr'>{d.label ?? fill(dayLabel, { day: String(i + 1) })}: </span>
{d.title}
</span>
</li>
)
})}
</ol>
))}
</div>
</div>
) : null}
<div className='c4-join c4-in' style={delay(0.28)}>
{aside ? null : clock}
<div className='c4-card'>
<h2 className='c4-card-h'>{cardTitle}</h2>
<form
className='c4-form'
noValidate
onSubmit={handleSubmit}
aria-describedby={status === 'error' ? errId : undefined}
>
{fields.map((f) => {
const id = `${uid}-${f.name}`
const err = errors[f.name]
return (
<div className='c4-field' key={f.name}>
<label className='c4-label' htmlFor={id}>
{f.label}
</label>
<input
id={id}
name={f.name}
type={f.type ?? 'text'}
autoComplete={f.autoComplete}
placeholder={f.placeholder ?? placeholderFor(f)}
className={err ? 'c4-input is-invalid' : 'c4-input'}
aria-invalid={err ? true : undefined}
aria-describedby={err ? `${id}-err` : undefined}
disabled={isDisabled}
onChange={() => clear(f.name)}
/>
{err ? (
<p className='c4-err' id={`${id}-err`}>
<AlertCircle aria-hidden='true' size={16} strokeWidth={2.5} />
{err}
</p>
) : null}
</div>
)
})}
{status === 'error' ? (
<p className='c4-formerr' id={errId} role='alert'>
<AlertCircle aria-hidden='true' size={16} strokeWidth={2.5} />
{error}
</p>
) : null}
<button type='submit' className={btnClass} disabled={isDisabled} aria-busy={loading || undefined}>
{loading ? (
<>
<Loader2 className='c4-spin' aria-hidden='true' size={20} strokeWidth={2.5} />
<span>{loadingLabel}</span>
</>
) : (
<span>{label}</span>
)}
</button>
{sublabel ? <p className='c4-sub'>{sublabel}</p> : null}
{privacy ? (
<p className='c4-privacy'>
<Lock aria-hidden='true' size={16} strokeWidth={2.5} />
{privacy}
</p>
) : null}
</form>
</div>
</div>
</div>
</div>
</div>
</section>
)
}
export default ChallengeHero4
type Status = 'idle' | 'loading' | 'error'
const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/
const DEFAULT_DECK: ChallengeHero4Lead[] = [
{ lead: 'Twenty minutes a day.', text: 'One prompt lands each morning. You finish one short story before bed.' },
{ lead: 'No blank pages.', text: 'Every day comes with the prompt, a word target and a quick edit pass.' },
]
const DEFAULT_DAYS: ChallengeHero4Day[] = [
{ title: 'Find the story hiding in one true sentence' },
{ title: 'Build a character who wants one thing badly' },
{ title: 'Open in the middle of the trouble' },
{ title: 'Write the scene you keep avoiding' },
{ title: 'Cut 300 words and keep the heartbeat' },
{ title: 'Land an ending that answers the opening' },
{ title: 'Polish your favourite and share it' },
]
const DEFAULT_UNITS: ChallengeHero4Units = { days: 'Days', hours: 'Hours', minutes: 'Mins', seconds: 'Secs' }
const DEFAULT_FIELDS: ChallengeHero4Field[] = [
{ name: 'firstName', label: 'First name', autoComplete: 'given-name', placeholder: 'Jane' },
{ 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)
}
function pad(n: number) {
return String(n).padStart(2, '0')
}
function delay(s: number) {
return { '--d': `${s}s` } as React.CSSProperties
}
function toTime(value: string | number | Date | undefined): number | null {
if (value === undefined || value === null || value === '') return null
const t = value instanceof Date ? value.getTime() : typeof value === 'number' ? value : Date.parse(value)
return Number.isFinite(t) ? t : null
}
function isThenable(value: unknown): value is PromiseLike<unknown> {
return Boolean(value) && typeof (value as PromiseLike<unknown>).then === 'function'
}
function placeholderFor(f: ChallengeHero4Field) {
if (f.type === 'email') return 'you@example.com'
if (f.type === 'tel') return '(555) 123-4567'
return 'Jane Smith'
}
function seedErrors(
state: ChallengeHero4State,
fields: ChallengeHero4Field[],
emailError: string,
requiredError: string,
): Record<string, string> {
if (state !== 'error') return {}
const out: Record<string, string> = {}
for (const f of fields) {
out[f.name] = f.type === 'email' ? emailError : fill(requiredError, { label: f.label.toLowerCase() })
}
return out
}
const CSS = `
.cf-challenge-hero-4{--c4-hair:oklch(from var(--ink) l c h / .14);--c4-shadow:var(--shadow, oklch(.22 .03 260));position:relative;isolation:isolate;overflow:clip;background:var(--surface);color:var(--ink);font-family:var(--font-body);padding:clamp(40px,6vw,80px) clamp(16px,5vw,48px) clamp(64px,8.5vw,120px)}
.cf-challenge-hero-4 *,.cf-challenge-hero-4 *::before,.cf-challenge-hero-4 *::after{box-sizing:border-box}
.cf-challenge-hero-4 :where(h1,h2,p,ol,figure,blockquote){margin:0;padding:0}
.cf-challenge-hero-4 .c4-wrap{max-width:1120px;margin:0 auto}
.cf-challenge-hero-4 .c4-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}
.cf-challenge-hero-4 .c4-mast{display:flex;flex-wrap:wrap;align-items:baseline;justify-content:space-between;gap:8px 24px;padding-bottom:16px;border-bottom:1px solid var(--c4-hair)}
.cf-challenge-hero-4 .c4-name{font-family:var(--font-display);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-.01em;color:var(--ink)}
.cf-challenge-hero-4 .c4-issue{font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--muted)}
.cf-challenge-hero-4 .c4-h1{margin-top:clamp(32px,4vw,48px);font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-.025em);text-transform:var(--display-case,none);font-size:clamp(2.5rem,5.8vw,5.25rem);line-height:1.02;color:var(--ink);text-wrap:balance}
.cf-challenge-hero-4 .c4-em{color:var(--accent)}
.cf-challenge-hero-4 .c4-spread{display:grid;grid-template-columns:minmax(0,5fr) minmax(0,7fr);gap:clamp(32px,5vw,64px);margin-top:clamp(32px,4vw,48px)}
.cf-challenge-hero-4 .c4-spread.no-aside{grid-template-columns:minmax(0,1fr)}
.cf-challenge-hero-4 .c4-aside{display:flex;flex-direction:column;gap:32px;min-width:0}
.cf-challenge-hero-4 .c4-main{display:flex;flex-direction:column;gap:32px;min-width:0}
.cf-challenge-hero-4 .c4-photo{display:block;width:100%;height:auto;aspect-ratio:4/5;object-fit:cover;object-position:50% 24%;border-radius:12px;background:color-mix(in oklch,var(--ink) 6%,var(--surface))}
.cf-challenge-hero-4 .c4-cap{margin-top:12px;font-size:.9375rem;font-weight:500;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-challenge-hero-4 .c4-cap strong{font-weight:700;color:var(--ink)}
.cf-challenge-hero-4 .c4-pull p{font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-.025em);font-size:clamp(1.875rem,2.6vw,2.375rem);line-height:1.1;color:var(--ink);text-wrap:balance}
.cf-challenge-hero-4 .c4-qm{color:var(--accent)}
.cf-challenge-hero-4 .c4-by{margin-top:16px;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--muted)}
.cf-challenge-hero-4 .c4-deck{display:grid;gap:12px;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;color:var(--ink)}
.cf-challenge-hero-4 .c4-deck p{text-wrap:pretty}
.cf-challenge-hero-4 .c4-deck strong{font-weight:800}
.cf-challenge-hero-4 .c4-days-h{font-family:var(--font-display);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-.01em;color:var(--ink);text-wrap:balance}
.cf-challenge-hero-4 .c4-daycols{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 32px;margin-top:16px}
.cf-challenge-hero-4 .c4-daylist{list-style:none;margin:0;padding:0}
.cf-challenge-hero-4 .c4-day{display:grid;grid-template-columns:2.25rem minmax(0,1fr);gap:12px;align-items:baseline;padding:12px 0;border-top:1px solid var(--c4-hair)}
.cf-challenge-hero-4 .c4-dnum{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1;color:var(--accent);font-variant-numeric:lining-nums tabular-nums}
.cf-challenge-hero-4 .c4-dtitle{font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.4;font-weight:600;color:var(--ink);text-wrap:pretty}
.cf-challenge-hero-4 .c4-join{margin-top:auto;display:grid;grid-template-columns:minmax(0,1fr);gap:16px}
.cf-challenge-hero-4 .c4-clock{min-width:0;padding:clamp(16px,2vw,20px) clamp(16px,2vw,24px);border-radius:12px;background:color-mix(in oklch,var(--ink) 4%,var(--surface))}
.cf-challenge-hero-4 .c4-clock-label{font-size:.875rem;font-weight:800;line-height:1.2;letter-spacing:.08em;text-transform:uppercase;color:var(--muted)}
.cf-challenge-hero-4 .c4-clock-date{margin-top:4px;font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--ink);text-wrap:pretty}
.cf-challenge-hero-4 .c4-units{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin-top:12px}
.cf-challenge-hero-4 .c4-unit{display:grid;gap:6px;min-width:0}
.cf-challenge-hero-4 .c4-num{display:block;font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.05;letter-spacing:-.03em;font-variant-numeric:lining-nums tabular-nums;color:var(--ink)}
.cf-challenge-hero-4 .c4-num.is-tick{animation:c4-tick .32s cubic-bezier(.2,.7,.2,1) both}
.cf-challenge-hero-4 .c4-unitname{font-size:.875rem;font-weight:800;line-height:1.2;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);white-space:nowrap}
.cf-challenge-hero-4 .c4-started{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;color:var(--ink);text-wrap:balance}
.cf-challenge-hero-4 .c4-card{background:var(--card);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--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(--c4-shadow) l c h / .22),0 12px 24px -8px oklch(from var(--c4-shadow) l c h / .32)));padding:clamp(20px,3vw,32px);min-width:0}
.cf-challenge-hero-4 .c4-card-h{font-family:var(--font-display);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;letter-spacing:-.01em;color:var(--ink);text-wrap:balance}
.cf-challenge-hero-4 .c4-form{display:grid;gap:16px;margin-top:16px}
.cf-challenge-hero-4 .c4-field{display:grid;gap:8px}
.cf-challenge-hero-4 .c4-label{font-size:1rem;font-weight:700;line-height:1.2;color:var(--label-ink,var(--ink))}
.cf-challenge-hero-4 .c4-input{width:100%;height:56px;padding:0 16px;margin:0;background:var(--field);color:var(--field-ink);border:1px solid var(--field-border,color-mix(in oklch,var(--ink) 22%,transparent));border-radius:var(--field-radius,var(--radius,12px));font-family:var(--font-body);font-size:1.0625rem;font-weight:500;box-shadow:inset 0 1px 2px oklch(from var(--c4-shadow) l c h / .08);transition:border-color .16s ease,box-shadow .16s ease}
.cf-challenge-hero-4 .c4-input::placeholder{color:color-mix(in oklch,var(--field-ink) 65%,var(--field));opacity:1}
.cf-challenge-hero-4 .c4-input:hover:not(:disabled){border-color:color-mix(in oklch,var(--ink) 40%,transparent)}
.cf-challenge-hero-4 .c4-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-4 .c4-input.is-invalid{border-color:var(--danger);box-shadow:0 0 0 3px oklch(from var(--danger) l c h / .18)}
.cf-challenge-hero-4 .c4-input.is-invalid:focus{box-shadow:0 0 0 3px oklch(from var(--danger) l c h / .32)}
.cf-challenge-hero-4 .c4-input:disabled{cursor:not-allowed;background:color-mix(in oklch,var(--field-ink) 6%,var(--field))}
.cf-challenge-hero-4 .c4-err{font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--danger);text-wrap:pretty}
.cf-challenge-hero-4 .c4-formerr{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}
.cf-challenge-hero-4 .c4-err svg,.cf-challenge-hero-4 .c4-formerr svg,.cf-challenge-hero-4 .c4-privacy svg{display:inline-block;vertical-align:-.15em;margin-inline-end:.4em}
.cf-challenge-hero-4 .c4-btn{--c4-bg:var(--button-bg,var(--cta));--c4-bg2:var(--button-bg-2,var(--cta-2));--c4-dl:0;appearance:none;border:0;margin:4px 0 0;cursor:pointer;width:100%;min-height:64px;padding:12px 24px;display:inline-flex;align-items:center;justify-content:center;gap:10px;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from var(--c4-bg) calc(l + .04 - var(--c4-dl)) c h),oklch(from var(--c4-bg2) calc(l - .02 - var(--c4-dl)) c h));color:var(--button-ink,var(--cta-ink));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;text-wrap:balance;text-shadow:var(--button-text-shadow,none);box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--c4-bg) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--c4-bg) calc(l - .16) c h),0 1px 2px oklch(from var(--c4-shadow) l c h / .3),0 8px 16px -6px oklch(from var(--c4-shadow) l c h / .45));transition:transform .16s ease,box-shadow .16s ease,background .16s ease}
.cf-challenge-hero-4 .c4-btn:hover:not(:disabled),.cf-challenge-hero-4 .c4-btn.is-hover{--c4-dl:.05;transform:translateY(-1px);box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--c4-bg) calc(l + .12) c h / .7),inset 0 -3px 0 oklch(from var(--c4-bg) calc(l - .2) c h),0 1px 2px oklch(from var(--c4-shadow) l c h / .32),0 10px 20px -6px oklch(from var(--c4-shadow) l c h / .52))}
.cf-challenge-hero-4 .c4-btn:active:not(:disabled),.cf-challenge-hero-4 .c4-btn.is-active{--c4-dl:.08;transform:translateY(1px);box-shadow:var(--button-shadow,inset 0 2px 4px oklch(from var(--c4-bg) calc(l - .22) c h / .5),inset 0 -2px 0 oklch(from var(--c4-bg) calc(l - .16) c h),0 1px 1px oklch(from var(--c4-shadow) l c h / .3))}
.cf-challenge-hero-4 .c4-btn:focus-visible{outline:3px solid var(--field-focus,var(--accent));outline-offset:3px}
.cf-challenge-hero-4 .c4-btn.is-loading{cursor:progress}
.cf-challenge-hero-4 .c4-btn:disabled{cursor:not-allowed;transform:none;background:var(--button-2-bg,var(--secondary));color:var(--button-2-ink,var(--secondary-ink));text-shadow:none;box-shadow:none}
.cf-challenge-hero-4 .c4-spin{flex:0 0 auto;animation:c4-spin .8s linear infinite}
.cf-challenge-hero-4 .c4-sub{font-size:.9375rem;font-weight:600;line-height:1.4;color:var(--muted);text-align:center;text-wrap:pretty}
.cf-challenge-hero-4 .c4-privacy{font-size:.9375rem;font-weight:500;line-height:1.4;color:var(--muted);text-align:center;text-wrap:pretty}
.cf-challenge-hero-4 .c4-in{animation:c4-rise .45s cubic-bezier(.2,.7,.2,1) both;animation-delay:var(--d,0s)}
@keyframes c4-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@keyframes c4-tick{from{opacity:.4;transform:translateY(-6px)}to{opacity:1;transform:none}}
@keyframes c4-spin{to{transform:rotate(360deg)}}
@media (max-width:1100px) and (min-width:861px){
.cf-challenge-hero-4 .c4-units{gap:8px}
}
@media (max-width:860px){
.cf-challenge-hero-4 .c4-spread{display:flex;flex-direction:column;gap:32px}
.cf-challenge-hero-4 .c4-aside,.cf-challenge-hero-4 .c4-main{display:contents}
.cf-challenge-hero-4 .c4-deck{order:1}
.cf-challenge-hero-4 .c4-figure{order:2}
.cf-challenge-hero-4 .c4-aside > .c4-clock{order:3;margin-bottom:-16px}
.cf-challenge-hero-4 .c4-join{order:4;margin-top:0}
.cf-challenge-hero-4 .c4-days{order:5}
.cf-challenge-hero-4 .c4-pull{display:none}
.cf-challenge-hero-4 .c4-photo{aspect-ratio:4/3;object-position:50% 22%}
}
@media (max-width:560px){
.cf-challenge-hero-4 .c4-daycols{grid-template-columns:minmax(0,1fr)}
.cf-challenge-hero-4 .c4-mast{flex-direction:column;align-items:flex-start;gap:4px}
}
@media (prefers-reduced-motion:reduce){
.cf-challenge-hero-4 .c4-in,.cf-challenge-hero-4 .c4-num.is-tick,.cf-challenge-hero-4 .c4-spin{animation:none}
.cf-challenge-hero-4 .c4-btn,.cf-challenge-hero-4 .c4-input{transition:none}
.cf-challenge-hero-4 .c4-btn:hover:not(:disabled),.cf-challenge-hero-4 .c4-btn.is-hover,.cf-challenge-hero-4 .c4-btn:active:not(:disabled),.cf-challenge-hero-4 .c4-btn.is-active{transform:none}
}
`
pieces/hero/challenge-hero-4/specimen.tsx 56 lines
import __studioImagec7f9a2c9 from "../assets/6c205649e12bc06d.webp";
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
import { ChallengeHero4, type ChallengeHero4State } from '../challenge-hero-4'
export const states = ['default', 'hover', 'active', 'disabled', 'error']
const registration = defaults.sample.registration
const DAYS = [
{ title: 'Find the story hiding in one true sentence' },
{ title: 'Build a character who wants one thing badly' },
{ title: 'Open in the middle of the trouble' },
{ title: 'Write the scene you keep avoiding' },
{ title: 'Cut 300 words and keep the heartbeat' },
{ title: 'Land an ending that answers the opening' },
{ title: 'Polish your favourite and share it' },
]
const DECK = [
{ lead: 'Twenty minutes a day.', text: 'One prompt lands each morning. You finish one short story before bed.' },
{ lead: 'No blank pages.', text: 'Every day comes with the prompt, a word target and a quick edit pass.' },
]
export default function ChallengeHero4Specimen({ state = 'default' }: { state?: string }) {
return (
<ChallengeHero4
state={state as ChallengeHero4State}
name='7-Day Short Story Sprint'
issue='Free online writing challenge'
headline='Finish seven short stories in seven days'
highlight='seven short stories'
deck={DECK}
portraitImage={slot(
'presenter',
__studioImagec7f9a2c9,
)}
portraitAlt='Maren Holt, host of the 7-Day Short Story Sprint, at her writing desk'
hostLabel='Hosted by'
hostName='Maren Holt'
hostRole='Fiction editor and writing coach'
quote='Twenty honest minutes a day will finish more stories than a free weekend ever will.'
quoteBy='Maren Holt, your sprint host'
daysTitle='Seven days. Seven finished stories.'
days={DAYS}
startsAt='2027-03-01T09:00:00-05:00'
startLabel='Monday, March 1 · 9am ET'
cardTitle='Join the sprint free'
label='Yes! I’m in the Sprint'
sublabel='Free · 20 minutes a day · Online'
privacy={registration.privacy}
error={registration.error}
onSubmit={() => undefined}
/>
)
}
| Name | Type | Details |
|---|---|---|
name OptionalChallengeHero4 |
string |
Default '7-Day Short Story Sprint'
|
issue OptionalChallengeHero4 |
string |
Default 'Free online writing challenge'
|
headline OptionalChallengeHero4 |
string |
Default 'Finish seven short stories in seven days'
|
highlight OptionalChallengeHero4 |
string |
Default 'seven short stories'
|
deck OptionalChallengeHero4 |
ChallengeHero4Lead[] |
Default DEFAULT_DECK
|
portraitImage OptionalChallengeHero4 |
string |
|
portraitAlt OptionalChallengeHero4 |
string |
Default 'Portrait of your challenge host'
|
hostLabel OptionalChallengeHero4 |
string |
Default 'Hosted by'
|
hostName OptionalChallengeHero4 |
string |
|
hostRole OptionalChallengeHero4 |
string |
|
quote OptionalChallengeHero4 |
string |
|
quoteBy OptionalChallengeHero4 |
string |
|
daysTitle OptionalChallengeHero4 |
string |
Default 'Seven days. Seven finished stories.'
|
days OptionalChallengeHero4 |
ChallengeHero4Day[] |
Default DEFAULT_DAYS
|
dayLabel OptionalChallengeHero4 |
string |
Default 'Day {day}'
|
startsAt OptionalChallengeHero4 |
string | number | Date |
|
startLabel OptionalChallengeHero4 |
string |
|
countdownLabel OptionalChallengeHero4 |
string |
Default 'Starts in'
|
units OptionalChallengeHero4 |
ChallengeHero4Units |
Default DEFAULT_UNITS
|
startedLabel OptionalChallengeHero4 |
string |
Default 'Day 1 is open. Join and start today.'
|
timerLabel OptionalChallengeHero4 |
string |
Default 'Starts in {days} days, {hours} hours and {minutes} minutes'
|
cardTitle OptionalChallengeHero4 |
string |
Default 'Join the sprint free'
|
fields OptionalChallengeHero4 |
ChallengeHero4Field[] |
Default DEFAULT_FIELDS
|
label OptionalChallengeHero4 |
string |
Default 'Yes! I’m in the Sprint'
|
loadingLabel OptionalChallengeHero4 |
string |
Default 'Saving your seat…'
|
sublabel OptionalChallengeHero4 |
string |
Default 'Free · 20 minutes a day · Online'
|
privacy OptionalChallengeHero4 |
string |
Default 'We respect your inbox. Unsubscribe anytime.'
|
error OptionalChallengeHero4 |
string |
Default 'We couldn’t complete your registration. Please try again.'
|
emailError OptionalChallengeHero4 |
string |
Default 'Please enter a valid email address.'
|
requiredError OptionalChallengeHero4 |
string |
Default 'Please enter your {label}.'
|
disabled OptionalChallengeHero4 |
boolean |
Default false
|
state OptionalChallengeHero4 |
ChallengeHero4State |
Default 'default'
|
onSubmit OptionalChallengeHero4 |
(values: Record<string, string>) => void | Promise<void> |
|
className OptionalChallengeHero4 |
string |
|
style OptionalChallengeHero4 |
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- 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.
presenter- A photo of the host, coach or founder.
-
6c205649e12bc06d.webp
image/webp · 86 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB