Course Modules 1
Members-area module overview dealt as a fanned hand of cards: the current module sits on top with its progress and next lesson, locked modules say when they open, and a question-and-answer dock sends the member straight back into their next lesson.
Use it in a prompt
Use content/course-modules 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/content/course-modules.tsx. - Import it and pass your copy and images (Props tab):
import { CourseModules } from "@/components/funneldna/content/course-modules"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/content/course-modules/component.tsx 618 lines
// layout: card-fan
// Members-area module overview dealt as a fanned hand of cards: the current module sits on top with its progress and next lesson, locked modules say when they open, and a question-and-answer dock sends the member straight back into their next lesson.
import * as React from 'react'
import { BookOpen, CalendarDays, Check, Clock, Lock } from 'lucide-react'
export type CourseModuleLesson = {
/** Lesson number inside its module. */
number: number
title: string
/** Short running time, e.g. '12 min'. */
duration?: string
}
export type CourseModule = {
title: string
/** Cover image (slot item-n). */
image?: string
imageAlt?: string
/** Lessons in the module. */
lessons: number
/** Lessons the member has finished. */
done?: number
locked?: boolean
/** Drip date text ('Dec 1'); shown only when supplied. */
unlocksOn?: string
/** Replaces the default unlock note on a locked module without a date. */
lockNote?: string
/** The member's next lesson in this module. */
nextLesson?: CourseModuleLesson
/** Destination of the card's button. */
href?: string
}
export type CourseModulesCopy = {
/** Placeholder {n}. */
moduleLabel: string
/** Placeholders {done}, {total}. */
lessonsDone: string
/** Placeholder {percent}. */
percent: string
overallCaption: string
/** Placeholders {done}, {total}. */
overallLessons: string
statusComplete: string
statusCurrent: string
statusReady: string
statusLocked: string
/** Placeholder {number}. */
upNext: string
/** Placeholder {number}. */
startWith: string
completeNote: string
/** Placeholder {date}. */
opensOn: string
/** Placeholder {prev}. */
unlockAfter: string
unlockLater: string
continueModule: string
reviewModule: string
startModule: string
lockedButton: string
/** The question the resume dock asks. */
question: string
/** The button's answer. Placeholder {number}. */
answer: string
/** Placeholders {module}, {number}. */
resumeMeta: string
pagerLabel: string
/** Placeholders {n}, {title}, {done}, {total}. */
tabLabel: string
lockedTab: string
/** Placeholders {n}, {total}, {title}. */
liveStatus: string
}
export type CourseModulesProps = {
/** Section headline (h2). */
headline?: React.ReactNode
/** Short paragraphs, each opening with a bold lead-in. */
leads?: { lead: React.ReactNode; text: React.ReactNode }[]
modules?: CourseModule[]
copy?: Partial<CourseModulesCopy>
/** Destination of the resume button. */
href?: string
/** Resume button click: the module and lesson the member returns to. */
onAction?: (module: CourseModule, index: number, lesson?: CourseModuleLesson) => void
/** A module card's button click. */
onOpenModule?: (module: CourseModule, index: number) => void
/** Forces the resume button's look. */
state?: 'default' | 'hover' | 'active' | 'disabled'
className?: string
}
type Status = 'complete' | 'current' | 'ready' | 'locked'
const DEFAULT_COPY: CourseModulesCopy = {
moduleLabel: 'Module {n}',
lessonsDone: '{done} of {total} lessons',
percent: '{percent}%',
overallCaption: 'of your course done',
overallLessons: '{done} of {total} lessons finished',
statusComplete: 'Complete',
statusCurrent: 'In progress',
statusReady: 'Ready',
statusLocked: 'Locked',
upNext: 'Up next: Lesson {number}',
startWith: 'Start with Lesson {number}',
completeNote: 'Every lesson done. Review it any time.',
opensOn: 'Opens {date}',
unlockAfter: 'Opens when you finish Module {prev}',
unlockLater: 'Opens soon',
continueModule: 'Continue module',
reviewModule: 'Review module',
startModule: 'Start module',
lockedButton: 'Not open yet',
question: 'Ready to pick up where you left off?',
answer: `I'm ready, open Lesson {number}`,
resumeMeta: 'Module {module} · Lesson {number}',
pagerLabel: 'Your modules',
tabLabel: 'Module {n}: {title}, {done} of {total} lessons done',
lockedTab: 'locked',
liveStatus: 'Showing Module {n} of {total}: {title}',
}
const DEFAULT_LEADS = [
{ lead: 'Your next lesson is ready.', text: 'Open it and keep your momentum going.' },
{ lead: 'Each module builds on the last.', text: 'Tap a card to see where every module stands.' },
]
const DEFAULT_MODULES: CourseModule[] = [
{ title: 'Plan your funnel on one page', lessons: 5 },
{ title: 'Write page copy that sells', lessons: 7 },
{ title: 'Check every step before launch', lessons: 6, locked: true },
]
export function CourseModules(props: CourseModulesProps) {
const {
headline = 'Pick up right where you left off',
leads = DEFAULT_LEADS,
modules = DEFAULT_MODULES,
copy: copyProp,
href,
onAction,
onOpenModule,
state = 'default',
className,
} = props
const copy: CourseModulesCopy = { ...DEFAULT_COPY, ...copyProp }
const uid = React.useId()
const titleId = uid + '-title'
const questionId = uid + '-question'
const n = modules.length
const statuses = modules.map(statusOf)
const currentIdx = findCurrent(statuses)
const [active, setActive] = React.useState(() => Math.max(currentIdx, 0))
const shown = n ? Math.min(Math.max(active, 0), n - 1) : 0
const pointerX = React.useRef<number | null>(null)
const swiped = React.useRef(false)
const tabRefs = React.useRef<(HTMLButtonElement | null)[]>([])
const total = modules.reduce((sum, m) => sum + Math.max(m.lessons, 0), 0)
const finished = modules.reduce((sum, m) => sum + doneOf(m), 0)
const pct = total ? Math.round((finished / total) * 100) : 0
const resume = currentIdx >= 0 ? modules[currentIdx] : undefined
const resumeNumber = resume ? resume.nextLesson?.number ?? doneOf(resume) + 1 : 1
const step = (to: number) => setActive(Math.min(Math.max(to, 0), Math.max(n - 1, 0)))
const pick = (i: number) => {
if (swiped.current) {
swiped.current = false
return
}
step(i)
}
const onPointerDown = (e: React.PointerEvent) => {
pointerX.current = e.clientX
swiped.current = false
}
const onPointerUp = (e: React.PointerEvent) => {
if (pointerX.current === null) return
const dx = e.clientX - pointerX.current
pointerX.current = null
if (Math.abs(dx) > 40) {
swiped.current = true
step(shown + (dx < 0 ? 1 : -1))
}
}
const onPointerCancel = () => {
pointerX.current = null
}
const onPagerKey = (e: React.KeyboardEvent) => {
const targets: Record<string, number> = { ArrowRight: shown + 1, ArrowLeft: shown - 1, Home: 0, End: n - 1 }
if (!(e.key in targets)) return
e.preventDefault()
const next = Math.min(Math.max(targets[e.key], 0), n - 1)
setActive(next)
tabRefs.current[next]?.focus()
}
const forced = state === 'hover' ? ' is-hover' : state === 'active' ? ' is-press' : ''
const disabled = state === 'disabled'
const answer = fill(copy.answer, { number: resumeNumber })
const handleResume = () => {
if (resume) onAction?.(resume, currentIdx, resume.nextLesson)
}
const resumeButton =
href && !disabled ? (
<a className={'cm-btn' + forced} href={href} onClick={handleResume}>
{answer}
</a>
) : (
<button type='button' className={'cm-btn' + forced} disabled={disabled} onClick={handleResume}>
{answer}
</button>
)
const cardButton = (m: CourseModule, i: number, status: Status, on: boolean) => {
const label =
status === 'locked'
? copy.lockedButton
: status === 'complete'
? copy.reviewModule
: status === 'current'
? copy.continueModule
: copy.startModule
const tab = on ? 0 : -1
const open = (e: React.MouseEvent) => {
if (swiped.current) {
e.preventDefault()
swiped.current = false
return
}
onOpenModule?.(m, i)
}
if (status === 'locked') {
return (
<button type='button' className='cm-btn2' disabled tabIndex={tab}>
{label}
</button>
)
}
if (m.href) {
return (
<a className='cm-btn2' href={m.href} tabIndex={tab} onClick={open}>
{label}
</a>
)
}
return (
<button type='button' className='cm-btn2' tabIndex={tab} onClick={open}>
{label}
</button>
)
}
return (
<section className={['cf-course-modules', className].filter(Boolean).join(' ')} aria-labelledby={titleId}>
<style>{CSS}</style>
<div className='cm-wrap'>
<div className='cm-head'>
<div className='cm-intro'>
<h2 id={titleId} className='cm-title'>
{headline}
</h2>
{leads.length > 0 && (
<div className='cm-leads'>
{leads.map((l, i) => (
<p key={i}>
<strong>{l.lead}</strong> {l.text}
</p>
))}
</div>
)}
{total > 0 && (
<div className='cm-overall'>
<p className='cm-num-row'>
<span className='cm-num'>{fill(copy.percent, { percent: pct })}</span>
<span className='cm-num-cap'>{copy.overallCaption}</span>
</p>
<div className='cm-meter' aria-hidden='true'>
<span style={{ width: pct + '%' }} />
</div>
<p className='cm-overall-note'>{fill(copy.overallLessons, { done: finished, total })}</p>
</div>
)}
</div>
{resume && (
<aside className='cm-dock' aria-labelledby={questionId}>
<h3 id={questionId} className='cm-q'>
{copy.question}
</h3>
<div className={'cm-lesson' + (resume.image ? '' : ' cm-lesson--plain')}>
{resume.image && (
<img className='cm-thumb' src={resume.image} alt='' width={64} height={64} decoding='async' />
)}
<div>
<span className='cm-lesson-k'>
{fill(copy.resumeMeta, { module: currentIdx + 1, number: resumeNumber })}
</span>
<span className='cm-lesson-t'>{resume.nextLesson?.title ?? resume.title}</span>
{resume.nextLesson?.duration && (
<span className='cm-lesson-d'>
<Clock className='cm-ic' size={16} strokeWidth={2.5} aria-hidden='true' />
{resume.nextLesson.duration}
</span>
)}
</div>
</div>
{resumeButton}
</aside>
)}
</div>
{n > 0 && (
<div className='cm-deck'>
<div
className='cm-stage'
onPointerDown={onPointerDown}
onPointerUp={onPointerUp}
onPointerCancel={onPointerCancel}
>
{modules.map((m, i) => {
const status = statuses[i]
const o = i - shown
const a = Math.abs(o)
const sg = Math.sign(o)
const on = o === 0
const done = doneOf(m)
const p = m.lessons > 0 ? Math.round((done / m.lessons) * 100) : 0
const style = {
'--o1': sg * Math.min(a, 1),
'--o2': sg * Math.max(a - 1, 0),
'--a': a,
zIndex: 20 - a,
} as React.CSSProperties
return (
<article
key={i}
className={'cm-card' + (on ? ' is-on' : '')}
data-status={status}
data-depth={Math.min(a, 4)}
style={style}
>
<div className='cm-inner' aria-hidden={on ? undefined : true}>
{m.image && (
<div className='cm-cover'>
<img src={m.image} alt={m.imageAlt ?? ''} draggable={false} decoding='async' />
</div>
)}
<div className='cm-body'>
<div className='cm-row'>
<span className='cm-mod'>{fill(copy.moduleLabel, { n: i + 1 })}</span>
<StatusChip status={status} copy={copy} />
</div>
<h3 className='cm-h3'>{m.title}</h3>
<p className='cm-prog'>
<span>
<BookOpen className='cm-ic' size={16} strokeWidth={2.5} aria-hidden='true' />
{fill(copy.lessonsDone, { done, total: m.lessons })}
</span>
<span className='cm-pct'>{fill(copy.percent, { percent: p })}</span>
</p>
<div className='cm-bar' aria-hidden='true'>
<span style={{ width: p + '%' }} />
</div>
<ModuleNote module={m} index={i} status={status} copy={copy} />
<div className='cm-act'>{cardButton(m, i, status, on)}</div>
</div>
</div>
{!on && (
<button
type='button'
className='cm-pick'
tabIndex={-1}
aria-hidden='true'
onClick={() => pick(i)}
/>
)}
</article>
)
})}
</div>
<ul
className='cm-pager'
aria-label={copy.pagerLabel}
onKeyDown={onPagerKey}
style={{ '--n': n } as React.CSSProperties}
>
{modules.map((m, i) => {
const status = statuses[i]
const done = doneOf(m)
const p = m.lessons > 0 ? Math.round((done / m.lessons) * 100) : 0
const label =
fill(copy.tabLabel, { n: i + 1, title: m.title, done, total: m.lessons }) +
(status === 'locked' ? ', ' + copy.lockedTab : '')
return (
<li key={i}>
<button
type='button'
className='cm-tab'
ref={(el) => {
tabRefs.current[i] = el
}}
aria-label={label}
aria-current={i === shown ? 'true' : undefined}
tabIndex={i === shown ? 0 : -1}
onClick={() => step(i)}
>
<span className='cm-tab-top'>
{fill(copy.moduleLabel, { n: i + 1 })}
{status === 'complete' && <Check size={16} strokeWidth={2.5} aria-hidden='true' />}
{status === 'locked' && <Lock size={16} strokeWidth={2.5} aria-hidden='true' />}
</span>
<span className='cm-tab-title'>{m.title}</span>
<span className='cm-tab-bar' aria-hidden='true'>
<span style={{ width: p + '%' }} />
</span>
</button>
</li>
)
})}
</ul>
<p className='cm-sr' aria-live='polite'>
{fill(copy.liveStatus, { n: shown + 1, total: n, title: modules[shown].title })}
</p>
</div>
)}
</div>
</section>
)
}
export default CourseModules
function StatusChip({ status, copy }: { status: Status; copy: CourseModulesCopy }) {
const label = {
complete: copy.statusComplete,
current: copy.statusCurrent,
ready: copy.statusReady,
locked: copy.statusLocked,
}[status]
return (
<span className={'cm-chip cm-chip--' + status}>
{status === 'complete' && <Check size={16} strokeWidth={2.5} aria-hidden='true' />}
{status === 'locked' && <Lock size={16} strokeWidth={2.5} aria-hidden='true' />}
{status === 'current' && <span className='cm-dot' aria-hidden='true' />}
{label}
</span>
)
}
function ModuleNote({
module: m,
index,
status,
copy,
}: {
module: CourseModule
index: number
status: Status
copy: CourseModulesCopy
}) {
if (status === 'locked') {
const text = m.unlocksOn
? fill(copy.opensOn, { date: m.unlocksOn })
: m.lockNote ?? (index > 0 ? fill(copy.unlockAfter, { prev: index }) : copy.unlockLater)
return (
<p className='cm-note'>
{m.unlocksOn ? (
<CalendarDays className='cm-ic cm-ic--date' size={18} strokeWidth={2.5} aria-hidden='true' />
) : (
<Lock className='cm-ic cm-ic--lock' size={18} strokeWidth={2.5} aria-hidden='true' />
)}
{text}
</p>
)
}
if (status === 'complete') {
return (
<p className='cm-note'>
<Check className='cm-ic cm-ic--ok' size={18} strokeWidth={2.5} aria-hidden='true' />
{copy.completeNote}
</p>
)
}
const number = m.nextLesson?.number ?? doneOf(m) + 1
return (
<p className='cm-note'>
<span className='cm-note-k'>{fill(status === 'current' ? copy.upNext : copy.startWith, { number })}</span>
{m.nextLesson?.title && <span className='cm-note-t'>{m.nextLesson.title}</span>}
{m.nextLesson?.duration && (
<span className='cm-note-m'>
<Clock className='cm-ic' size={16} strokeWidth={2.5} aria-hidden='true' />
{m.nextLesson.duration}
</span>
)}
</p>
)
}
function doneOf(m: CourseModule) {
return Math.min(Math.max(m.done ?? 0, 0), Math.max(m.lessons, 0))
}
function statusOf(m: CourseModule): Status {
if (m.locked) return 'locked'
const done = doneOf(m)
if (m.lessons > 0 && done >= m.lessons) return 'complete'
return done > 0 ? 'current' : 'ready'
}
function findCurrent(statuses: Status[]) {
const current = statuses.indexOf('current')
return current >= 0 ? current : statuses.indexOf('ready')
}
function fill(template: string, vars: Record<string, string | number>) {
return Object.keys(vars).reduce((s, k) => s.split('{' + k + '}').join(String(vars[k])), template)
}
const CSS = `
.cf-course-modules{--cm-shadow:var(--shadow, oklch(0.22 0.03 256));--cm-band:var(--band, oklch(0.27 0.067 256));--cm-band-ink:var(--band-ink, oklch(1 0 0));--cm-soft:color-mix(in oklab, var(--cm-band-ink) 86%, var(--cm-band));--cm-ink:var(--ink, oklch(0.21 0.034 263));--cm-muted:var(--muted, oklch(0.45 0.03 258));--cm-card:var(--card, oklch(1 0 0));--cm-accent:var(--accent, oklch(0.5 0.17 257));--cm-radius:var(--card-radius, var(--radius, 14px));position:relative;overflow-x:clip;background:var(--cm-band);color:var(--cm-band-ink);font-family:var(--font-body, system-ui, sans-serif);padding:clamp(56px, 8vw, 112px) clamp(16px, 5vw, 48px) clamp(64px, 8.5vw, 120px)}
.cf-course-modules *,.cf-course-modules *::before,.cf-course-modules *::after{box-sizing:border-box}
.cf-course-modules .cm-wrap{max-width:1120px;margin:0 auto}
.cf-course-modules .cm-head{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,420px);gap:clamp(32px, 5vw, 72px);align-items:start}
.cf-course-modules .cm-title{margin:0 0 16px;font-family:var(--font-display, inherit);font-size:clamp(2rem, 3.6vw, 3.25rem);line-height:1.06;font-weight:var(--display-weight, 800);letter-spacing:var(--display-tracking, -0.025em);text-transform:var(--display-case, none);text-wrap:balance;color:var(--cm-band-ink)}
.cf-course-modules .cm-leads p{margin:0;max-width:62ch;font-size:clamp(1.0625rem, 1.25vw, 1.125rem);line-height:1.5;text-wrap:pretty;color:var(--cm-soft)}
.cf-course-modules .cm-leads p+p{margin-top:8px}
.cf-course-modules .cm-leads strong{color:var(--cm-band-ink);font-weight:700}
.cf-course-modules .cm-overall{margin-top:32px;max-width:440px}
.cf-course-modules .cm-num-row{margin:0;display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 12px}
.cf-course-modules .cm-num{font-family:var(--font-display, inherit);font-size:clamp(2.5rem, 4.2vw, 3.75rem);line-height:1;font-weight:var(--display-weight, 800);letter-spacing:-0.03em;font-variant-numeric:tabular-nums;color:var(--cm-band-ink)}
.cf-course-modules .cm-num-cap,.cf-course-modules .cm-overall-note{font-size:0.9375rem;line-height:1.4;font-weight:600;color:var(--cm-soft)}
.cf-course-modules .cm-overall-note{margin:12px 0 0}
.cf-course-modules .cm-meter{margin-top:16px;height:8px;border-radius:999px;background:oklch(from var(--cm-band-ink) l c h / 0.18);overflow:hidden}
.cf-course-modules .cm-meter>span,.cf-course-modules .cm-bar>span,.cf-course-modules .cm-tab-bar>span{display:block;height:100%;border-radius:inherit;transition:width .45s cubic-bezier(.2,.7,.2,1)}
.cf-course-modules .cm-meter>span{background:var(--cm-band-ink)}
.cf-course-modules .cm-dock{background:var(--cm-card);color:var(--cm-ink);border:1px solid var(--card-border, oklch(from var(--cm-ink) l c h / 0.12));border-radius:var(--cm-radius);padding:clamp(20px, 3vw, 32px);box-shadow:var(--card-shadow, var(--shadow-md, 0 1px 2px oklch(from var(--cm-shadow) l c h / 0.3), 0 8px 18px -6px oklch(from var(--cm-shadow) l c h / 0.4)))}
.cf-course-modules .cm-q{margin:0 0 16px;font-family:var(--font-display, inherit);font-size:clamp(1.3125rem, 1.8vw, 1.625rem);line-height:1.15;font-weight:var(--display-weight, 800);letter-spacing:-0.01em;text-wrap:balance;color:var(--cm-ink)}
.cf-course-modules .cm-lesson{display:grid;grid-template-columns:64px minmax(0,1fr);gap:16px;align-items:start;margin-bottom:24px;padding:12px;border-radius:max(0px, calc(var(--cm-radius) - 4px));background:color-mix(in oklch, var(--cm-ink) 4%, var(--cm-card))}
.cf-course-modules .cm-lesson--plain{grid-template-columns:minmax(0,1fr)}
.cf-course-modules .cm-thumb{display:block;width:64px;height:64px;border-radius:max(0px, calc(var(--cm-radius) - 6px));object-fit:cover;object-position:center}
.cf-course-modules .cm-lesson-k{display:block;margin-bottom:4px;font-size:0.875rem;line-height:1.2;font-weight:800;color:var(--cm-muted)}
.cf-course-modules .cm-lesson-t{display:block;font-size:clamp(1.0625rem, 1.25vw, 1.125rem);line-height:1.35;font-weight:700;color:var(--cm-ink);text-wrap:pretty}
.cf-course-modules .cm-lesson-d{display:block;margin-top:4px;font-size:0.9375rem;line-height:1.4;font-weight:500;color:var(--cm-muted)}
.cf-course-modules .cm-btn{--cm-b:var(--button-bg, var(--cta, oklch(0.576 0.209 29.5)));--cm-b2:var(--button-bg-2, var(--cta-2, oklch(0.506 0.206 29.5)));display:flex;width:100%;align-items:center;justify-content:center;min-height:64px;padding:12px 28px;margin:0;border:0;border-radius:var(--button-radius, var(--radius, 12px));font-family:var(--button-font, var(--font-display, inherit));font-size:clamp(1.125rem, 1.55vw, 1.375rem);line-height:1.15;font-weight:var(--button-weight, 800);text-transform:var(--button-case, none);text-align:center;text-wrap:balance;text-decoration:none;color:var(--button-ink, var(--cta-ink, oklch(1 0 0)));text-shadow:var(--button-text-shadow, none);background:linear-gradient(oklch(from var(--cm-b) calc(l + 0.04) c h), oklch(from var(--cm-b2) calc(l - 0.02) c h));box-shadow:var(--button-shadow, inset 0 1px 0 oklch(from var(--cm-b) calc(l + 0.14) c h / 0.7), inset 0 -3px 0 oklch(from var(--cm-b) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--cm-shadow) l c h / 0.35), 0 8px 16px -6px oklch(from var(--cm-shadow) l c h / 0.45));cursor:pointer;transition:transform .16s ease, box-shadow .16s ease, background .16s ease}
.cf-course-modules .cm-btn:hover:not(:disabled),.cf-course-modules .cm-btn.is-hover:not(:disabled){background:linear-gradient(oklch(from var(--cm-b) calc(l - 0.01) c h), oklch(from var(--cm-b2) calc(l - 0.07) c h));transform:translateY(-1px);box-shadow:inset 0 1px 0 oklch(from var(--cm-b) calc(l + 0.12) c h / 0.7), inset 0 -3px 0 oklch(from var(--cm-b) calc(l - 0.2) c h), 0 2px 3px oklch(from var(--cm-shadow) l c h / 0.4), 0 12px 20px -8px oklch(from var(--cm-shadow) l c h / 0.55)}
.cf-course-modules .cm-btn:active:not(:disabled),.cf-course-modules .cm-btn.is-press:not(:disabled){transform:translateY(1px);background:linear-gradient(oklch(from var(--cm-b) calc(l - 0.05) c h), oklch(from var(--cm-b2) calc(l - 0.08) c h));box-shadow:inset 0 2px 4px oklch(from var(--cm-b) calc(l - 0.24) c h / 0.55), inset 0 -2px 0 oklch(from var(--cm-b) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--cm-shadow) l c h / 0.35)}
.cf-course-modules .cm-btn:focus-visible{outline:3px solid var(--field-focus, var(--cm-accent));outline-offset:3px}
.cf-course-modules .cm-btn{padding:12px 20px}
.cf-course-modules .cm-btn:disabled{cursor:not-allowed;transform:none;color:var(--cm-muted);text-shadow:none;background:color-mix(in oklch, var(--cm-ink) 8%, var(--cm-card));box-shadow:none}
.cf-course-modules .cm-btn2{--cm-b2bg:var(--button-2-bg, var(--secondary, color-mix(in oklch, var(--cm-ink) 7%, var(--cm-card))));display:flex;width:100%;align-items:center;justify-content:center;min-height:52px;padding:10px 24px;margin:0;border:1px solid var(--button-2-border, transparent);border-radius:var(--button-radius, var(--radius, 12px));font-family:var(--button-font, var(--font-display, inherit));font-size:clamp(1.0625rem, 1.25vw, 1.125rem);line-height:1.15;font-weight:var(--button-weight, 800);text-transform:var(--button-case, none);text-align:center;text-decoration:none;color:var(--button-2-ink, var(--secondary-ink, var(--cm-ink)));background:var(--cm-b2bg);box-shadow:var(--button-2-shadow, var(--shadow-sm, 0 1px 2px oklch(from var(--cm-shadow) l c h / 0.2)));cursor:pointer;transition:background .16s ease, transform .16s ease}
.cf-course-modules .cm-btn2:hover:not(:disabled){background:oklch(from var(--cm-b2bg) calc(l - 0.04) c h)}
.cf-course-modules .cm-btn2:active:not(:disabled){transform:translateY(1px);background:oklch(from var(--cm-b2bg) calc(l - 0.07) c h)}
.cf-course-modules .cm-btn2:focus-visible{outline:3px solid var(--field-focus, var(--cm-accent));outline-offset:3px}
.cf-course-modules .cm-btn2:disabled{cursor:not-allowed;box-shadow:none;color:var(--cm-muted);background:color-mix(in oklch, var(--cm-ink) 5%, var(--cm-card))}
.cf-course-modules .cm-deck{margin-top:clamp(48px, 6vw, 80px)}
.cf-course-modules .cm-stage{--cm-w:clamp(300px, 24vw, 340px);--s1:clamp(200px, 25vw, 320px);--s2:clamp(24px, 4.5vw, 64px);--t1:5deg;--t2:3deg;--drop:18px;--shrink:0.05;display:grid;justify-items:center;padding:12px 0 56px;touch-action:pan-y;-webkit-user-select:none;user-select:none}
.cf-course-modules .cm-card{grid-area:1/1;position:relative;display:flex;flex-direction:column;width:var(--cm-w);max-width:100%;padding:12px 12px 20px;background:var(--cm-card);color:var(--cm-ink);border:1px solid var(--card-border, oklch(from var(--cm-ink) l c h / 0.12));border-radius:var(--cm-radius);box-shadow:var(--card-shadow, var(--shadow-md, 0 1px 2px oklch(from var(--cm-shadow) l c h / 0.3), 0 8px 18px -6px oklch(from var(--cm-shadow) l c h / 0.4)));transform-origin:50% 100%;transform:translateX(calc(var(--o1) * var(--s1) + var(--o2) * var(--s2))) translateY(calc(var(--a) * var(--drop) + var(--lift, 0px))) rotate(calc(var(--o1) * var(--t1) + var(--o2) * var(--t2))) scale(calc(1 - var(--a) * var(--shrink)));transition:transform .45s cubic-bezier(.2,.7,.2,1), box-shadow .16s ease, opacity .3s ease, visibility .3s ease}
.cf-course-modules .cm-card.is-on{--lift:-8px;background:var(--card, oklch(1 0 0));border-color:oklch(from var(--cm-accent) l c h / 0.55);box-shadow:var(--shadow-lg, 0 2px 4px oklch(from var(--cm-shadow) l c h / 0.3), 0 12px 24px -8px oklch(from var(--cm-shadow) l c h / 0.45))}
@media (hover:hover){.cf-course-modules .cm-card:not(.is-on):hover{--lift:-14px}}
.cf-course-modules .cm-card[data-depth='4']{opacity:0;visibility:hidden}
.cf-course-modules .cm-pick{position:absolute;inset:-1px;z-index:3;margin:0;padding:0;border:0;border-radius:inherit;background:transparent;color:var(--button-2-ink, var(--secondary-ink, var(--cm-ink)));cursor:pointer}
.cf-course-modules .cm-inner{display:flex;flex-direction:column;flex:1}
.cf-course-modules .cm-cover{aspect-ratio:2/1;border-radius:max(0px, calc(var(--cm-radius) - 4px));overflow:hidden;background:color-mix(in oklch, var(--cm-ink) 5%, var(--cm-card))}
.cf-course-modules .cm-cover img{display:block;width:100%;height:100%;object-fit:cover;object-position:center 45%;transition:filter .3s ease}
.cf-course-modules .cm-card[data-status='locked'] .cm-cover img{filter:grayscale(1) contrast(0.92)}
.cf-course-modules .cm-body{display:flex;flex-direction:column;flex:1;padding:16px 8px 0}
.cf-course-modules .cm-row{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;margin-bottom:12px}
.cf-course-modules .cm-mod{font-size:0.875rem;line-height:1.2;font-weight:800;letter-spacing:0.08em;text-transform:uppercase;color:var(--cm-accent)}
.cf-course-modules .cm-chip{display:inline-flex;align-items:center;gap:6px;min-height:28px;padding:4px 12px;border-radius:999px;font-size:0.875rem;line-height:1.2;font-weight:800;white-space:nowrap;background:color-mix(in oklch, var(--cm-ink) 6%, var(--cm-card));color:var(--cm-ink)}
.cf-course-modules .cm-chip--complete{background:var(--success-soft, oklch(0.94 0.035 150));color:var(--success, oklch(0.5 0.14 150))}
.cf-course-modules .cm-chip--current{background:color-mix(in oklch, var(--cm-accent) 12%, var(--cm-card))}
.cf-course-modules .cm-chip--locked{background:var(--secondary, color-mix(in oklch, var(--cm-ink) 8%, var(--cm-card)));color:var(--secondary-ink, var(--cm-ink))}
.cf-course-modules .cm-dot{width:8px;height:8px;border-radius:999px;background:var(--accent-fill, var(--cm-accent))}
.cf-course-modules .cm-h3{margin:0 0 12px;font-family:var(--font-display, inherit);font-size:clamp(1.3125rem, 1.8vw, 1.625rem);line-height:1.15;font-weight:var(--display-weight, 800);letter-spacing:-0.01em;text-wrap:balance;color:var(--cm-ink)}
.cf-course-modules .cm-prog{margin:0;display:flex;justify-content:space-between;align-items:baseline;gap:12px;font-size:0.9375rem;line-height:1.4;font-weight:600;color:var(--cm-muted)}
.cf-course-modules .cm-pct{color:var(--cm-ink);font-weight:800;font-variant-numeric:tabular-nums}
.cf-course-modules .cm-bar{margin-top:8px;height:8px;border-radius:999px;background:oklch(from var(--cm-ink) l c h / 0.1);overflow:hidden}
.cf-course-modules .cm-card[data-status='current'] .cm-bar>span{background:var(--accent-fill, var(--cm-accent))}
.cf-course-modules .cm-card[data-status='complete'] .cm-bar>span{background:var(--success, oklch(0.5 0.14 150))}
.cf-course-modules .cm-note{margin:16px 0 0;padding:12px 14px;border-radius:max(0px, calc(var(--cm-radius) - 4px));background:color-mix(in oklch, var(--cm-ink) 4%, var(--cm-card));font-size:0.9375rem;line-height:1.4;font-weight:600;color:var(--cm-ink);text-wrap:pretty}
.cf-course-modules .cm-note-k{display:block;margin-bottom:4px;font-size:0.875rem;line-height:1.2;font-weight:800;color:var(--cm-muted)}
.cf-course-modules .cm-note-t{display:block;font-size:clamp(1.0625rem, 1.25vw, 1.125rem);line-height:1.35;font-weight:700}
.cf-course-modules .cm-note-m{display:block;margin-top:4px;font-weight:500;color:var(--cm-muted)}
.cf-course-modules .cm-ic{display:inline-block;flex:none;vertical-align:-0.15em;margin-inline-end:0.4em}
.cf-course-modules .cm-ic--ok{color:var(--success, oklch(0.5 0.14 150))}
.cf-course-modules .cm-ic--date{color:var(--cm-accent)}
.cf-course-modules .cm-ic--lock{color:var(--cm-muted)}
.cf-course-modules .cm-act{margin-top:auto;padding-top:16px}
.cf-course-modules .cm-pager{display:grid;grid-template-columns:repeat(var(--n), minmax(0, 1fr));gap:8px;margin:0;padding:0;list-style:none}
.cf-course-modules .cm-pager li{display:flex}
.cf-course-modules .cm-tab{flex:1;display:flex;flex-direction:column;align-items:stretch;gap:8px;margin:0;padding:12px;border:0;border-radius:max(0px, calc(var(--button-radius, var(--cm-radius)) - 4px));background:transparent;color:var(--cm-band-ink);font:inherit;text-align:left;cursor:pointer;transition:background .16s ease}
.cf-course-modules .cm-tab:hover{background:oklch(from var(--cm-band-ink) l c h / 0.08)}
.cf-course-modules .cm-tab[aria-current='true']{background:oklch(from var(--cm-band-ink) l c h / 0.14)}
.cf-course-modules .cm-tab:focus-visible{outline:3px solid var(--cm-band-ink);outline-offset:2px}
.cf-course-modules .cm-tab-top{display:flex;align-items:center;gap:6px;font-size:0.875rem;line-height:1.2;font-weight:800;letter-spacing:0.08em;text-transform:uppercase}
.cf-course-modules .cm-tab-title{font-size:0.9375rem;line-height:1.4;font-weight:600;color:var(--cm-soft);text-wrap:pretty}
.cf-course-modules .cm-tab[aria-current='true'] .cm-tab-title{color:var(--cm-band-ink)}
.cf-course-modules .cm-tab-bar{margin-top:auto;height:4px;border-radius:999px;background:oklch(from var(--cm-band-ink) l c h / 0.2);overflow:hidden}
.cf-course-modules .cm-tab-bar>span{background:var(--cm-band-ink)}
.cf-course-modules .cm-sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
@keyframes cm-rise{from{opacity:0.82;transform:translateY(8px)}to{opacity:1;transform:none}}
.cf-course-modules .cm-intro,.cf-course-modules .cm-dock,.cf-course-modules .cm-deck{animation:cm-rise .45s cubic-bezier(.2,.7,.2,1) both}
.cf-course-modules .cm-dock{animation-delay:.07s}
.cf-course-modules .cm-deck{animation-delay:.14s}
@media (max-width: 1000px){.cf-course-modules .cm-stage{--cm-w:300px;--s1:clamp(200px, 28vw, 270px);--s2:24px;--t1:4deg;--t2:2deg;--drop:14px}}
@media (max-width: 820px){.cf-course-modules .cm-stage{--cm-w:280px;--s1:clamp(150px, 25vw, 200px);--s2:16px;--t1:3deg;--t2:2deg}}
@media (max-width: 860px){.cf-course-modules .cm-head{grid-template-columns:minmax(0,1fr)}.cf-course-modules .cm-dock{max-width:520px}.cf-course-modules .cm-tab-title{display:none}}
@media (max-width: 640px){.cf-course-modules .cm-stage{--cm-w:min(340px, calc(100% - 64px));--s1:22px;--s2:8px;--t1:2deg;--t2:1deg;--drop:10px;--shrink:0.04;padding:8px 0 32px}.cf-course-modules .cm-card{transform-origin:50% 50%}.cf-course-modules .cm-card[data-depth='3']{opacity:0;visibility:hidden}.cf-course-modules .cm-pager{grid-template-columns:repeat(2, minmax(0, 1fr))}.cf-course-modules .cm-tab-title{display:block}.cf-course-modules .cm-overall{margin-top:24px}}
@media (prefers-reduced-motion: reduce){.cf-course-modules .cm-intro,.cf-course-modules .cm-dock,.cf-course-modules .cm-deck{animation:none}.cf-course-modules .cm-card,.cf-course-modules .cm-btn,.cf-course-modules .cm-btn2,.cf-course-modules .cm-tab,.cf-course-modules .cm-meter>span,.cf-course-modules .cm-bar>span,.cf-course-modules .cm-tab-bar>span,.cf-course-modules .cm-cover img{transition:none}.cf-course-modules .cm-card:not(.is-on):hover{--lift:0px}}
`
pieces/content/course-modules/specimen.tsx 61 lines
import __studioImage27b0a6c7 from "../assets/093db94248ea1813.webp";
// Specimen: a member nine lessons into The Funnel Starter Kit, with one module finished, one in progress and two still locked (one by completion, one by drip date).
import * as React from 'react'
import { CourseModules, type CourseModulesProps } from '../course-modules'
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
const sample = defaults.sample
export const states = ['default', 'hover', 'active', 'disabled']
export default function CourseModulesSpecimen({ state = 'default' }: { state?: CourseModulesProps['state'] }) {
const [guide, workbook, checklist] = sample.items
return (
<CourseModules
state={state}
headline={`You're 9 lessons into your first funnel`}
leads={[
{ lead: 'Your next lesson is ready.', text: 'Lesson 5 helps you write the headline your page opens with.' },
{ lead: 'Each module builds on the last.', text: 'Tap a card to see where every module stands.' },
]}
modules={[
{
title: 'Plan your funnel on one page',
image: slot('item-1', guide.image),
imageAlt: guide.imageAlt,
lessons: 5,
done: 5,
},
{
title: 'Write page copy that sells',
image: slot('item-2', workbook.image),
imageAlt: workbook.imageAlt,
lessons: 7,
done: 4,
nextLesson: { number: 5, title: 'Write a headline that earns the click', duration: '12 min' },
},
{
title: 'Check every step before launch',
image: slot('item-3', checklist.image),
imageAlt: checklist.imageAlt,
lessons: 6,
done: 0,
locked: true,
},
{
title: 'Go live and greet your first leads',
image: slot(
'item-4',
__studioImage27b0a6c7
),
imageAlt: 'Laptop on a bright desk showing a finished landing page',
lessons: 6,
done: 0,
locked: true,
unlocksOn: 'Dec 1',
},
]}
/>
)
}
| Name | Type | Details |
|---|---|---|
headline OptionalCourseModules |
React.ReactNode |
|
leads OptionalCourseModules |
{ lead: React.ReactNode; text: React.ReactNode }[] |
|
modules OptionalCourseModules |
CourseModule[] |
|
copy OptionalCourseModules |
Partial<CourseModulesCopy> |
|
href OptionalCourseModules |
string |
|
onAction OptionalCourseModules |
(module: CourseModule, index: number, lesson?: CourseModuleLesson) => void |
|
onOpenModule OptionalCourseModules |
(module: CourseModule, index: number) => void |
|
state OptionalCourseModules |
'default' | 'hover' | 'active' | 'disabled' |
|
className OptionalCourseModules |
string |
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-border--button-2-ink--button-2-shadow- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field-focus- Form inputs: background, ink, border, radius and focus colour.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
item-1- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-2- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-3- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-4- One image per offer item (item-1, item-2…), shown in stacks and lists.
-
093db94248ea1813.webp
image/webp · 70.5 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB