All blocks
Course Detail
Interactive course overview page featuring breadcrumb navigation, tabbed Syllabus, Outcomes, Instructor, and Reviews views, a checkable 4-module curriculum accordion synced to live progress bars, and a sticky enrollment rail with a photographic course cover, self-paced vs. cohort planning, and toast feedback.
Built withAccordionAspect RatioAvatarBadgeBreadcrumbButtonCardCheckboxGridHeadingIconProgressRadio CardRating GroupSectionSegment GroupSeparatorSliderStackTabsTagTextToast
BestsellerAdvancedUpdated 2026
Design Systems Architecture with Atomic CSS & Accessibility
Engineer a zero-runtime, multi-brand component library from first principles — compile-time atomic stylesheets, perceptual OKLCH semantic tokens, accessible headless primitives, and automated CI regression gates.
4.9(1,420 reviews) · 9,640 learners
6h 24m4 modules · 14 lessonsEnglish · CaptionsSelf-paced or cohort
Atomic CSS compilationSemantic token layersWAI-ARIA state machinesKeyboard & focus ergonomicsMulti-brand themingAutomated a11y CI gates
Curriculum completion tracker
2 of 14 lessons marked complete — check off lessons below as you go.
14%
- 18 min
- 26 min
- 30 min
- 28 min
- 24 min
- 32 min
- 28 min
Install
1npx stylexblocks add course-detailSource
components/blocks/ui-sdk/course-detail.tsx
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014import * as stylex from "@stylexjs/stylex";import { useCallback, useMemo, useState } from "react";import { Accordion } from "#components/ui/ui-sdk/accordion.tsx";import { AspectRatio } from "#components/ui/ui-sdk/aspect-ratio.tsx";import { Avatar } from "#components/ui/ui-sdk/avatar.tsx";import { Badge } from "#components/ui/ui-sdk/badge.tsx";import { Breadcrumb } from "#components/ui/ui-sdk/breadcrumb.tsx";import { Button } from "#components/ui/ui-sdk/button.tsx";import { Card } from "#components/ui/ui-sdk/card.tsx";import { Checkbox } from "#components/ui/ui-sdk/checkbox.tsx";import { Grid } from "#components/ui/ui-sdk/grid.tsx";import { Heading } from "#components/ui/ui-sdk/heading.tsx";import { Icon } from "#components/ui/ui-sdk/icon.tsx";import { Progress } from "#components/ui/ui-sdk/progress.tsx";import { RadioCard } from "#components/ui/ui-sdk/radio-card.tsx";import { RatingGroup } from "#components/ui/ui-sdk/rating-group.tsx";import { Section } from "#components/ui/ui-sdk/section.tsx";import { SegmentGroup } from "#components/ui/ui-sdk/segment-group.tsx";import { Separator } from "#components/ui/ui-sdk/separator.tsx";import { Slider } from "#components/ui/ui-sdk/slider.tsx";import { HStack, VStack } from "#components/ui/ui-sdk/stack.tsx";import { Tabs } from "#components/ui/ui-sdk/tabs.tsx";import { Tag } from "#components/ui/ui-sdk/tag.tsx";import { Text } from "#components/ui/ui-sdk/text.tsx";import { Toast, Toaster } from "#components/ui/ui-sdk/toast.tsx";import { semanticColors } from "@stylexblocks/ui/semantic-tokens/colors.stylex.ts";import { semanticRadii } from "@stylexblocks/ui/semantic-tokens/radii.stylex.ts";import { semanticShadows } from "@stylexblocks/ui/semantic-tokens/shadows.stylex.ts";import { accentPalette, amberPalette, emeraldPalette, indigoPalette, rosePalette, tealPalette,} from "@stylexblocks/ui/themes/palettes.ts";import { durations } from "@stylexblocks/ui/tokens/durations.stylex.ts";import { fontSizes } from "@stylexblocks/ui/tokens/font-sizes.stylex.ts";import { fontWeights } from "@stylexblocks/ui/tokens/font-weights.stylex.ts";import { fonts } from "@stylexblocks/ui/tokens/fonts.stylex.ts";import { lineHeights } from "@stylexblocks/ui/tokens/line-heights.stylex.ts";import { radii } from "@stylexblocks/ui/tokens/radii.stylex.ts";import { spacing } from "@stylexblocks/ui/tokens/spacing.stylex.ts";import type { StyleOverrideProps } from "#lib/recipe-props.ts";
// ---------------------------------------------------------------------------// Types// ---------------------------------------------------------------------------
export interface CourseLesson { id: string; title: string; duration: string; preview?: boolean;}
export interface CourseModule { id: string; title: string; summary: string; duration: string; lessons: readonly CourseLesson[];}
export interface CourseReview { id: string; author: string; initials: string; role: string; date: string; rating: number; body: string; helpful: number; paletteKey: "indigo" | "emerald" | "amber" | "teal";}
export interface CourseCohort { id: string; label: string; detail: string;}
export interface CourseDetailProps extends StyleOverrideProps { /** Course headline displayed in the page header. */ title?: string; /** Concise value proposition under the headline. */ subtitle?: string; /** Price in USD for one-time enrollment. */ price?: number; /** Original comparison price in USD. */ compareAtPrice?: number; /** Curriculum modules with checkable lessons. */ modules?: readonly CourseModule[]; /** Lesson IDs pre-marked as complete on mount. */ initialCompletedLessonIds?: readonly string[]; /** Called when the learner clicks the primary enroll CTA. */ onEnroll?: (payload: { mode: "self-paced" | "cohort"; paceHours: number; cohortId: string }) => void; /** Called when the learner launches the free lesson preview. */ onPreviewLesson?: (lesson: CourseLesson) => void;}
// ---------------------------------------------------------------------------// Demo data — Design Systems Architecture with Atomic CSS & Accessibility// ---------------------------------------------------------------------------
const COURSE_META = { title: "Design Systems Architecture with Atomic CSS & Accessibility", subtitle: "Engineer a zero-runtime, multi-brand component library from first principles — compile-time atomic stylesheets, perceptual OKLCH semantic tokens, accessible headless primitives, and automated CI regression gates.", level: "Advanced", language: "English · Captions", rating: 4.9, reviewCount: 1420, learnerCount: "9,640", runtime: "6h 24m", price: 119, compareAtPrice: 169, skills: [ "Atomic CSS compilation", "Semantic token layers", "WAI-ARIA state machines", "Keyboard & focus ergonomics", "Multi-brand theming", "Automated a11y CI gates", ],};
const DEFAULT_MODULES: readonly CourseModule[] = [ { id: "atomic-css", title: "Module 1 · Atomic CSS & Compile-Time Architecture", summary: "Deterministic styling, static extraction, and bundle ceilings.", duration: "1h 42m", lessons: [ { id: "l-1", title: "Why atomic CSS plateaus in bundle size at enterprise scale", duration: "18 min", preview: true, }, { id: "l-2", title: "Deterministic cascade resolution and banning CSS shorthands", duration: "26 min", preview: true, }, { id: "l-3", title: "Static build extraction, dead-style elimination, and budgets", duration: "30 min", }, { id: "l-4", title: "Lab: Type-safe recipe composition with explicit style overrides", duration: "28 min", }, ], }, { id: "semantic-tokens", title: "Module 2 · Semantic Tokens & Multi-Brand Theming", summary: "OKLCH perceptual ramps, light-dark(), and subtree palettes.", duration: "1h 24m", lessons: [ { id: "l-5", title: "Separating primitive, semantic, and component token contracts", duration: "24 min", }, { id: "l-6", title: "Perceptual OKLCH color spaces and automatic light-dark() contrast", duration: "32 min", }, { id: "l-7", title: "Scoped palette overrides without React context re-renders", duration: "28 min", }, ], }, { id: "accessible-primitives", title: "Module 3 · Accessible Headless Primitives & ARIA", summary: "Focus management, keyboard matrices, and assistive tech audits.", duration: "1h 58m", lessons: [ { id: "l-8", title: "Roving tabindex, focus trapping, and modal focus restoration", duration: "34 min", }, { id: "l-9", title: "Composite widgets: tabs, accordions, sliders, and radio cards", duration: "30 min", }, { id: "l-10", title: "Live regions, screen reader ergonomics, and reduced motion", duration: "26 min", }, { id: "l-11", title: "Lab: End-to-end VoiceOver and NVDA audit walkthrough", duration: "28 min", }, ], }, { id: "governance-scale", title: "Module 4 · Governance, CI Gates & Capstone Kit", summary: "Automated accessibility assertions, codemods, and release policy.", duration: "1h 20m", lessons: [ { id: "l-12", title: "Automated keyboard contracts and axe-core checks in CI", duration: "26 min", }, { id: "l-13", title: "Versioning token schemas and writing migration codemods", duration: "28 min", }, { id: "l-14", title: "Capstone: Publish a multi-brand accessible UI kit", duration: "26 min", }, ], },];
const OUTCOMES = [ { title: "Zero-runtime atomic stylesheet pipeline", detail: "Configure compile-time style extraction with strict specificity guarantees and predictable bundle ceilings.", }, { title: "WCAG 2.2 AA/AAA contrast by construction", detail: "Author semantic OKLCH token pairs using light-dark() so themes remain legible across light, dark, and high-contrast modes.", }, { title: "Composable headless component contracts", detail: "Build multi-slot primitives with keyboard roving focus, ARIA ownership, and render-prop composition.", }, { title: "Multi-brand subtree theming", detail: "Swap brand palettes and density factors locally with CSS custom property themes and zero React re-renders.", }, { title: "Assistive technology verification workflow", detail: "Run repeatable screen reader checks alongside automated keyboard and axe-core assertions in pull requests.", }, { title: "Safe migration and release governance", detail: "Ship token deprecations and recipe changes across dozens of consuming apps using AST codemods.", },] as const;
const PREREQUISITES = [ "Comfortable writing TypeScript and modern React components (hooks and compound patterns).", "Working familiarity with CSS custom properties, Flexbox, and CSS Grid.", "No prior screen-reader testing or compiler plugin experience required — both are taught from scratch.",] as const;
const INSTRUCTOR = { name: "Dr. Soren Halvorsen", initials: "SH", role: "Principal Design Systems Architect · Nordic Foundry", learners: "24,800", courses: "5", rating: "4.9", bio: "Dr. Soren Halvorsen has spent eleven years designing compile-time CSS architectures and accessible component libraries across web and desktop product suites. After completing his PhD in Human-Computer Interaction at NTNU, he led core UI platform teams supporting over 300 engineers and now advises organizations on multi-brand design system governance.", focusAreas: [ "Compile-time Atomic CSS", "WCAG 2.2 AA/AAA Audits", "Semantic Token Governance", "Headless State Machines", ],};
const RATING_ASPECTS = [ { label: "Architecture depth", score: 4.9 }, { label: "Accessibility rigor", score: 5.0 }, { label: "Hands-on labs", score: 4.8 }, { label: "Instructor clarity", score: 4.9 }, { label: "Token & theming tooling", score: 4.8 }, { label: "Capstone review feedback", score: 4.7 },] as const;
const REVIEWS: readonly CourseReview[] = [ { id: "rev-1", author: "Maren Lindqvist", initials: "ML", role: "Staff Frontend Engineer", date: "Reviewed 1 week ago", rating: 5, body: "The semantic token architecture and OKLCH contrast lessons paid for the course in one afternoon. We cut our product CSS bundle by 68% and fixed three persistent dark-mode contrast bugs immediately.", helpful: 46, paletteKey: "indigo", }, { id: "rev-2", author: "Devon Okafor", initials: "DO", role: "Design Technologist", date: "Reviewed 3 weeks ago", rating: 5, body: "Soren demystifies roving tabindex and composite ARIA patterns better than any spec guide I have read. The VoiceOver lab caught focus-restoration edge cases our team had shipped for years.", helpful: 34, paletteKey: "emerald", }, { id: "rev-3", author: "Kenji Takahashi", initials: "KT", role: "Principal UI Engineer", date: "Reviewed 2 months ago", rating: 5, body: "Every module builds directly toward the capstone library. The codemod and CI gate chapter turned our design system upgrades from a quarterly firefight into an automated PR.", helpful: 29, paletteKey: "teal", }, { id: "rev-4", author: "Camille Laurent", initials: "CL", role: "Accessibility Lead", date: "Reviewed 2 months ago", rating: 4, body: "Refreshingly opinionated and grounded in real browser behavior. I would have loved one extra lab on data-grid virtualization, though the coverage of tabs, accordions, and dialogs is stellar.", helpful: 18, paletteKey: "amber", },];
const FAQS = [ { id: "faq-framework", q: "Are the concepts tied to a single CSS library?", a: "No. While the hands-on labs use compile-time atomic CSS and CSS custom property themes, every token layer, ARIA state machine, and CI testing contract transfers cleanly to any modern React stack.", }, { id: "faq-access", q: "How long do I keep access to the lessons and labs?", a: "Enrollment includes lifetime access to all 14 lessons, downloadable starter repositories, accessibility audit checklists, and every future curriculum update.", }, { id: "faq-cohort", q: "What is the difference between self-paced and live cohort?", a: "Both options include the full video curriculum and capstone rubric. Live cohorts add weekly office hours, architecture critiques with Dr. Halvorsen, and peer PR reviews.", }, { id: "faq-guarantee", q: "Is there a refund policy or team license?", a: "Every seat includes a 30-day no-questions-asked refund guarantee. Team licenses with shared capstone reviews are available directly from your enrollment receipt.", },] as const;
const COHORTS: readonly CourseCohort[] = [ { id: "jan-2027", label: "Cohort of Jan 11", detail: "Live critiques · 9 seats left", }, { id: "feb-2027", label: "Cohort of Feb 8", detail: "Live critiques · 4 seats left", },];
const COURSE_INCLUDES = [ "Lifetime access to 14 lessons & starter labs", "Reviewed multi-brand capstone architecture", "WCAG 2.2 keyboard & screen reader checklists", "Verified certificate of completion",] as const;
// Fixed reference date keeps estimated completion deterministic across SSR and client.const COHORT_REFERENCE_DATE = new Date("2026-12-07T00:00:00Z");const ESTIMATED_STUDY_HOURS = 36;const PACE_MIN = 2;const PACE_MAX = 12;
function formatUsd(amount: number) { return `$${amount.toFixed(0)}`;}
function estimateFinish(hoursPerWeek: number) { const weeks = Math.max(1, Math.ceil(ESTIMATED_STUDY_HOURS / hoursPerWeek)); const target = new Date(COHORT_REFERENCE_DATE); target.setUTCDate(target.getUTCDate() + weeks * 7); const formattedDate = target.toLocaleDateString("en-US", { month: "short", day: "numeric", timeZone: "UTC", }); return `${weeks} ${weeks === 1 ? "week" : "weeks"} · finish around ${formattedDate}`;}
const REVIEW_PALETTES = { indigo: indigoPalette, emerald: emeraldPalette, amber: amberPalette, teal: tealPalette,} as const;
// ---------------------------------------------------------------------------// Crisp inline SVG icons (zero external icon packages)// ---------------------------------------------------------------------------
function ChevronDownIcon() { return ( <Icon size="sm" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" > <path d="M4 6l4 4 4-4" /> </Icon> );}
function ChevronRightIcon() { return ( <Icon size="xs" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" > <path d="M6 4l4 4-4 4" /> </Icon> );}
function ArrowRightIcon() { return ( <Icon size="sm" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" > <path d="M4.5 10h11" /> <path d="M11 5.5 15.5 10 11 14.5" /> </Icon> );}
function PlayIcon() { return ( <Icon size="sm" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.6" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" > <path d="M7 5.2 15.2 10 7 14.8V5.2Z" /> </Icon> );}
function ClockIcon() { return ( <Icon size="sm" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" > <circle cx="10" cy="10" r="7.25" /> <path d="M10 6.2V10l2.6 1.6" /> </Icon> );}
function BookOpenIcon() { return ( <Icon size="sm" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" > <path d="M3 5.2c1.8-.6 4.4-.5 7 .8 2.6-1.3 5.2-1.4 7-.8v9.8c-1.8-.6-4.4-.5-7 .8-2.6-1.3-5.2-1.4-7-.8V5.2Z" /> <path d="M10 6v9.8" /> </Icon> );}
function GlobeIcon() { return ( <Icon size="sm" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" > <circle cx="10" cy="10" r="7.25" /> <path d="M2.8 10h14.4" /> <path d="M10 2.75c2.2 2.1 3.3 4.6 3.3 7.25s-1.1 5.15-3.3 7.25c-2.2-2.1-3.3-4.6-3.3-7.25S7.8 4.85 10 2.75Z" /> </Icon> );}
function UsersIcon() { return ( <Icon size="sm" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" > <circle cx="7.5" cy="7.2" r="2.7" /> <path d="M2.8 15.8c.5-2.4 2.4-3.8 4.7-3.8s4.2 1.4 4.7 3.8" /> <circle cx="13.8" cy="7.8" r="2.1" /> <path d="M13.5 12.2c1.8.2 3.2 1.4 3.7 3.6" /> </Icon> );}
function CheckIcon() { return ( <Icon size="sm" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.75" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" > <path d="M4.5 10.4 8.2 14l7.3-8" /> </Icon> );}
function SparklesIcon() { return ( <Icon size="sm" viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" > <path d="M10 3.2 11.4 7.6 15.8 9l-4.4 1.4L10 14.8l-1.4-4.4L4.2 9l4.4-1.4L10 3.2Z" /> <path d="M15.4 13.4 16 15.2l1.8.6-1.8.6-.6 1.8-.6-1.8-1.8-.6 1.8-.6.6-1.8Z" /> </Icon> );}
function ThumbUpIcon() { return ( <Icon size="xs" viewBox="0 0 16 16" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true" > <path d="M5.2 7.2 7.8 2.5a1.3 1.3 0 0 1 2.4.7v2.6h2.7a1.3 1.3 0 0 1 1.3 1.6l-.8 4.4a1.6 1.6 0 0 1-1.6 1.3H5.2V7.2Z" /> <path d="M2.2 7.2h3v5.9h-3a.6.6 0 0 1-.6-.6V7.8a.6.6 0 0 1 .6-.6Z" /> </Icon> );}
// ---------------------------------------------------------------------------// Styles// ---------------------------------------------------------------------------
const styles = stylex.create({ root: { backgroundColor: semanticColors.bg, color: semanticColors.fg, fontFamily: fonts.body, minHeight: "100%", paddingBlock: { default: spacing._8, "@media (max-width: 640px)": spacing._5, }, paddingInline: { default: spacing._6, "@media (max-width: 640px)": spacing._4, }, width: "100%", }, container: { marginInline: "auto", maxWidth: "75rem", width: "100%", }, layoutGrid: { gap: { default: spacing._8, "@media (max-width: 960px)": spacing._6, }, gridTemplateColumns: { default: "minmax(0, 1fr) 23.5rem", "@media (max-width: 960px)": "minmax(0, 1fr)", }, }, railColumn: { position: { default: "sticky", "@media (max-width: 960px)": "static", }, top: spacing._6, }, headingReset: { marginBlock: 0, }, title: { marginBlock: 0, maxWidth: "28ch", textWrap: "balance", }, subtitle: { lineHeight: lineHeights.lg, maxWidth: "66ch", }, pt1: { paddingTop: spacing._1, }, factItem: { color: semanticColors.fgMuted, fontSize: fontSizes.sm, }, flexFill: { flex: 1, minWidth: 0, }, shrink0: { flexShrink: 0, }, fullWidth: { width: "100%", }, leadingXs: { lineHeight: lineHeights.xs, }, leadingSm: { lineHeight: lineHeights.sm, }, leadingMd: { lineHeight: lineHeights.md, }, leadingLg: { lineHeight: lineHeights.lg, }, lineThrough: { textDecoration: "line-through", }, plainList: { listStyle: "none", marginBlock: 0, marginInline: 0, paddingBlock: 0, paddingInline: 0, }, tabsListWrap: { borderBottomColor: semanticColors.border, borderBottomStyle: "solid", borderBottomWidth: "1px", overflowX: "auto", }, tabPanel: { paddingBlock: spacing._5, paddingInline: 0, }, progressPercent: { minWidth: "2.5rem", }, moduleAccordion: { borderColor: semanticColors.border, borderRadius: semanticRadii.panel, borderStyle: "solid", borderWidth: "1px", overflow: "hidden", }, moduleItem: { borderBottomColor: semanticColors.border, borderBottomStyle: "solid", borderBottomWidth: { default: "1px", ":last-child": 0, }, }, moduleTrigger: { backgroundColor: { default: semanticColors.bgPanel, ":hover": semanticColors.bgSubtle, }, paddingBlock: spacing._3_5, paddingInline: spacing._4, transitionDuration: durations.moderate, transitionProperty: "background-color", }, moduleBody: { backgroundColor: semanticColors.bg, borderTopColor: semanticColors.borderMuted, borderTopStyle: "solid", borderTopWidth: "1px", paddingBlock: spacing._2, paddingInline: spacing._4, }, lessonRow: { borderRadius: semanticRadii.control, paddingBlock: spacing._2, paddingInline: spacing._2, transitionDuration: durations.moderate, transitionProperty: "background-color", backgroundColor: { default: "transparent", ":hover": semanticColors.bgSubtle, }, }, lessonCheckboxRoot: { alignItems: "center", flex: 1, minWidth: 0, }, lessonLabelCompleted: { color: semanticColors.fgMuted, textDecoration: "line-through", }, lessonLabelActive: { color: semanticColors.fg, fontWeight: fontWeights.normal, }, lessonDuration: { minWidth: "3.25rem", }, sectionStack: { gap: spacing._4, }, responsiveTwoCol: { gridTemplateColumns: { default: "repeat(2, minmax(0, 1fr))", "@media (max-width: 640px)": "minmax(0, 1fr)", }, }, outcomeIcon: { color: semanticColors.fgSuccess, flexShrink: 0, marginTop: "2px", }, prereqBullet: { color: semanticColors.accentFg, flexShrink: 0, marginTop: "2px", }, faqBody: { color: semanticColors.fgMuted, fontSize: fontSizes.sm, lineHeight: lineHeights.md, }, reviewSummaryGrid: { gridTemplateColumns: { default: "10rem minmax(0, 1fr)", "@media (max-width: 640px)": "minmax(0, 1fr)", }, }, scoreDisplay: { fontFamily: fonts.heading, fontSize: fontSizes._5xl, fontWeight: fontWeights.semibold, lineHeight: 1, }, enrollCard: { overflow: "hidden", }, coverStage: { backgroundColor: semanticColors.bgMuted, borderBottomColor: semanticColors.border, borderBottomStyle: "solid", borderBottomWidth: "1px", }, coverImage: { display: "block", height: "100%", objectFit: "cover", width: "100%", }, coverOverlay: { backgroundImage: "linear-gradient(180deg, transparent 42%, rgba(9, 13, 24, 0.78) 100%)", bottom: 0, left: 0, paddingBlock: spacing._3, paddingInline: spacing._3_5, position: "absolute", right: 0, top: 0, }, coverPreviewButton: { alignItems: "center", backgroundColor: { default: "rgba(15, 23, 42, 0.84)", ":hover": "rgba(15, 23, 42, 0.96)", }, borderColor: "rgba(255, 255, 255, 0.28)", borderRadius: radii.full, borderStyle: "solid", borderWidth: "1px", boxShadow: semanticShadows.sm, color: "#ffffff", cursor: "pointer", display: "inline-flex", fontFamily: fonts.body, fontSize: fontSizes.xs, fontWeight: fontWeights.medium, gap: spacing._1_5, paddingBlock: spacing._1_5, paddingInline: spacing._3, transitionDuration: durations.moderate, transitionProperty: "background-color, border-color", }, priceCurrent: { fontFamily: fonts.heading, fontSize: fontSizes._3xl, fontWeight: fontWeights.semibold, lineHeight: 1.1, }, railProgressBox: { backgroundColor: semanticColors.bgMuted, borderColor: semanticColors.border, borderRadius: semanticRadii.control, borderStyle: "solid", borderWidth: "1px", paddingBlock: spacing._3, paddingInline: spacing._3, }, segmentFull: { display: "grid", gridTemplateColumns: "1fr 1fr", width: "100%", }, segmentItemCenter: { justifyContent: "center", }, includesIcon: { color: semanticColors.fgSuccess, flexShrink: 0, marginTop: "1px", },});
// ---------------------------------------------------------------------------// Component// ---------------------------------------------------------------------------
/** * CourseDetail — full course overview and interactive learning page combining * breadcrumb navigation, course header metrics, tabbed Syllabus / Outcomes / * Instructor / Reviews content, an interactive lesson-completion accordion * synced to a live Progress bar, and a sticky enrollment & preview rail with * a photographic course cover, self-paced vs. cohort planning, and toasts. */export function CourseDetail({ title = COURSE_META.title, subtitle = COURSE_META.subtitle, price = COURSE_META.price, compareAtPrice = COURSE_META.compareAtPrice, modules = DEFAULT_MODULES, initialCompletedLessonIds = ["l-1", "l-2"], onEnroll, onPreviewLesson, palette, style,}: CourseDetailProps) { const queue = useMemo(() => Toast.createToaster(), []);
const [activeTab, setActiveTab] = useState<string>("syllabus"); const [openModules, setOpenModules] = useState<string[]>(() => modules.slice(0, 2).map((mod) => mod.id), ); const [completedIds, setCompletedIds] = useState<string[]>(() => [ ...initialCompletedLessonIds, ]); const [enrolled, setEnrolled] = useState(false); const [followingInstructor, setFollowingInstructor] = useState(false); const [startMode, setStartMode] = useState<"self-paced" | "cohort">("self-paced"); const [weeklyPace, setWeeklyPace] = useState<number>(6); const [selectedCohort, setSelectedCohort] = useState<string>(COHORTS[0]!.id); const [helpfulVotes, setHelpfulVotes] = useState<Record<string, boolean>>({});
const allLessons = useMemo( () => modules.flatMap((mod) => mod.lessons), [modules], ); const totalLessons = allLessons.length; const completedSet = useMemo(() => new Set(completedIds), [completedIds]); const completedCount = useMemo( () => allLessons.filter((lesson) => completedSet.has(lesson.id)).length, [allLessons, completedSet], ); const progressPercent = totalLessons > 0 ? Math.round((completedCount / totalLessons) * 100) : 0;
const discountPercent = compareAtPrice > price ? Math.round(((compareAtPrice - price) / compareAtPrice) * 100) : 0;
const allExpanded = openModules.length === modules.length;
const handleToggleLesson = useCallback( (lesson: CourseLesson, mod: CourseModule, nextChecked: boolean) => { setCompletedIds((prev) => { const nextSet = new Set(prev); if (nextChecked) { nextSet.add(lesson.id); } else { nextSet.delete(lesson.id); } const nextList = Array.from(nextSet);
if (nextChecked) { const moduleComplete = mod.lessons.every((item) => nextSet.has(item.id)); const courseComplete = allLessons.every((item) => nextSet.has(item.id)); if (courseComplete) { queue.success("All lessons completed", { description: "You are ready to submit your multi-brand capstone library.", }); } else if (moduleComplete) { queue.success("Module completed", { description: `${mod.title} — ${mod.lessons.length} of ${mod.lessons.length} lessons done.`, }); } } return nextList; }); }, [allLessons, queue], );
const handleToggleExpandAll = useCallback(() => { setOpenModules((prev) => prev.length === modules.length ? [] : modules.map((mod) => mod.id), ); }, [modules]);
const handleResetProgress = useCallback(() => { setCompletedIds([]); queue.info("Course progress reset", { description: "All lesson checkmarks have been cleared.", }); }, [queue]);
const handlePreview = useCallback( (lesson?: CourseLesson) => { const target = lesson ?? allLessons[0]; if (!target) return; onPreviewLesson?.(target); setActiveTab("syllabus"); const parentModule = modules.find((mod) => mod.lessons.some((item) => item.id === target.id), ); if (parentModule) { setOpenModules((prev) => prev.includes(parentModule.id) ? prev : [...prev, parentModule.id], ); } queue.info(`Previewing: ${target.title}`, { description: `${target.duration} free lesson preview opened.`, }); }, [allLessons, modules, onPreviewLesson, queue], );
const handleEnroll = useCallback(() => { onEnroll?.({ mode: startMode, paceHours: weeklyPace, cohortId: selectedCohort, }); if (enrolled) { setActiveTab("syllabus"); queue.info("Resuming your curriculum", { description: `${completedCount} of ${totalLessons} lessons completed (${progressPercent}%).`, }); return; } setEnrolled(true); const cohortLabel = COHORTS.find((item) => item.id === selectedCohort)?.label ?? "Upcoming cohort"; queue.success("Enrolled in Design Systems Architecture", { description: startMode === "self-paced" ? `Self-paced plan at ${weeklyPace} h/week — ${estimateFinish(weeklyPace)}.` : `Seat reserved for ${cohortLabel}.`, }); }, [ completedCount, enrolled, onEnroll, progressPercent, queue, selectedCohort, startMode, totalLessons, weeklyPace, ]);
const handleToggleFollow = useCallback(() => { setFollowingInstructor((prev) => { const next = !prev; queue.info( next ? `Following ${INSTRUCTOR.name}` : `Unfollowed ${INSTRUCTOR.name}`, { description: next ? "You will be notified when new design systems labs are published." : "Instructor updates have been muted.", }, ); return next; }); }, [queue]);
const handleToggleHelpful = useCallback( (review: CourseReview) => { setHelpfulVotes((prev) => { const nextVoted = !prev[review.id]; queue.info( nextVoted ? "Marked review as helpful" : "Removed helpful vote", { description: `${review.author}'s review count updated.`, }, ); return { ...prev, [review.id]: nextVoted }; }); }, [queue], );
const handleBreadcrumbClick = useCallback( (label: string) => (event: React.MouseEvent<HTMLAnchorElement>) => { event.preventDefault(); queue.info(`Browsing ${label}`, { description: "Catalog filter navigation is simulated in this preview.", }); }, [queue], );
return ( <div {...stylex.props(palette, styles.root, style)}> <VStack gap="6" style={styles.container}> {/* Breadcrumb Navigation */} <Breadcrumb.Root aria-label="Breadcrumb" size="sm" variant="plain"> <Breadcrumb.List> <Breadcrumb.Item> <Breadcrumb.Link href="#catalog" onClick={handleBreadcrumbClick("Course Catalog")} > Catalog </Breadcrumb.Link> </Breadcrumb.Item> <Breadcrumb.Separator aria-hidden="true"> <ChevronRightIcon /> </Breadcrumb.Separator> <Breadcrumb.Item> <Breadcrumb.Link href="#frontend-architecture" onClick={handleBreadcrumbClick("Frontend Architecture")} > Frontend Architecture </Breadcrumb.Link> </Breadcrumb.Item> <Breadcrumb.Separator aria-hidden="true"> <ChevronRightIcon /> </Breadcrumb.Separator> <Breadcrumb.Item> <Breadcrumb.CurrentLink aria-current="page"> Design Systems </Breadcrumb.CurrentLink> </Breadcrumb.Item> </Breadcrumb.List> </Breadcrumb.Root>
{/* Two-column Course Layout */} <Grid align="start" style={styles.layoutGrid}> {/* Left Main Content Column */} <VStack render={<main />} gap="6"> {/* Course Header */} <VStack render={<header />} gap="4"> <HStack wrap="wrap" gap="2"> <Badge variant="subtle" size="sm" palette={amberPalette}> Bestseller </Badge> <Badge variant="surface" size="sm"> {COURSE_META.level} </Badge> <Badge variant="subtle" size="sm" palette={emeraldPalette}> Updated 2026 </Badge> </HStack>
<Heading render={<h1 />} size="4xl" style={styles.title}> {title} </Heading>
<Text variant="muted" size="md" style={styles.subtitle}> {subtitle} </Text>
<HStack wrap="wrap" gap="2.5"> <RatingGroup count={5} value={5} readOnly size="sm" palette={amberPalette} aria-label={`Rated ${COURSE_META.rating} out of 5`} /> <Text render={<span />} size="sm" weight="semibold" tabular="true"> {COURSE_META.rating.toFixed(1)} </Text> <Text render={<span />} variant="muted" size="sm"> ({COURSE_META.reviewCount.toLocaleString("en-US")} reviews) ·{" "} {COURSE_META.learnerCount} learners </Text> </HStack>
<HStack wrap="wrap" gap="4" style={styles.pt1}> <HStack render={<span />} gap="1.5" style={styles.factItem}> <ClockIcon /> {COURSE_META.runtime} </HStack> <HStack render={<span />} gap="1.5" style={styles.factItem}> <BookOpenIcon /> {modules.length} modules · {totalLessons} lessons </HStack> <HStack render={<span />} gap="1.5" style={styles.factItem}> <GlobeIcon /> {COURSE_META.language} </HStack> <HStack render={<span />} gap="1.5" style={styles.factItem}> <SparklesIcon /> Self-paced or cohort </HStack> </HStack>
<HStack wrap="wrap" gap="2"> {COURSE_META.skills.map((skill) => ( <Tag.Root key={skill} size="md" variant="surface"> <Tag.Label>{skill}</Tag.Label> </Tag.Root> ))} </HStack> </VStack>
{/* Primary Content Tabs */} <Tabs.Root value={activeTab} onValueChange={setActiveTab} variant="line" size="md" palette={accentPalette} > <div {...stylex.props(styles.tabsListWrap)}> <Tabs.List aria-label="Course sections"> <Tabs.Tab value="syllabus"> Syllabus ({completedCount}/{totalLessons}) </Tabs.Tab> <Tabs.Tab value="outcomes">Outcomes & FAQ</Tabs.Tab> <Tabs.Tab value="instructor">Instructor</Tabs.Tab> <Tabs.Tab value="reviews"> Reviews ({COURSE_META.reviewCount.toLocaleString("en-US")}) </Tabs.Tab> </Tabs.List> </div>
{/* Tab 1: Interactive Syllabus & Live Progress */} <Tabs.Panel value="syllabus" style={styles.tabPanel}> <VStack gap="5"> <Card.Root variant="outline" size="md"> <Card.Body> <VStack gap="3"> <HStack wrap="wrap" justify="between" gap="3"> <VStack gap="0.5"> <Text size="sm" weight="semibold"> Curriculum completion tracker </Text> <Text variant="caption" tabular="true"> {completedCount} of {totalLessons} lessons marked complete — check off lessons below as you go. </Text> </VStack> <HStack wrap="wrap" gap="2"> <Button variant="ghost" size="xs" onClick={handleToggleExpandAll} > {allExpanded ? "Collapse all" : "Expand all"} </Button> {completedCount > 0 ? ( <Button variant="outline" size="xs" onClick={handleResetProgress} > Reset </Button> ) : null} </HStack> </HStack>
<Progress.Root value={progressPercent} max={100} variant="subtle" size="md" shape="full" palette={ progressPercent === 100 ? emeraldPalette : accentPalette } aria-label="Course lesson completion" style={styles.fullWidth} > <HStack gap="3"> <Progress.Track style={styles.flexFill}> <Progress.Range /> </Progress.Track> <Text render={<span />} variant="caption" tone="default" weight="semibold" align="end" tabular="true" style={styles.progressPercent} > {progressPercent}% </Text> </HStack> </Progress.Root> </VStack> </Card.Body> </Card.Root>
<Accordion.Root multiple value={openModules} onValueChange={(next) => setOpenModules(next)} variant="outline" size="md" style={styles.moduleAccordion} > {modules.map((mod) => { const modDone = mod.lessons.filter((lesson) => completedSet.has(lesson.id), ).length; const isModComplete = modDone === mod.lessons.length;
return ( <Accordion.Item key={mod.id} value={mod.id} style={styles.moduleItem} > <Accordion.Header> <Accordion.Trigger style={styles.moduleTrigger}> <HStack wrap="wrap" justify="between" gap="2" style={styles.flexFill} > <VStack gap="0.5"> <Text render={<span />} size="md" weight="semibold"> {mod.title} </Text> <Text render={<span />} variant="caption" weight="normal" > {mod.summary} </Text> </VStack> <HStack gap="2" style={styles.shrink0}> <Badge variant="subtle" size="xs" palette={ isModComplete ? emeraldPalette : accentPalette } > {modDone}/{mod.lessons.length} done </Badge> <Text render={<span />} variant="caption" weight="normal" tabular="true" > {mod.duration} </Text> </HStack> </HStack> <Accordion.ItemIndicator> <ChevronDownIcon /> </Accordion.ItemIndicator> </Accordion.Trigger> </Accordion.Header> <Accordion.Panel> <Accordion.ItemBody style={styles.moduleBody}> <VStack render={<ul />} gap="1" style={styles.plainList}> {mod.lessons.map((lesson) => { const isDone = completedSet.has(lesson.id); return ( <HStack key={lesson.id} render={<li />} justify="between" gap="3" style={styles.lessonRow} > <Checkbox.Root size="sm" variant="solid" palette={ isDone ? emeraldPalette : accentPalette } style={styles.lessonCheckboxRoot} > <Checkbox.Control checked={isDone} onCheckedChange={(checked) => handleToggleLesson( lesson, mod, checked === true, ) } /> <Checkbox.Label style={ isDone ? styles.lessonLabelCompleted : styles.lessonLabelActive } > {lesson.title} </Checkbox.Label> </Checkbox.Root>
<HStack gap="2" style={styles.shrink0}> {lesson.preview ? ( <Button variant="ghost" size="2xs" palette={accentPalette} onClick={() => handlePreview(lesson)} > <PlayIcon /> Preview </Button> ) : null} <Text render={<span />} variant="caption" align="end" tabular="true" style={styles.lessonDuration} > {lesson.duration} </Text> </HStack> </HStack> ); })} </VStack> </Accordion.ItemBody> </Accordion.Panel> </Accordion.Item> ); })} </Accordion.Root> </VStack> </Tabs.Panel>
{/* Tab 2: Outcomes, Capstone, Prerequisites & FAQ */} <Tabs.Panel value="outcomes" style={styles.tabPanel}> <VStack gap="5"> <Section.Root style={styles.sectionStack}> <HStack wrap="wrap" justify="between" gap="2"> <Heading render={<h2 />} size="xl" style={styles.headingReset}> What you will build & master </Heading> </HStack> <Grid columns="2" gap="3" style={styles.responsiveTwoCol}> {OUTCOMES.map((outcome) => ( <Card.Root key={outcome.title} variant="outline" size="md"> <Card.Body> <VStack gap="1.5"> <HStack align="start" gap="2"> <span {...stylex.props(styles.outcomeIcon)}> <CheckIcon /> </span> <Text render={<h3 />} size="sm" weight="semibold"> {outcome.title} </Text> </HStack> <Text variant="muted" size="sm" style={styles.leadingMd}> {outcome.detail} </Text> </VStack> </Card.Body> </Card.Root> ))} </Grid> </Section.Root>
<Card.Root variant="subtle" size="md" palette={indigoPalette}> <Card.Body> <VStack gap="3"> <HStack wrap="wrap" justify="between" gap="2"> <Heading render={<h3 />} size="md" style={styles.headingReset}> Reviewed Capstone · Multi-Brand Accessible UI Kit </Heading> <Badge variant="solid" size="xs" palette={indigoPalette}> Graded PR Review </Badge> </HStack> <Text variant="muted" size="sm" style={styles.leadingLg}> Ship an installable package containing semantic OKLCH tokens, compile-time atomic component recipes, five composite WAI-ARIA primitives, and an automated keyboard + axe-core CI workflow. Every capstone submission receives line-by-line architectural feedback. </Text> </VStack> </Card.Body> </Card.Root>
<Section.Root style={styles.sectionStack}> <Heading render={<h2 />} size="lg" style={styles.headingReset}> Prerequisites </Heading> <VStack render={<ul />} gap="2" style={styles.plainList}> {PREREQUISITES.map((item) => ( <HStack key={item} render={<li />} align="start" gap="2"> <span {...stylex.props(styles.prereqBullet)}> <ChevronRightIcon /> </span> <Text render={<span />} variant="muted" size="sm" style={styles.leadingMd} > {item} </Text> </HStack> ))} </VStack> </Section.Root>
<Separator />
<Section.Root style={styles.sectionStack}> <Heading render={<h2 />} size="lg" style={styles.headingReset}> Common questions </Heading> <Accordion.Root multiple variant="outline" size="md"> {FAQS.map((faq) => ( <Accordion.Item key={faq.id} value={faq.id}> <Accordion.Header> <Accordion.Trigger> {faq.q} <Accordion.ItemIndicator> <ChevronDownIcon /> </Accordion.ItemIndicator> </Accordion.Trigger> </Accordion.Header> <Accordion.Panel> <Accordion.ItemBody style={styles.faqBody}> {faq.a} </Accordion.ItemBody> </Accordion.Panel> </Accordion.Item> ))} </Accordion.Root> </Section.Root> </VStack> </Tabs.Panel>
{/* Tab 3: Instructor */} <Tabs.Panel value="instructor" style={styles.tabPanel}> <VStack gap="5"> <Card.Root variant="outline" size="lg"> <Card.Body> <VStack gap="4"> <HStack wrap="wrap" gap="4"> <Avatar.Root size="xl" variant="subtle" palette={indigoPalette} > <Avatar.Fallback>{INSTRUCTOR.initials}</Avatar.Fallback> </Avatar.Root> <VStack gap="1"> <Heading render={<h2 />} size="xl" style={styles.headingReset} > {INSTRUCTOR.name} </Heading> <Text variant="muted" size="sm"> {INSTRUCTOR.role} </Text> </VStack> </HStack>
<HStack wrap="wrap" gap="5"> <HStack render={<span />} gap="1.5" style={styles.factItem}> <UsersIcon /> {INSTRUCTOR.learners} learners </HStack> <HStack render={<span />} gap="1.5" style={styles.factItem}> <BookOpenIcon /> {INSTRUCTOR.courses} courses </HStack> <HStack render={<span />} gap="1.5" style={styles.factItem}> <SparklesIcon /> {INSTRUCTOR.rating} instructor rating </HStack> </HStack>
<Text size="sm" style={styles.leadingLg}> {INSTRUCTOR.bio} </Text>
<HStack wrap="wrap" gap="2"> {INSTRUCTOR.focusAreas.map((area) => ( <Tag.Root key={area} size="sm" variant="subtle" palette={indigoPalette}> <Tag.Label>{area}</Tag.Label> </Tag.Root> ))} </HStack>
<HStack wrap="wrap" gap="2"> <Button variant="surface" size="md" onClick={() => queue.info(`Opening ${INSTRUCTOR.name}'s profile`, { description: "5 published architecture courses and 14 conference talks.", }) } > View full profile </Button> <Button variant={followingInstructor ? "subtle" : "outline"} size="md" palette={followingInstructor ? emeraldPalette : accentPalette} onClick={handleToggleFollow} > {followingInstructor ? "Following" : "Follow instructor"} </Button> </HStack> </VStack> </Card.Body> </Card.Root> </VStack> </Tabs.Panel>
{/* Tab 4: Learner Reviews */} <Tabs.Panel value="reviews" style={styles.tabPanel}> <VStack gap="5"> <Card.Root variant="outline" size="lg"> <Card.Body> <Grid gap="6" style={styles.reviewSummaryGrid}> <VStack align="start" justify="center" gap="1.5"> <Text tabular="true" style={styles.scoreDisplay}> {COURSE_META.rating.toFixed(1)} </Text> <RatingGroup count={5} value={5} readOnly size="sm" palette={amberPalette} aria-label={`Average rating ${COURSE_META.rating} out of 5`} /> <Text render={<span />} variant="muted" size="sm"> {COURSE_META.reviewCount.toLocaleString("en-US")} verified reviews </Text> </VStack>
<VStack gap="2.5"> {RATING_ASPECTS.map((aspect) => ( <VStack key={aspect.label} gap="1"> <HStack justify="between"> <Text render={<span />} variant="caption"> {aspect.label} </Text> <Text render={<span />} variant="caption" tone="default" weight="medium" tabular="true" > {aspect.score.toFixed(1)} </Text> </HStack> <Progress.Root value={Math.round((aspect.score / 5) * 100)} max={100} variant="subtle" size="xs" shape="full" palette={accentPalette} aria-label={`${aspect.label}: ${aspect.score} out of 5`} > <Progress.Track> <Progress.Range /> </Progress.Track> </Progress.Root> </VStack> ))} </VStack> </Grid> </Card.Body> </Card.Root>
<Grid columns="2" gap="4" style={styles.responsiveTwoCol}> {REVIEWS.map((review) => { const voted = Boolean(helpfulVotes[review.id]); const count = review.helpful + (voted ? 1 : 0); return ( <Card.Root key={review.id} variant="outline" size="md"> <Card.Body> <VStack gap="3" style={styles.flexFill}> <HStack gap="2.5"> <Avatar.Root size="sm" variant="subtle" palette={REVIEW_PALETTES[review.paletteKey]} > <Avatar.Fallback>{review.initials}</Avatar.Fallback> </Avatar.Root> <VStack gap="0.5"> <Text render={<span />} size="sm" weight="semibold" style={styles.leadingXs} > {review.author} </Text> <Text render={<span />} variant="caption"> {review.role} · {review.date} </Text> </VStack> </HStack>
<RatingGroup count={5} value={review.rating} readOnly size="xs" palette={amberPalette} aria-label={`${review.author} rated ${review.rating} out of 5`} />
<Text size="sm" style={[styles.flexFill, styles.leadingMd]} > {review.body} </Text>
<HStack justify="between" style={styles.pt1}> <Button variant={voted ? "subtle" : "ghost"} size="xs" palette={voted ? accentPalette : undefined} onClick={() => handleToggleHelpful(review)} > <ThumbUpIcon /> Helpful ({count}) </Button> </HStack> </VStack> </Card.Body> </Card.Root> ); })} </Grid> </VStack> </Tabs.Panel> </Tabs.Root> </VStack>
{/* Right Sticky Enrollment & Preview Card */} <VStack render={<aside aria-label="Course enrollment and preview" />} gap="4" style={styles.railColumn} > <Card.Root variant="elevated" size="lg" style={styles.enrollCard}> {/* Course cover photo */} <AspectRatio ratio="wide" rounded="none" style={styles.coverStage}> <img src="/images/blocks/course-detail/cover.webp" alt="Overhead studio photo of color swatch chips arranged in smooth indigo-to-violet gradient ramps beside a pencil and ruler" {...stylex.props(styles.coverImage)} /> <HStack align="end" justify="between" style={styles.coverOverlay}> <button type="button" onClick={() => handlePreview()} {...stylex.props(styles.coverPreviewButton)} > <PlayIcon /> Preview lesson 1 · 18m </button> </HStack> </AspectRatio>
<Card.Body> <VStack gap="4"> <VStack gap="1"> <HStack align="baseline" wrap="wrap" gap="2"> <Text render={<span />} tabular="true" style={styles.priceCurrent} > {formatUsd(price)} </Text> {compareAtPrice > price ? ( <Text render={<span />} variant="muted" size="md" tabular="true" style={styles.lineThrough} > {formatUsd(compareAtPrice)} </Text> ) : null} {discountPercent > 0 ? ( <Badge variant="subtle" size="sm" palette={rosePalette}> Save {discountPercent}% </Badge> ) : null} </HStack> <Text render={<span />} variant="muted" size="sm"> One-time purchase · lifetime access & updates </Text> </VStack>
<VStack gap="2"> <Button variant="solid" size="lg" palette={enrolled ? emeraldPalette : accentPalette} onClick={handleEnroll} style={styles.fullWidth} > {enrolled ? "Continue learning" : "Enroll now"} <ArrowRightIcon /> </Button> <Button variant="surface" size="lg" onClick={() => handlePreview()} style={styles.fullWidth} > <PlayIcon /> Start lesson one free </Button> </VStack>
{/* Live synced progress summary */} <VStack gap="2" style={styles.railProgressBox}> <HStack justify="between"> <Text render={<span />} size="xs" weight="semibold"> Your syllabus progress </Text> <Text render={<span />} size="xs" weight="semibold" tabular="true" > {completedCount}/{totalLessons} ({progressPercent}%) </Text> </HStack> <Progress.Root value={progressPercent} max={100} variant="subtle" size="sm" shape="full" palette={ progressPercent === 100 ? emeraldPalette : accentPalette } aria-label="Syllabus progress summary" > <Progress.Track> <Progress.Range /> </Progress.Track> </Progress.Root> </VStack>
<Separator />
{/* Study Pace / Cohort Selector */} <VStack gap="3"> <Text render={<span />} size="xs" weight="semibold"> Study format </Text> <SegmentGroup.Root value={startMode} onValueChange={(next) => { if (next === "self-paced" || next === "cohort") { setStartMode(next); } }} size="sm" aria-label="Study format" style={styles.segmentFull} > <SegmentGroup.Item value="self-paced" style={styles.segmentItemCenter} > Self-paced </SegmentGroup.Item> <SegmentGroup.Item value="cohort" style={styles.segmentItemCenter} > Live cohort </SegmentGroup.Item> </SegmentGroup.Root>
{startMode === "self-paced" ? ( <VStack gap="3"> <HStack justify="between"> <Text render={<span />} variant="muted" size="sm"> Weekly study pace </Text> <Text render={<span />} size="xs" weight="semibold" tabular="true" > {weeklyPace} h/week </Text> </HStack> <Slider.Root size="sm" min={PACE_MIN} max={PACE_MAX} step={1} value={weeklyPace} palette={accentPalette} onValueChange={(next) => { const hours = Array.isArray(next) ? (next[0] ?? weeklyPace) : next; setWeeklyPace(hours); }} > <Slider.Control> <Slider.Track> <Slider.Indicator /> <Slider.Thumb aria-label="Weekly study hours" /> </Slider.Track> </Slider.Control> </Slider.Root> <HStack justify="between"> <Text render={<span />} variant="caption"> {PACE_MIN} h/wk </Text> <Text render={<span />} variant="caption"> {PACE_MAX} h/wk </Text> </HStack> <Text render={<span />} variant="muted" size="sm"> At {weeklyPace} h/week — {estimateFinish(weeklyPace)} </Text> </VStack> ) : ( <RadioCard.Root value={selectedCohort} onValueChange={(next) => { if (next) setSelectedCohort(next); }} variant="outline" size="sm" palette={accentPalette} aria-label="Upcoming live cohort" > {COHORTS.map((option) => ( <RadioCard.Item key={option.id} value={option.id}> <RadioCard.ItemControl> <RadioCard.ItemContent> <RadioCard.ItemText> {option.label} </RadioCard.ItemText> <RadioCard.ItemDescription> {option.detail} </RadioCard.ItemDescription> </RadioCard.ItemContent> <RadioCard.ItemIndicator /> </RadioCard.ItemControl> </RadioCard.Item> ))} </RadioCard.Root> )} </VStack>
<Separator />
{/* Includes Checklist */} <VStack gap="3"> <Text render={<span />} size="xs" weight="semibold"> This course includes </Text> <VStack render={<ul />} gap="2" style={styles.plainList}> {COURSE_INCLUDES.map((item) => ( <HStack key={item} render={<li />} align="start" gap="2"> <span {...stylex.props(styles.includesIcon)}> <CheckIcon /> </span> <Text render={<span />} variant="caption" style={styles.leadingSm} > {item} </Text> </HStack> ))} </VStack> </VStack> </VStack> </Card.Body> </Card.Root> </VStack> </Grid> </VStack>
<Toaster toaster={queue} /> </div> );}
Inspired by the Course Detail template from Astryx (MIT License · Copyright (c) 2026 Meta Platforms, Inc.).