Lesson Page 1
Members lesson page: the whole lesson on one screen. Marking a lesson complete ticks the course map, fills the module ring and offers the next lesson inline, so members keep moving through the course.
Use it in a prompt
Use content/lesson-page 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/lesson-page.tsx. - Import it and pass your copy and images (Props tab):
import { LessonPage } from "@/components/funneldna/content/lesson-page"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/content/lesson-page/component.tsx 731 lines
// layout: spotlight-row
// Members lesson page: the whole lesson on one screen. Marking a lesson complete ticks the course map, fills the module ring and offers the next lesson inline, so members keep moving through the course.
import * as React from 'react';
import { Check, ChevronDown, Circle, Clock, FileDown, Lock, Play } from 'lucide-react';
import { Divider, FX_HOST, Mesh } from '../fx/fx';
export type LessonDownload = {
name: string;
href: string;
/** Supplied file details, for example: PDF · 3 pages */
detail?: string;
};
export type CourseLesson = {
id: string;
title: string;
/** Supplied running time, shown exactly as given */
duration?: string;
/** Drip unlock date as supplied; a lesson with one is locked */
unlockDate?: string;
/** Lead line under the lesson title */
summary?: React.ReactNode;
/** Poster frame for this lesson (falls back to posterImage) */
posterImage?: string;
posterAlt?: string;
/** The lesson video; handed to onPlay, never played here */
videoSrc?: string;
/** Lesson notes, one paragraph per entry */
notes?: React.ReactNode[];
downloads?: LessonDownload[];
};
export type CourseModule = {
id: string;
title: string;
lessons: CourseLesson[];
};
/** Every visible word. Placeholders in braces ({title}, {date}, {duration}, {n}, {total}, {done}) are replaced as text. */
export type LessonPageCopy = {
markComplete: string;
markCompleteNote: string;
completeStatus: string;
undo: string;
undoLabel: string;
doneWord: string;
upNext: string;
upNextDuration: string;
startNext: string;
nextLocked: string;
finished: string;
play: string;
notesHeading: string;
downloadsHeading: string;
previous: string;
next: string;
unlocks: string;
moduleNumber: string;
lessonOf: string;
moduleProgress: string;
courseProgress: string;
showLessons: string;
hideLessons: string;
navLabel: string;
statusDone: string;
statusCurrent: string;
statusLocked: string;
announceDone: string;
announceUndone: string;
emptyCourse: string;
};
export type LessonPageProps = {
courseName?: string;
modules?: CourseModule[];
/** Lesson shown first; defaults to the first lesson */
currentLessonId?: string;
/** Lessons already complete when the page opens */
completedIds?: string[];
/** Course poster frame (scene slot), used when a lesson has none */
posterImage?: string;
posterAlt?: string;
copy?: Partial<LessonPageCopy>;
/** Hold the Mark complete action, e.g. until the video has been watched */
completeDisabled?: boolean;
/** Fires on every tick or untick with the full completed list, so the host can save it */
onComplete?: (lessonId: string, complete: boolean, completedIds: string[]) => void;
onSelectLesson?: (lessonId: string) => void;
onPlay?: (lesson: CourseLesson) => void;
state?: 'default' | 'hover' | 'active' | 'disabled' | 'success';
className?: string;
};
export function LessonPage(props: LessonPageProps) {
const {
courseName = 'Your course',
modules = DEFAULT_MODULES,
currentLessonId,
completedIds = NO_IDS,
posterImage,
posterAlt = '',
copy: copyProp,
completeDisabled = false,
onComplete,
onSelectLesson,
onPlay,
state = 'default',
className,
} = props;
const copy: LessonPageCopy = { ...DEFAULT_COPY, ...copyProp };
const uid = React.useId();
const flat = React.useMemo<FlatLesson[]>(
() => modules.flatMap((module, mi) => module.lessons.map((lesson, li) => ({ lesson, module, mi, li }))),
[modules],
);
const [currentId, setCurrentId] = React.useState<string | undefined>(() => currentLessonId ?? flat[0]?.lesson.id);
React.useEffect(() => {
if (currentLessonId !== undefined) setCurrentId(currentLessonId);
}, [currentLessonId]);
const found = flat.findIndex((f) => f.lesson.id === currentId);
const index = found < 0 ? 0 : found;
const cur: FlatLesson | undefined = flat[index];
const prev: FlatLesson | undefined = index > 0 ? flat[index - 1] : undefined;
const next: FlatLesson | undefined = flat[index + 1];
const [done, setDone] = React.useState<Set<string>>(() => {
const set = new Set(completedIds);
const first = currentLessonId ?? flat[0]?.lesson.id;
if (state === 'success' && first) set.add(first);
return set;
});
const [open, setOpen] = React.useState<Set<string>>(() => new Set(cur ? [cur.module.id] : []));
const [drawerOpen, setDrawerOpen] = React.useState(false);
const [popId, setPopId] = React.useState<string | null>(null);
const [announce, setAnnounce] = React.useState('');
const [focusTo, setFocusTo] = React.useState<'title' | 'mark' | 'undo' | 'next' | null>(null);
const titleRef = React.useRef<HTMLHeadingElement>(null);
const markRef = React.useRef<HTMLButtonElement>(null);
const undoRef = React.useRef<HTMLButtonElement>(null);
const startRef = React.useRef<HTMLButtonElement>(null);
const curModuleId = cur?.module.id;
React.useEffect(() => {
if (!curModuleId) return;
setOpen((o) => (o.has(curModuleId) ? o : new Set(o).add(curModuleId)));
}, [curModuleId]);
React.useEffect(() => {
if (!focusTo) return;
let target: HTMLElement | null = null;
if (focusTo === 'title') target = titleRef.current;
else if (focusTo === 'mark') target = markRef.current;
else if (focusTo === 'undo') target = undoRef.current;
else target = startRef.current ?? undoRef.current;
if (focusTo === 'title') target?.focus();
else target?.focus({ preventScroll: true });
setFocusTo(null);
}, [focusTo]);
if (!cur) {
return (
<section className={cx('cf-lesson-page', className)} style={FX_HOST}>
<style>{CSS}</style>
<Mesh variant='dark' />
<div className='cf-lesson-page__inner cf-lesson-page__inner--empty'>
<p className='cf-lesson-page__empty'>{copy.emptyCourse}</p>
</div>
</section>
);
}
const lesson = cur.lesson;
const lessonLocked = isLocked(lesson);
const isDone = done.has(lesson.id);
const disabled = completeDisabled || state === 'disabled' || lessonLocked;
const forced = state === 'hover' ? ' is-hover' : state === 'active' ? ' is-active' : '';
const poster = lesson.posterImage ?? posterImage;
const showVideo = Boolean(poster || lesson.videoSrc);
const countDone = (m: CourseModule) => m.lessons.filter((l) => done.has(l.id)).length;
const courseDone = flat.filter((f) => done.has(f.lesson.id)).length;
const coursePct = flat.length ? Math.round((courseDone / flat.length) * 100) : 0;
const curModuleDone = countDone(cur.module);
const nextLocked = next ? isLocked(next.lesson) : false;
const setComplete = (value: boolean) => {
const updated = new Set(done);
if (value) updated.add(lesson.id);
else updated.delete(lesson.id);
setDone(updated);
setPopId(value ? lesson.id : null);
setAnnounce(fmt(value ? copy.announceDone : copy.announceUndone, { title: lesson.title }));
setFocusTo(value ? 'next' : 'mark');
onComplete?.(lesson.id, value, Array.from(updated));
};
const selectLesson = (l: CourseLesson) => {
if (isLocked(l)) return;
setCurrentId(l.id);
setDrawerOpen(false);
setPopId(null);
setAnnounce('');
setFocusTo('title');
onSelectLesson?.(l.id);
};
const toggleModule = (id: string) => {
setOpen((o) => {
const n = new Set(o);
if (n.has(id)) n.delete(id);
else n.add(id);
return n;
});
};
const renderRow = (l: CourseLesson) => {
const isCur = l.id === lesson.id;
const lDone = done.has(l.id);
const locked = isLocked(l);
const meta = locked && l.unlockDate ? fmt(copy.unlocks, { date: l.unlockDate }) : l.duration;
const status = lDone ? copy.statusDone : locked ? copy.statusLocked : isCur ? copy.statusCurrent : '';
return (
<li key={l.id}>
<button
type='button'
className={cx('cf-lesson-page__lesson', isCur && 'is-current', locked && 'is-locked')}
aria-current={isCur ? 'step' : undefined}
disabled={locked}
onClick={() => selectLesson(l)}
>
<span className='cf-lesson-page__status' aria-hidden='true'>
{lDone ? (
<span className={cx('cf-lesson-page__badge cf-lesson-page__badge--done', popId === l.id && 'is-pop')}>
<Check size={14} strokeWidth={3} />
</span>
) : locked ? (
<Lock size={18} strokeWidth={2.5} />
) : isCur ? (
<span className='cf-lesson-page__badge cf-lesson-page__badge--current'>
<Play size={12} strokeWidth={2.5} fill='currentColor' />
</span>
) : (
<Circle size={18} strokeWidth={2.5} />
)}
</span>
<span className='cf-lesson-page__lesson-text'>
<span className='cf-lesson-page__lesson-title'>{l.title}</span>
{meta ? <span className='cf-lesson-page__lesson-meta'>{meta}</span> : null}
</span>
{status ? <span className='cf-lesson-page__sr'>, {status}</span> : null}
</button>
</li>
);
};
const renderStep = (item: FlatLesson, dir: 'prev' | 'next') => {
const locked = isLocked(item.lesson);
return (
<button
type='button'
className={cx('cf-lesson-page__step', dir === 'next' && 'cf-lesson-page__step--next')}
disabled={locked}
onClick={() => selectLesson(item.lesson)}
>
<span className='cf-lesson-page__step-label'>
{locked && item.lesson.unlockDate ? (
<>
<Lock className='cf-lesson-page__inline-icon' size={16} strokeWidth={2.5} aria-hidden='true' />
{fmt(copy.unlocks, { date: item.lesson.unlockDate })}
</>
) : dir === 'prev' ? (
copy.previous
) : (
copy.next
)}
</span>
<span className='cf-lesson-page__step-title'>{item.lesson.title}</span>
</button>
);
};
const downloads = lesson.downloads ?? [];
const notes = lesson.notes ?? [];
return (
<section className={cx('cf-lesson-page', className)} style={FX_HOST} aria-labelledby={`${uid}-title`}>
<style>{CSS}</style>
<Mesh variant='dark' />
<div className='cf-lesson-page__inner'>
<nav className='cf-lesson-page__nav' aria-label={copy.navLabel} data-open={drawerOpen ? 'true' : 'false'}>
<button
type='button'
className='cf-lesson-page__drawer'
aria-expanded={drawerOpen}
aria-controls={`${uid}-modules`}
onClick={() => setDrawerOpen((v) => !v)}
>
<Ring done={curModuleDone} total={cur.module.lessons.length} size={40} />
<span className='cf-lesson-page__drawer-text'>
<span className='cf-lesson-page__drawer-title'>
{fmt(copy.moduleNumber, { n: cur.mi + 1 })}: {cur.module.title}
</span>
<span className='cf-lesson-page__drawer-meta'>
{fmt(copy.moduleProgress, { done: curModuleDone, total: cur.module.lessons.length })} · {drawerOpen ? copy.hideLessons : copy.showLessons}
</span>
</span>
<ChevronDown className='cf-lesson-page__chev' size={20} strokeWidth={2.5} aria-hidden='true' />
</button>
<div className='cf-lesson-page__nav-head'>
<p className='cf-lesson-page__course'>{courseName}</p>
<p className='cf-lesson-page__course-progress'>{fmt(copy.courseProgress, { done: courseDone, total: flat.length })}</p>
<span className='cf-lesson-page__bar' aria-hidden='true'>
<span style={{ width: `${coursePct}%` }} />
</span>
</div>
<div className='cf-lesson-page__modules' id={`${uid}-modules`}>
{modules.map((m, mi) => {
const d = countDone(m);
const isOpen = open.has(m.id);
const listId = `${uid}-m${mi}`;
return (
<div className='cf-lesson-page__module' key={m.id}>
<button
type='button'
className='cf-lesson-page__module-btn'
aria-expanded={isOpen}
aria-controls={listId}
onClick={() => toggleModule(m.id)}
>
<Ring done={d} total={m.lessons.length} size={32} />
<span className='cf-lesson-page__module-text'>
<span className='cf-lesson-page__module-title'>{m.title}</span>
<span className='cf-lesson-page__module-meta'>
{fmt(copy.moduleNumber, { n: mi + 1 })} · {fmt(copy.moduleProgress, { done: d, total: m.lessons.length })}
</span>
</span>
<ChevronDown className='cf-lesson-page__chev' size={20} strokeWidth={2.5} aria-hidden='true' />
</button>
<ul className='cf-lesson-page__lessons' id={listId} hidden={!isOpen}>
{m.lessons.map(renderRow)}
</ul>
</div>
);
})}
</div>
</nav>
<div className='cf-lesson-page__main'>
<header className='cf-lesson-page__head'>
<h1 className='cf-lesson-page__title' id={`${uid}-title`} ref={titleRef} tabIndex={-1}>
{lesson.title}
</h1>
{lesson.summary ? <p className='cf-lesson-page__lead'>{lesson.summary}</p> : null}
<ul className='cf-lesson-page__chips'>
<li className='cf-lesson-page__chip'>{fmt(copy.moduleNumber, { n: cur.mi + 1 })}</li>
<li className='cf-lesson-page__chip'>{fmt(copy.lessonOf, { n: cur.li + 1, total: cur.module.lessons.length })}</li>
{lesson.duration ? (
<li className='cf-lesson-page__chip'>
<Clock className='cf-lesson-page__inline-icon' size={16} strokeWidth={2.5} aria-hidden='true' />
{lesson.duration}
</li>
) : null}
</ul>
</header>
<article className='cf-lesson-page__stage'>
{showVideo ? (
<div className='cf-lesson-page__poster'>
{poster ? <img src={poster} alt={lesson.posterAlt ?? posterAlt} width={1280} height={720} /> : null}
<button
type='button'
className='cf-lesson-page__play'
aria-label={fmt(copy.play, { title: lesson.title })}
data-video-src={lesson.videoSrc}
onClick={() => onPlay?.(lesson)}
>
<span className='cf-lesson-page__play-disc'>
<Play size={28} strokeWidth={2.5} fill='currentColor' aria-hidden='true' />
</span>
</button>
</div>
) : null}
<div className='cf-lesson-page__actions'>
{isDone ? (
<>
<p className='cf-lesson-page__complete'>
<span className={cx('cf-lesson-page__badge cf-lesson-page__badge--done', popId === lesson.id && 'is-pop')} aria-hidden='true'>
<Check size={14} strokeWidth={3} />
</span>
{copy.completeStatus}
</p>
<button
type='button'
ref={undoRef}
className='cf-lesson-page__undo'
aria-label={fmt(copy.undoLabel, { title: lesson.title })}
onClick={() => setComplete(false)}
>
{copy.undo}
</button>
</>
) : (
<>
<button
type='button'
ref={markRef}
className={'cf-lesson-page__primary' + forced}
disabled={disabled}
onClick={() => setComplete(true)}
>
<span className='cf-lesson-page__primary-label'>
<Check className='cf-lesson-page__inline-icon' size={20} strokeWidth={2.5} aria-hidden='true' />
{copy.markComplete}
</span>
</button>
<p className='cf-lesson-page__note'>
{lessonLocked && lesson.unlockDate ? fmt(copy.unlocks, { date: lesson.unlockDate }) : copy.markCompleteNote}
</p>
</>
)}
</div>
{isDone ? (
<div className='cf-lesson-page__upnext'>
<div className='cf-lesson-page__upnext-text'>
<p className='cf-lesson-page__done-word'>{copy.doneWord}</p>
{next && !nextLocked ? (
<>
<p className='cf-lesson-page__upnext-line'>{fmt(copy.upNext, { title: next.lesson.title })}</p>
{next.lesson.duration ? (
<p className='cf-lesson-page__upnext-line'>{fmt(copy.upNextDuration, { duration: next.lesson.duration })}</p>
) : null}
</>
) : null}
{next && nextLocked && next.lesson.unlockDate ? (
<p className='cf-lesson-page__upnext-line'>{fmt(copy.nextLocked, { date: next.lesson.unlockDate })}</p>
) : null}
{!next ? <p className='cf-lesson-page__upnext-line'>{copy.finished}</p> : null}
</div>
{next && !nextLocked ? (
<button
type='button'
ref={startRef}
className={'cf-lesson-page__primary' + forced}
onClick={() => selectLesson(next.lesson)}
>
{copy.startNext}
</button>
) : null}
</div>
) : null}
{notes.length ? (
<section className='cf-lesson-page__notes' aria-labelledby={`${uid}-notes`}>
<h2 className='cf-lesson-page__h2' id={`${uid}-notes`}>{copy.notesHeading}</h2>
{notes.map((n, i) => (
<p key={i}>{n}</p>
))}
</section>
) : null}
{downloads.length ? (
<section className='cf-lesson-page__files' aria-labelledby={`${uid}-files`}>
<h2 className='cf-lesson-page__h2' id={`${uid}-files`}>{copy.downloadsHeading}</h2>
<ul className='cf-lesson-page__file-list'>
{downloads.map((f) => (
<li key={f.href + f.name}>
<a className='cf-lesson-page__file' href={f.href} download>
<FileDown className='cf-lesson-page__file-icon' size={20} strokeWidth={2.5} aria-hidden='true' />
<span className='cf-lesson-page__file-text'>
<span className='cf-lesson-page__file-name'>{f.name}</span>
{f.detail ? <span className='cf-lesson-page__file-detail'>{f.detail}</span> : null}
</span>
</a>
</li>
))}
</ul>
</section>
) : null}
{prev || next ? (
<div className='cf-lesson-page__pager'>
{prev ? renderStep(prev, 'prev') : null}
{next ? renderStep(next, 'next') : null}
</div>
) : null}
</article>
<p className='cf-lesson-page__sr' aria-live='polite'>{announce}</p>
</div>
</div>
<div className='cf-lesson-page__edge' aria-hidden='true'>
<Divider shape='angle' tone='surface' height={56} />
</div>
</section>
);
}
export default LessonPage;
type FlatLesson = { lesson: CourseLesson; module: CourseModule; mi: number; li: number };
// private
function Ring({ done, total, size }: { done: number; total: number; size: number }) {
const stroke = size >= 40 ? 5 : 4;
const r = (size - stroke) / 2;
const c = 2 * Math.PI * r;
const pct = total > 0 ? Math.min(1, done / total) : 0;
const mid = size / 2;
return (
<svg
className={cx('cf-lesson-page__ring', pct === 1 && 'is-full')}
width={size}
height={size}
viewBox={`0 0 ${size} ${size}`}
aria-hidden='true'
focusable='false'
>
<circle className='cf-lesson-page__ring-track' cx={mid} cy={mid} r={r} strokeWidth={stroke} fill='none' />
<circle
className='cf-lesson-page__ring-fill'
cx={mid}
cy={mid}
r={r}
strokeWidth={stroke}
fill='none'
strokeLinecap={pct > 0 ? 'round' : 'butt'}
strokeDasharray={c}
strokeDashoffset={c * (1 - pct)}
transform={`rotate(-90 ${mid} ${mid})`}
/>
</svg>
);
}
function isLocked(l: CourseLesson) {
return Boolean(l.unlockDate);
}
function fmt(template: string, vars: Record<string, string | number>) {
return Object.keys(vars).reduce((out, key) => out.split('{' + key + '}').join(String(vars[key])), template);
}
function cx(...parts: Array<string | false | null | undefined>) {
return parts.filter(Boolean).join(' ');
}
const NO_IDS: string[] = [];
const DEFAULT_MODULES: CourseModule[] = [
{
id: 'start',
title: 'Start here',
lessons: [
{ id: 'welcome', title: 'Welcome to the course' },
{ id: 'setup', title: 'Set up for your first session' },
],
},
{
id: 'method',
title: 'The core method',
lessons: [
{ id: 'first', title: 'Your first practice session' },
{ id: 'build', title: 'Build on what you made' },
],
},
];
const DEFAULT_COPY: LessonPageCopy = {
markComplete: 'Mark lesson complete',
markCompleteNote: 'Ticks it off in your course map.',
completeStatus: 'Lesson complete',
undo: 'Undo',
undoLabel: 'Mark {title} as not complete',
doneWord: 'Done.',
upNext: 'Next up: {title}.',
upNextDuration: 'It takes {duration}.',
startNext: 'Start the next lesson',
nextLocked: 'The next lesson opens {date}.',
finished: 'That was the last lesson in the course.',
play: 'Play lesson: {title}',
notesHeading: 'Try this before you move on',
downloadsHeading: 'Keep these files beside you while you work',
previous: 'Previous lesson',
next: 'Next lesson',
unlocks: 'Unlocks {date}',
moduleNumber: 'Module {n}',
lessonOf: 'Lesson {n} of {total}',
moduleProgress: '{done} of {total} done',
courseProgress: '{done} of {total} lessons complete',
showLessons: 'Show all lessons',
hideLessons: 'Hide lessons',
navLabel: 'Course lessons',
statusDone: 'complete',
statusCurrent: 'current lesson',
statusLocked: 'locked',
announceDone: '{title} marked complete.',
announceUndone: '{title} marked not complete.',
emptyCourse: 'Lessons appear here as soon as they are added.',
};
const CSS = `
.cf-lesson-page{--lp-shadow:var(--shadow,oklch(0.22 0.03 260));--lp-hair:oklch(from var(--ink,oklch(0.21 0.034 263)) l c h / .12);--lp-well:color-mix(in oklch,var(--ink,oklch(0.21 0.034 263)) 4%,var(--card,oklch(1 0 0)));--lp-focus:oklch(from var(--field-focus,var(--accent,oklch(0.5 0.17 257))) l c h / .55);position:relative;isolation:isolate;overflow:hidden;box-sizing:border-box;background:var(--band,oklch(0.27 0.067 256));color:var(--band-ink,oklch(1 0 0));font-family:var(--font-body,system-ui,sans-serif);padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) calc(clamp(64px,8.5vw,120px) + 56px)}
.cf-lesson-page *,.cf-lesson-page *::before,.cf-lesson-page *::after{box-sizing:border-box}
.cf-lesson-page__inner{position:relative;z-index:1;max-width:1120px;margin:0 auto;display:grid;grid-template-columns:320px minmax(0,1fr);gap:clamp(32px,4vw,48px);align-items:start}
.cf-lesson-page__inner--empty{display:block}
.cf-lesson-page__empty{margin:0;text-align:center;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;text-wrap:pretty}
.cf-lesson-page__nav{position:sticky;top:24px;max-height:calc(100vh - 48px);overflow:auto;overscroll-behavior:contain;background:var(--card,oklch(1 0 0));color:var(--ink,oklch(0.21 0.034 263));border:1px solid var(--card-border,var(--lp-hair));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-md,0 1px 2px oklch(from var(--lp-shadow) l c h / .22),0 4px 10px -2px oklch(from var(--lp-shadow) l c h / .2)))}
.cf-lesson-page__drawer{display:none}
.cf-lesson-page__nav-head{padding:24px 20px 20px}
.cf-lesson-page__course{margin:0;font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);letter-spacing:-.01em;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;text-wrap:balance}
.cf-lesson-page__course-progress{margin:12px 0 0;font-size:.9375rem;line-height:1.4;font-weight:600;color:var(--muted,oklch(0.45 0.03 258))}
.cf-lesson-page__bar{display:block;height:8px;margin-top:8px;border-radius:999px;overflow:hidden;background:oklch(from var(--ink,oklch(0.21 0.034 263)) l c h / .1)}
.cf-lesson-page__bar>span{display:block;height:100%;border-radius:inherit;background:var(--accent-fill,var(--accent,oklch(0.5 0.17 257)));transition:width .45s cubic-bezier(.2,.7,.2,1)}
.cf-lesson-page__module{border-top:1px solid var(--lp-hair)}
.cf-lesson-page__module-btn{display:grid;grid-template-columns:32px minmax(0,1fr) 20px;align-items:center;gap:12px;width:100%;min-height:64px;padding:12px 20px;border:0;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;transition:background .16s ease}
.cf-lesson-page__module-btn:hover{background:var(--lp-well)}
.cf-lesson-page__module-btn:focus-visible,.cf-lesson-page__lesson:focus-visible,.cf-lesson-page__drawer:focus-visible{outline:3px solid var(--lp-focus);outline-offset:-3px}
.cf-lesson-page__module-text,.cf-lesson-page__lesson-text,.cf-lesson-page__drawer-text,.cf-lesson-page__file-text{display:grid;gap:4px;min-width:0}
.cf-lesson-page__module-title,.cf-lesson-page__drawer-title{font-size:clamp(1.0625rem,1.25vw,1.125rem);font-weight:800;line-height:1.25;text-wrap:balance}
.cf-lesson-page__module-meta,.cf-lesson-page__lesson-meta,.cf-lesson-page__drawer-meta{font-size:.9375rem;line-height:1.35;font-weight:500;color:var(--muted,oklch(0.45 0.03 258));text-wrap:pretty}
.cf-lesson-page__chev{color:var(--muted,oklch(0.45 0.03 258));transition:transform .16s ease}
.cf-lesson-page [aria-expanded='true']>.cf-lesson-page__chev{transform:rotate(180deg)}
.cf-lesson-page__lessons{list-style:none;margin:0;padding:0 8px 12px;display:grid;gap:2px}
.cf-lesson-page__lessons[hidden]{display:none}
.cf-lesson-page__lesson{display:grid;grid-template-columns:24px minmax(0,1fr);gap:12px;align-items:start;width:100%;min-height:48px;padding:10px 12px;border:0;border-radius:10px;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;transition:background .16s ease}
.cf-lesson-page__lesson:hover:not(:disabled){background:var(--lp-well)}
.cf-lesson-page__lesson.is-current,.cf-lesson-page__lesson.is-current:hover:not(:disabled){background:color-mix(in oklch,var(--accent,oklch(0.5 0.17 257)) 10%,var(--card,oklch(1 0 0)))}
.cf-lesson-page__lesson.is-locked{cursor:not-allowed}
.cf-lesson-page__status{display:grid;place-items:center;width:24px;height:22px;color:var(--muted,oklch(0.45 0.03 258))}
.cf-lesson-page__lesson-title{font-size:1rem;line-height:1.3;font-weight:600;text-wrap:pretty}
.cf-lesson-page__lesson.is-current .cf-lesson-page__lesson-title{font-weight:800}
.cf-lesson-page__lesson.is-locked .cf-lesson-page__lesson-title{color:var(--muted,oklch(0.45 0.03 258))}
.cf-lesson-page__badge{display:inline-grid;place-items:center;flex:none;width:22px;height:22px;border-radius:999px}
.cf-lesson-page__badge--done{background:var(--success,oklch(0.5 0.14 150));color:var(--success-ink,#fff)}
.cf-lesson-page__badge--current{background:var(--accent-fill,var(--accent,oklch(0.5 0.17 257)));color:var(--accent-fill-ink,var(--card,oklch(1 0 0)))}
.cf-lesson-page__badge--current svg{margin-left:1px}
.cf-lesson-page__badge.is-pop{animation:cf-lesson-pop .3s cubic-bezier(.2,.7,.2,1) both}
.cf-lesson-page__ring{display:block;flex:none}
.cf-lesson-page__ring-track{stroke:oklch(from var(--ink,oklch(0.21 0.034 263)) l c h / .14)}
.cf-lesson-page__ring-fill{stroke:var(--accent-fill,var(--accent,oklch(0.5 0.17 257)));transition:stroke-dashoffset .45s cubic-bezier(.2,.7,.2,1),stroke .16s ease}
.cf-lesson-page__ring.is-full .cf-lesson-page__ring-fill{stroke:var(--success,oklch(0.5 0.14 150))}
.cf-lesson-page__main{min-width:0}
.cf-lesson-page__head{margin-bottom:clamp(24px,3vw,32px)}
.cf-lesson-page__title{margin:0;font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);font-size:clamp(2.5rem,5.4vw,4.875rem);line-height:1.04;text-wrap:balance;overflow-wrap:break-word;color:var(--band-ink,oklch(1 0 0));outline:none}
.cf-lesson-page__lead{margin:clamp(24px,2.6vw,36px) 0 0;max-width:60ch;font-size:clamp(1.125rem,1.5vw,1.375rem);line-height:1.4;font-weight:500;text-wrap:pretty;color:var(--band-ink,oklch(1 0 0))}
.cf-lesson-page__chips{display:flex;flex-wrap:wrap;gap:8px;margin:24px 0 0;padding:0;list-style:none}
.cf-lesson-page__chip{display:inline-flex;align-items:center;min-height:32px;padding:4px 12px;border-radius:999px;background:oklch(from var(--band-ink,oklch(1 0 0)) l c h / .12);color:var(--band-ink,oklch(1 0 0));font-size:.875rem;line-height:1.2;font-weight:800}
.cf-lesson-page__inline-icon{display:inline-block;vertical-align:-0.15em;margin-inline-end:.4em;flex:none}
.cf-lesson-page__stage{background:var(--card,oklch(1 0 0));color:var(--ink,oklch(0.21 0.034 263));border:1px solid var(--card-border,var(--lp-hair));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(from var(--lp-shadow) l c h / .22),0 12px 24px -8px oklch(from var(--lp-shadow) l c h / .32)));padding:clamp(20px,3vw,32px)}
.cf-lesson-page__poster{position:relative;aspect-ratio:16/9;border-radius:12px;overflow:hidden;background:var(--lp-well)}
.cf-lesson-page__poster img{display:block;width:100%;height:100%;object-fit:cover;object-position:center}
.cf-lesson-page__play{position:absolute;inset:0;display:grid;place-items:center;width:100%;height:100%;padding:0;border:0;background:transparent;cursor:pointer}
.cf-lesson-page__play-disc{display:grid;place-items:center;width:88px;height:88px;border-radius:999px;background:var(--card,oklch(1 0 0));color:var(--ink,oklch(0.21 0.034 263));box-shadow:var(--shadow-lg,0 2px 4px oklch(from var(--lp-shadow) l c h / .22),0 12px 24px -8px oklch(from var(--lp-shadow) l c h / .32));transition:transform .16s ease,box-shadow .16s ease}
.cf-lesson-page__play-disc svg{margin-left:4px}
.cf-lesson-page__play:hover .cf-lesson-page__play-disc{transform:scale(1.05)}
.cf-lesson-page__play:active .cf-lesson-page__play-disc{transform:scale(.97)}
.cf-lesson-page__play:focus-visible{outline:none}
.cf-lesson-page__play:focus-visible .cf-lesson-page__play-disc{outline:3px solid var(--field-focus,var(--accent,oklch(0.5 0.17 257)));outline-offset:4px}
.cf-lesson-page__actions{display:flex;flex-wrap:wrap;align-items:center;gap:16px 24px;margin-top:24px}
.cf-lesson-page__note{flex:1 1 200px;margin:0;font-size:.9375rem;line-height:1.4;font-weight:500;color:var(--muted,oklch(0.45 0.03 258));text-wrap:pretty}
.cf-lesson-page__primary{--lp-bg:var(--button-bg,var(--cta,oklch(0.58 0.21 29)));--lp-bg2:var(--button-bg-2,var(--cta-2,oklch(0.51 0.2 29)));display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:64px;padding:0 28px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from var(--lp-bg) calc(l + .04) c h),oklch(from var(--lp-bg2) calc(l - .02) c h));color:var(--button-ink,var(--cta-ink,oklch(1 0 0)));font-family:var(--button-font,var(--font-display,inherit));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);cursor:pointer;box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--lp-bg) calc(l + .14) c h / .7),inset 0 -3px 0 oklch(from var(--lp-bg) calc(l - .16) c h),0 1px 2px oklch(from var(--lp-shadow) l c h / .3),0 8px 16px -6px oklch(from var(--lp-shadow) l c h / .45));transition:background .16s ease,box-shadow .16s ease,transform .16s ease}
.cf-lesson-page__primary svg{flex:none}
.cf-lesson-page__primary-label{display:block;text-wrap:balance}
.cf-lesson-page__primary-label .cf-lesson-page__inline-icon{vertical-align:-0.18em;margin-inline-end:.35em}
.cf-lesson-page__primary:hover:not(:disabled),.cf-lesson-page__primary.is-hover{background:linear-gradient(oklch(from var(--lp-bg) calc(l - .01) c h),oklch(from var(--lp-bg2) calc(l - .07) c h));box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--lp-bg) calc(l + .1) c h / .7),inset 0 -3px 0 oklch(from var(--lp-bg) calc(l - .2) c h),0 1px 2px oklch(from var(--lp-shadow) l c h / .32),0 10px 20px -6px oklch(from var(--lp-shadow) l c h / .52))}
.cf-lesson-page__primary:active:not(:disabled),.cf-lesson-page__primary.is-active{transform:translateY(1px);background:linear-gradient(oklch(from var(--lp-bg) calc(l - .05) c h),oklch(from var(--lp-bg2) calc(l - .08) c h));box-shadow:inset 0 2px 4px oklch(from var(--lp-bg) calc(l - .22) c h / .55),inset 0 -2px 0 oklch(from var(--lp-bg) calc(l - .16) c h),0 1px 1px oklch(from var(--lp-shadow) l c h / .3)}
.cf-lesson-page__primary:focus-visible{outline:3px solid var(--lp-focus);outline-offset:3px}
.cf-lesson-page__primary:disabled{background:var(--secondary,oklch(0.93 0.015 263));color:var(--secondary-ink,oklch(0.21 0.034 263));text-shadow:none;box-shadow:none;cursor:not-allowed}
.cf-lesson-page__complete{display:inline-flex;align-items:center;gap:12px;min-height:64px;margin:0;padding:0 24px;border-radius:var(--button-radius,var(--radius,12px));background:var(--success-soft,oklch(0.93 0.02 150));color:var(--success,oklch(0.5 0.14 150));font-family:var(--button-font,var(--font-display,inherit));font-weight:var(--button-weight,800);font-size:clamp(1.125rem,1.55vw,1.375rem);line-height:1.15}
.cf-lesson-page__undo{min-height:44px;padding:0 4px;border:0;border-radius:6px;background:transparent;color:var(--muted,oklch(0.45 0.03 258));font:inherit;font-size:.9375rem;font-weight:600;text-decoration:underline;text-underline-offset:.18em;cursor:pointer}
.cf-lesson-page__undo:hover{color:var(--ink,oklch(0.21 0.034 263))}
.cf-lesson-page__undo:focus-visible{outline:3px solid var(--lp-focus);outline-offset:2px}
.cf-lesson-page__upnext{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:16px 24px;margin-top:24px;padding:clamp(20px,3vw,32px);border-radius:12px;border:1px solid oklch(from var(--accent,oklch(0.5 0.17 257)) l c h / .28);background:color-mix(in oklch,var(--accent,oklch(0.5 0.17 257)) 10%,var(--card,oklch(1 0 0)));color:var(--ink,oklch(0.21 0.034 263));animation:cf-lesson-rise .45s cubic-bezier(.2,.7,.2,1) both}
.cf-lesson-page__done-word{margin:0 0 12px;font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);letter-spacing:var(--display-tracking,-0.025em);text-transform:var(--display-case,none);font-size:clamp(2rem,3.6vw,3.25rem);line-height:1.06}
.cf-lesson-page__upnext-line{margin:0;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;font-weight:600;text-wrap:pretty}
.cf-lesson-page__upnext-line+.cf-lesson-page__upnext-line{margin-top:4px}
.cf-lesson-page__h2{margin:0 0 16px;font-family:var(--font-display,inherit);font-weight:var(--display-weight,800);text-transform:var(--display-case,none);letter-spacing:-.01em;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.15;text-wrap:balance}
.cf-lesson-page__notes{margin-top:clamp(32px,4vw,48px)}
.cf-lesson-page__notes p{margin:0 0 12px;max-width:64ch;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.55;text-wrap:pretty}
.cf-lesson-page__notes p:last-child{margin-bottom:0}
.cf-lesson-page__notes strong{font-weight:800}
.cf-lesson-page__files{margin-top:32px}
.cf-lesson-page__file-list{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:12px}
.cf-lesson-page__file{display:grid;grid-template-columns:20px minmax(0,1fr);gap:12px;align-items:start;height:100%;padding:16px;border-radius:10px;background:var(--lp-well);color:var(--ink,oklch(0.21 0.034 263));text-decoration:none;transition:background .16s ease,transform .16s ease}
.cf-lesson-page__file:hover{background:color-mix(in oklch,var(--ink,oklch(0.21 0.034 263)) 8%,var(--card,oklch(1 0 0)));transform:translateY(-1px)}
.cf-lesson-page__file:active{transform:none}
.cf-lesson-page__file:focus-visible{outline:3px solid var(--lp-focus);outline-offset:2px}
.cf-lesson-page__file-icon{color:var(--accent,oklch(0.5 0.17 257));margin-top:1px}
.cf-lesson-page__file-name{font-size:1rem;line-height:1.3;font-weight:700;text-wrap:pretty}
.cf-lesson-page__file-detail{font-size:.9375rem;line-height:1.35;font-weight:500;color:var(--muted,oklch(0.45 0.03 258))}
.cf-lesson-page__pager{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:clamp(32px,4vw,48px)}
.cf-lesson-page__step{display:grid;gap:4px;align-content:center;justify-items:start;min-height:64px;padding:12px 20px;border:1px solid var(--button-2-border,transparent);border-radius:var(--button-radius,var(--radius,12px));background:var(--button-2-bg,var(--secondary,oklch(0.93 0.015 263)));color:var(--button-2-ink,var(--secondary-ink,oklch(0.21 0.034 263)));box-shadow:var(--button-2-shadow,var(--shadow-sm));font:inherit;text-align:left;cursor:pointer;transition:background .16s ease,transform .16s ease}
.cf-lesson-page__step--next{grid-column:2;justify-items:end;text-align:right}
.cf-lesson-page__step:hover:not(:disabled){background:oklch(from var(--button-2-bg,var(--secondary,oklch(0.93 0.015 263))) calc(l - .03) c h)}
.cf-lesson-page__step:active:not(:disabled){transform:translateY(1px)}
.cf-lesson-page__step:focus-visible{outline:3px solid var(--lp-focus);outline-offset:2px}
.cf-lesson-page__step:disabled{cursor:not-allowed;box-shadow:none;background:var(--lp-well);color:var(--ink,oklch(0.21 0.034 263))}
.cf-lesson-page__step-label{font-size:.875rem;line-height:1.2;font-weight:800;text-transform:uppercase;letter-spacing:.08em}
.cf-lesson-page__step-title{font-family:var(--button-font,var(--font-display,inherit));font-size:clamp(1.0625rem,1.25vw,1.125rem);font-weight:800;line-height:1.3;text-wrap:balance}
.cf-lesson-page__edge{position:absolute;left:0;right:0;bottom:0;height:56px;z-index:0;pointer-events:none}
.cf-lesson-page__sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
@keyframes cf-lesson-pop{from{transform:scale(.9)}to{transform:scale(1)}}
@keyframes cf-lesson-rise{from{opacity:.82;transform:translateY(8px)}to{opacity:1;transform:none}}
@media (max-width:1100px){.cf-lesson-page__inner{grid-template-columns:280px minmax(0,1fr)}}
@media (max-width:860px){
.cf-lesson-page__inner{grid-template-columns:minmax(0,1fr);gap:24px}
.cf-lesson-page__nav{position:relative;top:auto;max-height:none;overflow:hidden}
.cf-lesson-page__drawer{display:grid;grid-template-columns:40px minmax(0,1fr) 20px;align-items:center;gap:12px;width:100%;min-height:72px;padding:14px 16px;border:0;background:transparent;color:inherit;font:inherit;text-align:left;cursor:pointer;transition:background .16s ease}
.cf-lesson-page__drawer:hover{background:var(--lp-well)}
.cf-lesson-page__drawer:active{background:color-mix(in oklch,var(--ink,oklch(0.21 0.034 263)) 8%,var(--card,oklch(1 0 0)))}
.cf-lesson-page__nav-head{display:none}
.cf-lesson-page__modules{display:none}
.cf-lesson-page__nav[data-open='true'] .cf-lesson-page__modules{display:block}
}
@media (max-width:560px){
.cf-lesson-page__primary{width:100%;padding:0 20px}
.cf-lesson-page__lead{margin-top:20px}
.cf-lesson-page__complete{flex:1 1 auto}
.cf-lesson-page__upnext{grid-template-columns:minmax(0,1fr)}
.cf-lesson-page__pager{grid-template-columns:minmax(0,1fr)}
.cf-lesson-page__step--next{grid-column:auto;justify-items:start;text-align:left}
.cf-lesson-page__play-disc{width:64px;height:64px}
.cf-lesson-page__file-list{grid-template-columns:minmax(0,1fr)}
}
@media (prefers-reduced-motion:reduce){.cf-lesson-page *,.cf-lesson-page *::before,.cf-lesson-page *::after{animation:none !important;transition:none !important}}
`;
pieces/content/lesson-page/specimen.tsx 96 lines
import __studioImage012a07a9 from "../assets/4d4d46c02f21c5af.webp";
import * as React from 'react';
import { LessonPage, type CourseModule, type LessonPageProps } from '../lesson-page';
import { slot } from '../../slots';
export const states = ['default', 'hover', 'active', 'disabled', 'success'];
const GLAZING_NOTES: React.ReactNode[] = [
'Mix your glaze thinner than feels right, about the colour of weak tea.',
'Wait until the first layer loses its shine before you touch it again.',
'Lay one stroke across the window and leave it alone.',
<strong key='patience'>Patience.</strong>,
'That quiet second layer is where the light lives.',
];
const LIFTING_NOTES: React.ReactNode[] = [
'Keep a clean damp brush and a folded paper towel beside your palette.',
'Lift while the wash is damp, not wet.',
'Press, lift, rinse.',
<strong key='repeat'>Repeat.</strong>,
'Stop as soon as the paper starts to glow through.',
];
const MODULES: CourseModule[] = [
{
id: 'basics',
title: 'Your paints, paper and first wash',
lessons: [
{ id: 'corner', title: 'Setting up a small painting corner', duration: '8 minutes' },
{ id: 'brush', title: 'Loading the brush', duration: '11 minutes' },
{ id: 'flat-wash', title: 'Your first flat wash', duration: '14 minutes' },
],
},
{
id: 'light',
title: 'Light through water',
lessons: [
{ id: 'skies', title: 'Wet-on-wet skies', duration: '12 minutes' },
{
id: 'glazing',
title: 'Glazing a window of light',
duration: '16 minutes',
summary: 'Build a glowing window in three thin layers and keep every edge clean.',
notes: GLAZING_NOTES,
downloads: [
{ name: 'Glazing practice sheet', detail: 'PDF · 3 pages', href: '/members/loft-and-lumen/glazing-practice-sheet.pdf' },
{ name: 'Loft window reference photo', detail: 'JPG · 4.2 MB', href: '/members/loft-and-lumen/loft-window-reference.jpg' },
{ name: 'Warm glaze mixing chart', detail: 'PDF · 1 page', href: '/members/loft-and-lumen/warm-glaze-chart.pdf' },
],
},
{
id: 'lifting',
title: 'Lifting highlights back out',
duration: '10 minutes',
summary: 'Pull light back out of a dry wash with one damp brush and a paper towel.',
notes: LIFTING_NOTES,
downloads: [{ name: 'Highlight lifting drills', detail: 'PDF · 2 pages', href: '/members/loft-and-lumen/lifting-drills.pdf' }],
},
{ id: 'dawn', title: 'Painting dawn over the rooftops', duration: '18 minutes', unlockDate: 'Monday 30 November' },
],
},
{
id: 'golden-hour',
title: 'Your loft at golden hour',
lessons: [
{ id: 'evening-palette', title: 'Mixing a warm evening palette', duration: '13 minutes', unlockDate: 'Monday 7 December' },
{ id: 'loft-window', title: 'The loft window, start to finish', duration: '24 minutes', unlockDate: 'Monday 14 December' },
],
},
];
const COMPLETED = ['corner', 'brush', 'flat-wash', 'skies'];
const COPY: LessonPageProps['copy'] = {
markCompleteNote: 'Ticks it off in your Loft & Lumen course map.',
notesHeading: 'Try this at your desk today',
downloadsHeading: 'Print these and paint along',
finished: 'That was the last lesson. Your loft window is ready to frame.',
};
export default function LessonPageSpecimen({ state = 'default' }: { state?: string }) {
const current = (states.includes(state) ? state : 'default') as LessonPageProps['state'];
return (
<LessonPage
key={state}
state={current}
courseName={'Loft & Lumen: Painting Light in Watercolour'}
modules={MODULES}
currentLessonId='glazing'
completedIds={COMPLETED}
posterImage={slot('scene', __studioImage012a07a9)}
posterAlt='A watercolour of a glowing loft window in progress on a sunlit desk'
copy={COPY}
/>
);
}
| Name | Type | Details |
|---|---|---|
courseName OptionalLessonPage |
string |
|
modules OptionalLessonPage |
CourseModule[] |
|
currentLessonId OptionalLessonPage |
string |
|
completedIds OptionalLessonPage |
string[] |
|
posterImage OptionalLessonPage |
string |
|
posterAlt OptionalLessonPage |
string |
|
copy OptionalLessonPage |
Partial<LessonPageCopy> |
|
completeDisabled OptionalLessonPage |
boolean |
|
onComplete OptionalLessonPage |
(lessonId: string, complete: boolean, completedIds: string[]) => void |
|
onSelectLesson OptionalLessonPage |
(lessonId: string) => void |
|
onPlay OptionalLessonPage |
(lesson: CourseLesson) => void |
|
state OptionalLessonPage |
'default' | 'hover' | 'active' | 'disabled' | 'success' |
|
className OptionalLessonPage |
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.
scene- A wide atmosphere photo behind or beside the copy.
-
4d4d46c02f21c5af.webp
image/webp · 74.3 KB