Results Gate 1
Previews the visitor's locked quiz report and collects their name and email to get it.
Use it in a prompt
Use forms/results-gate 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/results-gate.tsx. - Import it and pass your copy and images (Props tab):
import { ResultsGate } from "@/components/funneldna/forms/results-gate"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/forms/results-gate/component.tsx 482 lines
// Previews the visitor's locked quiz report and collects their name and email to get it.
'use client'
import * as React from 'react'
import { AlertCircle, Check, ClipboardCheck, Loader2, Lock, Mail, Sparkles, User } from 'lucide-react'
export type ResultsGateProps = {
/** Templates accept {status} as text; the unlocked/success keys are no longer rendered. */
copy?: Partial<typeof defaultCopy>
/** @deprecated No longer rendered: the builder wires what happens after submit. */
href?: string
/** scene slot; takes precedence over backdrop. */
sceneImage?: string
headline?: string
highlight?: string
lead?: string
steps?: [string, string, string]
reportTitle?: string
resultLabel?: string
reportSections?: string[]
lockTitle?: string
lockNote?: string
previewCaption?: string
backdrop?: string
firstNameLabel?: string
firstNamePlaceholder?: string
emailLabel?: string
emailPlaceholder?: string
label?: string
loadingLabel?: string
reassurance?: string[]
privacy?: string
nameError?: string
emailError?: string
error?: string
/** @deprecated No longer rendered: the builder wires what happens after submit. */
successTitle?: string
/** @deprecated No longer rendered: the builder wires what happens after submit. */
success?: string
/** @deprecated No longer rendered: the builder wires what happens after submit. */
resultsLabel?: string
/** @deprecated No longer rendered: the builder wires what happens after submit. */
resultsHref?: string
headingLevel?: 'h2' | 'h3'
/** "success" is accepted for older callers and renders as default. */
state?: ResultsGateState
/** Receives validated values. A returned promise shows the loading label; a rejection shows the error alert. */
onSubmit?: (values: ResultsGateValues) => void | Promise<void>
className?: string
style?: React.CSSProperties
}
export function ResultsGate({
copy: copyOverrides,
sceneImage,
headline = 'Your results are ready.',
highlight = 'are ready',
lead = 'Your answers are in. Enter your first name and email to unlock your personal results.',
steps = ['Quiz', 'Your details', 'Results'],
reportTitle = 'Your personal results',
resultLabel = 'Your result',
reportSections = ['What your answers point to', 'What it means for you', 'Your next three steps'],
lockTitle = 'Your results are locked',
lockNote = 'Enter your details to open them',
previewCaption = 'Built from your quiz answers. Opens the moment you unlock it.',
backdrop,
firstNameLabel = 'First name',
firstNamePlaceholder = 'Your first name',
emailLabel = 'Email address',
emailPlaceholder = 'you@example.com',
label = 'Show Me My Results',
loadingLabel = 'Unlocking…',
reassurance = ['Free to see', 'Opens on the next screen'],
privacy = 'We respect your inbox. Unsubscribe anytime.',
nameError = 'Enter your first name.',
emailError = 'Enter a valid email so we can unlock your results.',
error = 'We couldn’t unlock your results. Please try again.',
headingLevel = 'h2',
state = 'default',
onSubmit,
className,
style,
}: ResultsGateProps) {
const copy = { ...defaultCopy, ...copyOverrides }
const image = sceneImage === undefined ? backdrop : sceneImage
const uid = React.useId()
const tId = `${uid}-title`
const nId = `${uid}-name`
const eId = `${uid}-email`
const neId = `${uid}-name-err`
const eeId = `${uid}-email-err`
const [status, setStatus] = React.useState<'idle' | 'loading' | 'error'>('idle')
const [values, setValues] = React.useState<ResultsGateValues>({ firstName: '', email: '' })
const [errs, setErrs] = React.useState<{ firstName?: string; email?: string }>({})
const [failed, setFailed] = React.useState(false)
const nameRef = React.useRef<HTMLInputElement>(null)
const emailRef = React.useRef<HTMLInputElement>(null)
const forced = state === 'default' ? undefined : state
const view = forced === 'error' ? 'error' : status
const busy = view === 'loading'
const disabled = forced === 'disabled' || busy
const force = forced === 'hover' || forced === 'active' ? forced : undefined
const name = values.firstName.trim()
const showAlert = forced === 'error' || (view === 'error' && failed)
const nameMsg = errs.firstName
const emailMsg = errs.email ?? (forced === 'error' ? emailError : undefined)
const stepStates: StepState[] = ['done', 'active', 'locked']
const Heading = headingLevel
const [firstSec, ...lockedSecs] = reportSections
const update = (key: keyof ResultsGateValues) => (e: React.ChangeEvent<HTMLInputElement>) => {
const v = e.target.value
setValues((p) => ({ ...p, [key]: v }))
if (errs[key]) setErrs((p) => ({ ...p, [key]: undefined }))
}
const submit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault()
if (disabled) return
const next: { firstName?: string; email?: string } = {}
if (!values.firstName.trim()) next.firstName = nameError
if (!EMAIL.test(values.email.trim())) next.email = emailError
setErrs(next)
setFailed(false)
if (next.firstName || next.email) {
setStatus('error')
const target = next.firstName ? nameRef : emailRef
target.current?.focus()
return
}
setStatus('idle')
const payload = { firstName: values.firstName.trim(), email: values.email.trim() }
void (async () => {
try {
const result = onSubmit?.(payload)
if (!result) return
setStatus('loading')
await result
setStatus('idle')
} catch {
setFailed(true)
setStatus('error')
}
})()
}
const sec = (text: string, i: number) => (
<li key={text + i} className='rg-sec'>
<span className='rg-sec-n' aria-hidden='true'>{i + 1}</span>
<span className='rg-sec-t'>{text}</span>
<span className='rg-sec-lines' aria-hidden='true'>
<span className='rg-blur' style={{ width: '94%' }} />
<span className='rg-blur' style={{ width: `${68 - (i % 3) * 9}%` }} />
</span>
</li>
)
return (
<div className={['cf-results-gate rg', className].filter(Boolean).join(' ')} style={style}>
<style>{CSS}</style>
<div className='rg-card'>
<div className='rg-head'>
<ol className='rg-steps' aria-label={copy.progress}>
{steps.map((step, i) => {
const s = stepStates[i]
return (
<li key={step + i} className='rg-step' data-s={s} aria-current={s === 'active' ? 'step' : undefined}>
<span className='rg-step-bar' aria-hidden='true'><i /></span>
<span className='rg-step-label'>
{s === 'done' && <Check aria-hidden='true' strokeWidth={3} />}
{s === 'locked' && <Lock aria-hidden='true' strokeWidth={2.5} />}
{step}
<span className='rg-sr'>{text(copy.stepNote, { status: copy[s] })}</span>
</span>
</li>
)
})}
</ol>
<Heading id={tId} className='rg-title'>{marked(headline, highlight)}</Heading>
{lead && <p className='rg-lead'>{lead}</p>}
</div>
<figure className='rg-preview'>
{image && <img className='rg-bg' src={image} alt='' aria-hidden='true' loading='lazy' />}
<div className='rg-stage'>
<div className='rg-sheet-back' aria-hidden='true' />
<div className='rg-sheet'>
<div className='rg-sheet-head'>
<span className='rg-sheet-ico' aria-hidden='true'><ClipboardCheck /></span>
<div className='rg-sheet-meta'>
<p className='rg-sheet-title'>{reportTitle}</p>
<p className='rg-sheet-for'>{copy.preparedFor} <strong>{name || copy.you}</strong></p>
</div>
</div>
<div className='rg-result'>
<p className='rg-result-label'>{resultLabel}</p>
<span className='rg-blur rg-blur-xl' aria-hidden='true' />
<span className='rg-blur rg-blur-l' aria-hidden='true' />
</div>
{firstSec && <ol className='rg-secs'>{sec(firstSec, 0)}</ol>}
<div className='rg-zone'>
{lockedSecs.length > 0 && (
<ol className='rg-secs' start={2}>{lockedSecs.map((s, i) => sec(s, i + 1))}</ol>
)}
<span className='rg-veil' aria-hidden='true' />
<div className='rg-lock'>
<span className='rg-lock-ico' aria-hidden='true'><Lock /></span>
<span className='rg-lock-copy'>
<strong>{lockTitle}</strong>
<span>{lockNote}</span>
</span>
</div>
</div>
</div>
</div>
{previewCaption && (
<figcaption className='rg-caption'>
<Sparkles aria-hidden='true' />
<span>{previewCaption}</span>
</figcaption>
)}
</figure>
<div className='rg-form-area'>
<form className='rg-form' noValidate onSubmit={submit} aria-labelledby={tId}>
{showAlert && (
<div className='rg-alert' role='alert'>
<AlertCircle aria-hidden='true' />
<span>{error}</span>
</div>
)}
<div className='rg-field'>
<label className='rg-label' htmlFor={nId}>{firstNameLabel}</label>
<div className='rg-input-wrap'>
<User aria-hidden='true' />
<input
ref={nameRef}
id={nId}
className='rg-input'
name='firstName'
type='text'
autoComplete='given-name'
placeholder={firstNamePlaceholder}
value={values.firstName}
onChange={update('firstName')}
disabled={disabled}
required
aria-invalid={nameMsg ? true : undefined}
aria-describedby={nameMsg ? neId : undefined}
/>
</div>
{nameMsg && <p className='rg-ferr' id={neId}><AlertCircle aria-hidden='true' />{nameMsg}</p>}
</div>
<div className='rg-field'>
<label className='rg-label' htmlFor={eId}>{emailLabel}</label>
<div className='rg-input-wrap'>
<Mail aria-hidden='true' />
<input
ref={emailRef}
id={eId}
className='rg-input'
name='email'
type='email'
inputMode='email'
autoComplete='email'
placeholder={emailPlaceholder}
value={values.email}
onChange={update('email')}
disabled={disabled}
required
aria-invalid={emailMsg ? true : undefined}
aria-describedby={emailMsg ? eeId : undefined}
/>
</div>
{emailMsg && <p className='rg-ferr' id={eeId}><AlertCircle aria-hidden='true' />{emailMsg}</p>}
</div>
<button
type='submit'
className='rg-btn'
disabled={disabled}
data-force={force}
data-disabled={forced === 'disabled' ? '' : undefined}
data-loading={busy ? '' : undefined}
aria-busy={busy || undefined}
>
<span className='rg-btn-text'>{busy ? loadingLabel : label}</span>
{busy ? <span className='rg-btn-ico' aria-hidden='true'><Loader2 className='rg-spin' strokeWidth={2.75} /></span> : null}
</button>
{reassurance.length > 0 && (
<ul className='rg-reassure'>
{reassurance.map((r) => (
<li key={r}><Check aria-hidden='true' strokeWidth={3} />{r}</li>
))}
</ul>
)}
{privacy && <p className='rg-privacy'><Lock aria-hidden='true' />{privacy}</p>}
</form>
<p className='rg-sr' aria-live='polite'>{busy ? copy.unlockingAnnouncement : ''}</p>
</div>
</div>
</div>
)
}
/** "success" is accepted for older callers and renders as default. */
export type ResultsGateState = 'default' | 'hover' | 'active' | 'disabled' | 'error' | 'success'
export type ResultsGateValues = { firstName: string; email: string }
type StepState = 'done' | 'active' | 'locked'
const EMAIL = /^[^ @]+@[^ @]+[.][^ @]{2,}$/
function marked(text: string, phrase?: string) {
if (!phrase) return text
const at = text.indexOf(phrase)
if (at < 0) return text
return (
<>
{text.slice(0, at)}
<span className='rg-mark'>{phrase}</span>
{text.slice(at + phrase.length)}
</>
)
}
// Slotted backdrop photography retains its original colours.
const CSS = `
.cf-results-gate{--rg-cta:var(--cta,#d92d20);--rg-cta2:var(--cta-2,#b42318);--rg-cta-ink:var(--cta-ink,#ffffff);--rg-ink:var(--ink,#101828);--rg-muted:var(--muted,#4a5565);--rg-band:var(--band,#0f2747);--rg-band-ink:var(--band-ink,#ffffff);--rg-accent:var(--accent,#0f5fc2);--rg-accent-fill:var(--accent-fill,var(--accent,#0f5fc2));--rg-card:var(--card,#ffffff);--rg-field:var(--field,#ffffff);--rg-field-ink:var(--field-ink,#101828);--rg-r:var(--radius,18px);width:100%;max-width:1080px;margin-inline:auto;color:var(--rg-ink);font-family:var(--font-body,Arial,Helvetica,sans-serif);line-height:1.5;-webkit-font-smoothing:antialiased;--rg-marker:var(--marker,var(--warning-soft));--rg-ok:var(--success);}
.cf-results-gate *,.cf-results-gate *::before,.cf-results-gate *::after{box-sizing:border-box}
:where(.cf-results-gate) .rg-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:normal;}
:where(.cf-results-gate) .rg-card{position:relative;display:grid;grid-template-columns:minmax(0,46fr) minmax(0,54fr);grid-template-rows:auto 1fr;grid-template-areas:'preview head' 'preview form';border:1px solid oklch(from var(--rg-ink) l c h / 0.16);overflow:hidden;background:var(--card);border-color:var(--card-border,oklch(from var(--ink) l c h / 0.12));border-radius:var(--card-radius,var(--radius));box-shadow:var(--card-shadow,0 2px 4px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.22));}
:where(.cf-results-gate) .rg-head{grid-area:head;min-width:0;padding:44px 52px 0}
:where(.cf-results-gate) .rg-form-area{grid-area:form;min-width:0;padding:28px 52px 44px}
:where(.cf-results-gate) .rg-steps{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;max-width:440px;margin:0 0 30px;padding:0;list-style:none}
:where(.cf-results-gate) .rg-step{min-width:0;--rg-sc:var(--rg-accent-fill)}
:where(.cf-results-gate) .rg-step[data-s=done]{--rg-sc:var(--rg-ok)}
:where(.cf-results-gate) .rg-step-bar{position:relative;display:block;height:6px;border-radius:99px;overflow:hidden;background:oklch(from var(--rg-ink) l c h / 0.11)}
:where(.cf-results-gate) .rg-step-bar>i{position:absolute;inset:0;border-radius:inherit;background:var(--rg-sc);transform-origin:left center;transform:scaleX(0)}
:where(.cf-results-gate) .rg-step[data-s=done] .rg-step-bar>i{transform:scaleX(1)}
:where(.cf-results-gate) .rg-step[data-s=active] .rg-step-bar>i{transform:scaleX(.55);animation:rg-fill .9s cubic-bezier(.2,.8,.2,1) .15s both}
:where(.cf-results-gate) .rg-step-label{display:flex;align-items:center;gap:5px;margin-top:9px;font-size:14px;font-weight:700;line-height:1.2;color:var(--rg-muted);white-space:nowrap}
:where(.cf-results-gate) .rg-step[data-s=done] .rg-step-label{color:var(--rg-ok)}
:where(.cf-results-gate) .rg-step[data-s=active] .rg-step-label{color:var(--rg-accent)}
:where(.cf-results-gate) .rg-step-label svg{width:15px;height:15px;flex:none}
:where(.cf-results-gate) .rg-title{margin:0;font-family:var(--font-display,Arial,sans-serif);font-size:clamp(2.5rem,5vw,4rem);line-height:1.02;color:var(--rg-ink);text-wrap:balance;font-weight:var(--display-weight,900);letter-spacing:var(--display-tracking,-.035em);text-transform:var(--display-case,none);}
:where(.cf-results-gate) .rg-mark{padding:0 .1em;margin:0 -.04em;border-radius:.2em .55em .25em .45em;background:linear-gradient(177deg in oklch,transparent 0 42%,oklch(from var(--rg-marker) l c h / 0.92) 42% 94%,transparent 94%);-webkit-box-decoration-break:clone;box-decoration-break:clone}
:where(.cf-results-gate) .rg-lead{max-width:42ch;margin:20px 0 0;font-size:clamp(1.0625rem,1.5vw,1.25rem);font-weight:500;line-height:1.5;color:var(--rg-muted);text-wrap:pretty}
:where(.cf-results-gate) .rg-preview{grid-area:preview;position:relative;isolation:isolate;display:flex;flex-direction:column;justify-content:center;gap:26px;margin:0;padding:52px 40px;background:var(--rg-band);color:var(--rg-band-ink);overflow:hidden}
:where(.cf-results-gate) .rg-bg{position:absolute;inset:0;z-index:-3;width:100%;height:100%;object-fit:cover;opacity:.2;filter:grayscale(.35) contrast(1.05);animation:rg-drift 1.4s cubic-bezier(.2,.8,.2,1) both;pointer-events:none}
:where(.cf-results-gate) .rg-preview::before,:where(.cf-results-gate) .rg-preview::after{content:'';position:absolute;z-index:-1;left:50%;top:46%;border-radius:50%;border:1px solid oklch(from var(--rg-band-ink) l c h / 0.09);translate:-50% -50%}
:where(.cf-results-gate) .rg-preview::before{width:430px;height:430px}
:where(.cf-results-gate) .rg-preview::after{width:660px;height:660px}
:where(.cf-results-gate) .rg-stage{position:relative;width:100%;max-width:380px;margin-inline:auto}
:where(.cf-results-gate) .rg-sheet-back{position:absolute;inset:14px -10px -12px 14px;border:1px solid oklch(from var(--rg-band-ink) l c h / 0.14);transform:rotate(3.5deg);background:var(--card);border-color:var(--card-border,oklch(from var(--ink) l c h / 0.12));border-radius:var(--card-radius,var(--radius));box-shadow:var(--card-shadow,0 2px 4px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.22));}
:where(.cf-results-gate) .rg-sheet{position:relative;overflow:hidden;padding:22px 22px 24px;color:var(--rg-ink);transform:rotate(-1.2deg);animation:rg-sheet-in .6s cubic-bezier(.2,.8,.2,1) both;background:var(--card);border-color:var(--card-border,oklch(from var(--ink) l c h / 0.12));border-radius:var(--card-radius,var(--radius));box-shadow:var(--card-shadow,0 2px 4px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.22));}
:where(.cf-results-gate) .rg-sheet-head{display:flex;align-items:center;gap:12px;padding-bottom:16px;border-bottom:1px solid oklch(from var(--rg-ink) l c h / 0.1)}
:where(.cf-results-gate) .rg-sheet-ico{display:grid;flex:none;place-items:center;width:44px;height:44px;border-radius:12px;background:color-mix(in oklch,var(--ink) 5%,var(--rg-card));box-shadow:inset 0 0 0 1px oklch(from var(--rg-accent) l c h / 0.2);color:var(--rg-accent)}
:where(.cf-results-gate) .rg-sheet-ico svg{width:22px;height:22px}
:where(.cf-results-gate) .rg-sheet-meta{min-width:0}
:where(.cf-results-gate) .rg-sheet-title{margin:0;font-family:var(--font-display,Arial,sans-serif);font-size:18px;line-height:1.2;color:var(--rg-ink);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,normal);text-transform:var(--display-case,none);}
:where(.cf-results-gate) .rg-sheet-for{margin:3px 0 0;overflow:hidden;font-size:14px;font-weight:500;color:var(--rg-muted);text-overflow:ellipsis;white-space:nowrap}
:where(.cf-results-gate) .rg-sheet-for strong{font-weight:700;color:var(--rg-ink)}
:where(.cf-results-gate) .rg-result{margin-top:16px;padding:14px 14px 16px;border:1px solid oklch(from var(--rg-accent) l c h / 0.18);background:color-mix(in oklch,var(--ink) 3%,var(--card));border-color:oklch(from var(--ink) l c h / 0.08);border-radius:var(--card-radius,var(--radius));box-shadow:none;}
:where(.cf-results-gate) .rg-result-label{margin:0 0 10px;font-size:14px;font-weight:700;color:var(--rg-accent)}
:where(.cf-results-gate) .rg-blur{display:block;height:8px;border-radius:99px;background:oklch(from var(--rg-ink) l c h / 0.18);filter:blur(3px);animation:rg-pulse 1.6s ease-in-out 3 alternate}
:where(.cf-results-gate) .rg-blur-xl{width:78%;height:22px;background:oklch(from var(--rg-accent-fill) l c h / 0.45);filter:blur(5px)}
:where(.cf-results-gate) .rg-blur-l{width:92%;height:10px;margin-top:10px}
:where(.cf-results-gate) .rg-secs{display:grid;gap:14px;margin:16px 0 0;padding:0;list-style:none}
:where(.cf-results-gate) .rg-sec{display:grid;grid-template-columns:28px minmax(0,1fr);align-items:start;gap:4px 12px;transition:filter .5s ease,opacity .5s ease}
:where(.cf-results-gate) .rg-sec-n{grid-row:span 2;display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:var(--rg-band);color:var(--rg-band-ink);font-size:14px;font-weight:800}
:where(.cf-results-gate) .rg-sec-t{font-size:15px;font-weight:700;line-height:1.3;color:var(--rg-ink);text-wrap:pretty}
:where(.cf-results-gate) .rg-sec-lines{display:grid;gap:7px;padding-top:4px}
:where(.cf-results-gate) .rg-zone{position:relative;min-height:128px;margin-top:14px}
:where(.cf-results-gate) .rg-zone .rg-secs{margin:0}
:where(.cf-results-gate) .rg-zone .rg-sec{filter:blur(2.5px);opacity:.7}
:where(.cf-results-gate) .rg-veil{position:absolute;inset:-10px -22px -24px;background:linear-gradient(180deg in oklch,oklch(from var(--rg-card) l c h / 0.25) 0%,oklch(from var(--rg-card) l c h / 0.78) 45%,oklch(from var(--rg-card) l c h / 0.88) 100%);transition:opacity .5s ease;pointer-events:none}
:where(.cf-results-gate) .rg-lock{position:absolute;left:50%;top:50%;z-index:2;display:flex;align-items:center;gap:12px;width:max-content;max-width:100%;padding:12px 20px 12px 12px;color:var(--rg-ink);border:1px solid oklch(from var(--rg-ink) l c h / 0.12);transform:translate(-50%,-50%);background:color-mix(in oklch,var(--ink) 4%,var(--card));border-color:oklch(from var(--ink) l c h / 0.08);border-radius:var(--card-radius,var(--radius));box-shadow:none;}
:where(.cf-results-gate) .rg-lock-ico{display:grid;flex:none;place-items:center;width:42px;height:42px;border-radius:50%;background:var(--rg-band);color:var(--rg-band-ink);box-shadow:0 0 0 5px oklch(from var(--ink) l c h / 0.14);animation:rg-wiggle .9s ease-in-out .6s 1 both}
:where(.cf-results-gate) .rg-lock-ico svg{width:20px;height:20px}
:where(.cf-results-gate) .rg-lock-copy{display:grid;min-width:0;line-height:1.25}
:where(.cf-results-gate) .rg-lock-copy strong{font-size:16px;font-weight:800;color:var(--rg-ink);text-wrap:balance}
:where(.cf-results-gate) .rg-lock-copy span{margin-top:2px;font-size:14px;font-weight:500;color:var(--rg-muted);text-wrap:pretty}
:where(.cf-results-gate) .rg-caption{display:block;max-width:380px;margin:0 auto;font-size:15px;font-weight:600;line-height:1.45;text-align:center;color:var(--rg-band-ink);text-wrap:pretty}
:where(.cf-results-gate) .rg-caption svg{width:18px;height:18px;display:inline-block;vertical-align:-0.15em;margin-inline-end:.4em;color:var(--rg-marker)}
:where(.cf-results-gate) .rg-form{display:grid;gap:18px}
:where(.cf-results-gate) .rg-field{display:grid;gap:8px}
:where(.cf-results-gate) .rg-label{font-size:16px;font-weight:800;line-height:1.25;color:var(--label-ink,var(--ink));}
:where(.cf-results-gate) .rg-input-wrap{position:relative}
:where(.cf-results-gate) .rg-input-wrap>svg{position:absolute;left:18px;top:50%;width:20px;height:20px;color:color-mix(in oklch,var(--rg-field-ink) 55%,var(--rg-field));pointer-events:none;translate:0 -50%;transition:color .15s ease}
:where(.cf-results-gate) .rg-input{display:block;width:100%;height:60px;margin:0;padding:0 18px 0 52px;border:2px solid oklch(from var(--field-ink,var(--ink)) l c h / 0.2);background:var(--rg-field);color:var(--rg-field-ink);font:inherit;font-size:18px;font-weight:600;outline:none;appearance:none;box-shadow:inset 0 2px 3px oklch(from var(--card) calc(l - 0.12) c h / 0.35);transition:border-color .15s ease,box-shadow .15s ease;border-color:var(--field-border,oklch(from var(--ink) l c h / 0.22));border-radius:var(--field-radius,var(--radius));}
:where(.cf-results-gate) .rg-input::placeholder{font-weight:500;opacity:1;color:color-mix(in oklch, var(--field-ink) 65%, var(--field));}
:where(.cf-results-gate) .rg-input:hover:not(:disabled){border-color:oklch(from var(--field-ink,var(--ink)) l c h / 0.36)}
:where(.cf-results-gate) .rg-input:focus-visible{border-color:var(--field-focus,var(--accent));box-shadow:0 0 0 3px oklch(from var(--field-focus,var(--accent)) l c h / 0.22);}
:where(.cf-results-gate) .rg-input-wrap:focus-within>svg{;color:var(--field-ink);}
:where(.cf-results-gate) .rg-input[aria-invalid=true]{border-color:var(--danger);box-shadow:0 0 0 4px var(--danger-soft)}
:where(.cf-results-gate) .rg-input:disabled{cursor:not-allowed;background:var(--field);}
:where(.cf-results-gate) .rg-ferr{display:flex;align-items:flex-start;gap:6px;margin:0;font-size:14px;font-weight:600;line-height:1.35;text-wrap:pretty;color:var(--danger);}
:where(.cf-results-gate) .rg-ferr svg{flex:none;width:16px;height:16px;margin-top:1px}
:where(.cf-results-gate) .rg-alert{display:flex;align-items:flex-start;gap:10px;padding:12px 14px;border:1px solid var(--danger);font-size:15px;font-weight:600;line-height:1.4;text-wrap:pretty;animation:rg-shake .4s ease both;background:var(--danger-soft);border-color:var(--card-border,oklch(from var(--ink) l c h / 0.12));border-radius:var(--card-radius,var(--radius));box-shadow:var(--card-shadow,0 2px 4px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.22));color:var(--danger);}
:where(.cf-results-gate) .rg-alert svg{flex:none;width:20px;height:20px}
:where(.cf-results-gate) .rg-btn{position:relative;display:flex;align-items:center;justify-content:center;width:100%;min-height:70px;margin:6px 0 0;padding:14px 72px;letter-spacing:-.01em;text-align:center;text-decoration:none;text-shadow:var(--button-text-shadow, 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.2) c h / 0.75));cursor:pointer;transition:transform .14s ease,box-shadow .14s ease,filter .14s ease;-webkit-tap-highlight-color:transparent;background:linear-gradient(180deg in oklch,var(--button-bg,var(--cta)),var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h)));color:var(--button-ink,var(--cta-ink));border-color:var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h));border-radius:var(--button-radius,var(--radius));font:var(--button-weight,900) clamp(1.1875rem,2.2vw,1.4375rem)/1.15 var(--button-font,var(--font-display));text-transform:var(--button-case,none);box-shadow:var(--button-shadow,inset 0 -2px 0 oklch(from var(--card) calc(l - 0.12) c h / 0.35),0 3px 4px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.22));border:1px solid var(--button-bg-2,oklch(from var(--button-bg,var(--cta)) calc(l - 0.05) c h));}
:where(.cf-results-gate) .rg-btn-text{display:block;text-wrap:balance}
:where(.cf-results-gate) .rg-btn-ico{position:absolute;right:16px;top:50%;display:grid;place-items:center;width:40px;height:40px;border-radius:50%;translate:0 -50%;transition:transform .2s ease;background:transparent;box-shadow:none;}
:where(.cf-results-gate) .rg-btn-ico svg{width:22px;height:22px}
:where(.cf-results-gate) .rg-btn:hover:not(:disabled),:where(.cf-results-gate) .rg-btn[data-force=hover]{transform:translateY(-2px);filter:none;box-shadow:var(--button-shadow,inset 0 -2px 0 oklch(from var(--card) calc(l - 0.12) c h / 0.35),0 3px 4px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.22));}
:where(.cf-results-gate) .rg-btn:active:not(:disabled),:where(.cf-results-gate) .rg-btn[data-force=active]{transform:translateY(3px);filter:none;box-shadow:var(--button-shadow,inset 0 -2px 0 oklch(from var(--card) calc(l - 0.12) c h / 0.35),0 3px 4px oklch(from var(--shadow, oklch(0.22 0.03 260)) l c h / 0.22));}
:where(.cf-results-gate) .rg-btn:focus-visible{outline:3px solid var(--rg-accent);outline-offset:3px}
:where(.cf-results-gate) .rg-btn:disabled{cursor:not-allowed}
:where(.cf-results-gate) .rg-btn[data-loading]{cursor:progress}
:where(.cf-results-gate) .rg-btn[data-disabled]{text-shadow:none;filter:none;transform:none;background:var(--button-2-bg,var(--card));color:var(--button-2-ink,var(--ink));border-color:var(--button-2-border,oklch(from var(--ink) l c h / 0.22));border-radius:var(--button-radius,var(--radius));box-shadow:var(--button-shadow,none);}
:where(.cf-results-gate) .rg-btn[data-disabled] .rg-btn-ico{box-shadow:none;background:transparent;}
:where(.cf-results-gate) .rg-spin{animation:rg-spin .8s linear infinite}
:where(.cf-results-gate) .rg-reassure{display:flex;flex-wrap:wrap;justify-content:center;gap:6px 18px;margin:2px 0 0;padding:0;list-style:none}
:where(.cf-results-gate) .rg-reassure li{display:inline-flex;align-items:center;gap:6px;font-size:14px;font-weight:700;color:var(--rg-ink)}
:where(.cf-results-gate) .rg-reassure svg{width:16px;height:16px;color:var(--rg-ok)}
:where(.cf-results-gate) .rg-privacy{display:block;margin:0;font-size:14px;font-weight:500;line-height:1.45;text-align:center;color:var(--rg-muted);text-wrap:balance}
:where(.cf-results-gate) .rg-privacy svg{display:inline-block;width:15px;height:15px;margin-right:6px;vertical-align:-2px}
@keyframes rg-fill{from{transform:scaleX(.08)}to{transform:scaleX(.55)}}
@keyframes rg-sheet-in{from{opacity:.82;transform:translateY(10px) rotate(-1.2deg)}to{opacity:1;transform:rotate(-1.2deg)}}
@keyframes rg-drift{from{transform:scale(1.07)}to{transform:scale(1)}}
@keyframes rg-pulse{from{opacity:1}to{opacity:.6}}
@keyframes rg-wiggle{0%,100%{transform:rotate(0)}20%{transform:rotate(-12deg)}40%{transform:rotate(10deg)}60%{transform:rotate(-6deg)}80%{transform:rotate(3deg)}}
@keyframes rg-shake{0%,100%{transform:translateX(0)}25%{transform:translateX(-5px)}50%{transform:translateX(4px)}75%{transform:translateX(-2px)}}
@keyframes rg-spin{to{transform:rotate(360deg)}}
@media (max-width:860px){
:where(.cf-results-gate) .rg-card{grid-template-columns:minmax(0,1fr);grid-template-rows:auto;grid-template-areas:'head' 'preview' 'form'}
:where(.cf-results-gate) .rg-head{padding:30px 24px 26px}
:where(.cf-results-gate) .rg-title{text-wrap:balance}
:where(.cf-results-gate) .rg-preview{gap:20px;padding:32px 22px 28px}
:where(.cf-results-gate) .rg-stage{max-width:340px}
:where(.cf-results-gate) .rg-zone .rg-sec:nth-child(n+3){display:none}
:where(.cf-results-gate) .rg-zone{min-height:112px}
:where(.cf-results-gate) .rg-form-area{padding:26px 24px 28px}
}
@media (max-width:420px){
:where(.cf-results-gate) .rg-head{padding:24px 18px 22px}
:where(.cf-results-gate) .rg-steps{margin-bottom:22px}
:where(.cf-results-gate) .rg-preview{padding:28px 18px 24px}
:where(.cf-results-gate) .rg-sheet{padding:18px 18px 20px}
:where(.cf-results-gate) .rg-veil{inset:-10px -18px -20px}
:where(.cf-results-gate) .rg-lock{gap:10px;padding:10px 16px 10px 10px}
:where(.cf-results-gate) .rg-lock-ico{width:36px;height:36px}
:where(.cf-results-gate) .rg-lock-ico svg{width:18px;height:18px}
:where(.cf-results-gate) .rg-form-area{padding:22px 18px 24px}
:where(.cf-results-gate) .rg-btn{min-height:64px;padding:12px 56px;font-size:1.125rem}
:where(.cf-results-gate) .rg-btn-ico{right:12px;width:34px;height:34px}
:where(.cf-results-gate) .rg-btn-ico svg{width:19px;height:19px}
}
@media (prefers-reduced-motion:reduce){
.cf-results-gate *,.cf-results-gate *::before,.cf-results-gate *::after{animation:none!important;transition:none!important}
:where(.cf-results-gate) .rg-btn:hover:not(:disabled),:where(.cf-results-gate) .rg-btn[data-force=hover],:where(.cf-results-gate) .rg-btn:hover .rg-btn-ico,:where(.cf-results-gate) .rg-btn[data-force=hover] .rg-btn-ico{transform:none}
}
`
export default ResultsGate
const defaultCopy = {
"progress": "Your progress",
"done": "complete",
"active": "current step",
"locked": "locked",
"open": "unlocked",
"stepNote": " ({status})",
"preparedFor": "Prepared for",
"you": "you",
"unlockedFor": "Unlocked for {name}",
"unlocked": "Unlocked",
"ready": "Ready to open",
"successNamed": "{title}, {name}!",
"successTitle": "{title}!",
"unlockedEmail": "Unlocked for",
"unlockingAnnouncement": "Unlocking your results",
"unlockedAnnouncement": "Your results are unlocked"
}
function text(template: string, values: Record<string, string | number>) {
return template.replace(/\{(\w+)\}/g, (match, key: string) => String(values[key] ?? match))
}
pieces/forms/results-gate/specimen.tsx 33 lines
import __studioImage82658b54 from "../assets/1531b0149000643e.webp";
import * as React from 'react'
import { slot } from '../../slots'
import ResultsGate, { type ResultsGateState } from '../results-gate'
import defaults from '../../studio-defaults.json'
export const states = ['default', 'hover', 'active', 'disabled', 'error']
export default function ResultsGateSpecimen({ state = 'default' }: { state?: string }) {
const sample = defaults.sample
return (
<div>
<ResultsGate
state={state as ResultsGateState}
headline='Your results are ready.'
highlight='are ready'
lead='Your answers are in. Enter your first name and email to unlock your Funnel Plan and see the first page to build.'
steps={['Quiz', 'Your details', 'Results']}
reportTitle='Your Funnel Plan'
resultLabel='Your funnel type'
reportSections={['The first page to build', 'What to write on it', 'Your three next steps', 'How to launch it faster']}
lockTitle='Your plan is locked'
lockNote='Enter your details to open it'
previewCaption='Built from your quiz answers. Opens the moment you unlock it.'
sceneImage={slot("scene", __studioImage82658b54)}
label='Show Me My Results'
reassurance={['Free to see', 'Opens on the next screen']}
privacy={sample.registration.privacy}
error='We couldn’t unlock your results. Please try again.'
/>
</div>
)
}
| Name | Type | Details |
|---|---|---|
copy OptionalResultsGate |
Partial<typeof defaultCopy> |
|
href OptionalResultsGate |
string |
|
sceneImage OptionalResultsGate |
string |
|
headline OptionalResultsGate |
string |
Default 'Your results are ready.'
|
highlight OptionalResultsGate |
string |
Default 'are ready'
|
lead OptionalResultsGate |
string |
Default 'Your answers are in. Enter your first name and email to unlock your personal results.'
|
steps OptionalResultsGate |
[string, string, string] |
Default ['Quiz', 'Your details', 'Results']
|
reportTitle OptionalResultsGate |
string |
Default 'Your personal results'
|
resultLabel OptionalResultsGate |
string |
Default 'Your result'
|
reportSections OptionalResultsGate |
string[] |
Default ['What your answers point to', 'What it means for you', 'Your next three steps']
|
lockTitle OptionalResultsGate |
string |
Default 'Your results are locked'
|
lockNote OptionalResultsGate |
string |
Default 'Enter your details to open them'
|
previewCaption OptionalResultsGate |
string |
Default 'Built from your quiz answers. Opens the moment you unlock it.'
|
backdrop OptionalResultsGate |
string |
|
firstNameLabel OptionalResultsGate |
string |
Default 'First name'
|
firstNamePlaceholder OptionalResultsGate |
string |
Default 'Your first name'
|
emailLabel OptionalResultsGate |
string |
Default 'Email address'
|
emailPlaceholder OptionalResultsGate |
string |
Default 'you@example.com'
|
label OptionalResultsGate |
string |
Default 'Show Me My Results'
|
loadingLabel OptionalResultsGate |
string |
Default 'Unlocking…'
|
reassurance OptionalResultsGate |
string[] |
Default ['Free to see', 'Opens on the next screen']
|
privacy OptionalResultsGate |
string |
Default 'We respect your inbox. Unsubscribe anytime.'
|
nameError OptionalResultsGate |
string |
Default 'Enter your first name.'
|
emailError OptionalResultsGate |
string |
Default 'Enter a valid email so we can unlock your results.'
|
error OptionalResultsGate |
string |
Default 'We couldn’t unlock your results. Please try again.'
|
successTitle OptionalResultsGate |
string |
|
success OptionalResultsGate |
string |
|
resultsLabel OptionalResultsGate |
string |
|
resultsHref OptionalResultsGate |
string |
|
headingLevel OptionalResultsGate |
'h2' | 'h3' |
Default 'h2'
|
state OptionalResultsGate |
ResultsGateState |
Default 'default'
|
onSubmit OptionalResultsGate |
(values: ResultsGateValues) => void | Promise<void> |
|
className OptionalResultsGate |
string |
|
style OptionalResultsGate |
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- 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.
--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.
-
1531b0149000643e.webp
image/webp · 57.8 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB