Customer Portal 2
Course library shelf block: the course in progress takes the spotlight with one big Continue action, the rest of the library stands on a lit shelf, and the next product on the value ladder waits at the end of the row.
Use it in a prompt
Use checkout/customer-portal-2 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/checkout/customer-portal-2.tsx. - Import it and pass your copy and images (Props tab):
import { CustomerPortal2 } from "@/components/funneldna/checkout/customer-portal-2"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/checkout/customer-portal-2/component.tsx 971 lines
// layout: hello-strip
// Course library shelf block: the course in progress takes the spotlight with one big Continue action, the rest of the library stands on a lit shelf, and the next product on the value ladder waits at the end of the row.
import * as React from "react";
import { BookOpen, Check, Plus, ShieldCheck } from "lucide-react";
import { motion, useReducedMotion } from "motion/react";
import { FX_HOST, Spotlight, Texture } from "../fx/fx";
import noise from "../fx/textures/noise";
export type ShelfTab = "progress" | "completed" | "all";
export type ShelfCourse = {
id: string;
title: string;
image?: string; // item-n slot image: the course cover
imageAlt?: string;
progress?: number; // supplied completion, 0 to 100 (100 = completed, 0 = not started)
lessonsDone?: number;
lessonsTotal?: number;
href?: string; // access link; without it the cover calls onOpen
};
export type ShelfFeatured = ShelfCourse & {
nextLesson?: string; // e.g. "Lesson 4 · Shape soft light with one window"
};
export type ShelfUpgrade = {
title: string;
image?: string; // item-n slot image, shown muted until it is owned
imageAlt?: string;
value?: string; // supplied total value, revealed first
price?: string; // supplied price today
note?: string; // one reassurance line under the button
href?: string; // checkout link; without it the button calls onAction
};
export type CustomerPortal2Copy = {
greeting: string; // "{name}" placeholder
tabsLabel: string;
tabs: Record<ShelfTab, string>;
empty: Record<ShelfTab, string>; // message when a tab has no courses
shelfLabel: string;
upNext: string;
percent: string; // "{percent}" placeholder
complete: string;
lessonsDone: string; // "{done}" and "{total}" placeholders
lessons: string; // "{total}" placeholder
lessonsOne: string;
progressLabel: string; // "{title}" placeholder
percentDone: string; // "{percent}" placeholder
completed: string;
notStarted: string;
separator: string;
upgradeFlag: string;
valueLabel: string;
valueTurn: string;
todayLabel: string;
addLabel: string;
addAria: string; // "{title}" placeholder
};
export type CustomerPortal2CopyInput = Partial<Omit<CustomerPortal2Copy, "tabs" | "empty">> & {
tabs?: Partial<Record<ShelfTab, string>>;
empty?: Partial<Record<ShelfTab, string>>;
};
export type CustomerPortal2Props = {
headline?: string;
lead?: string;
customerName?: string; // fills the bold greeting in front of the lead
featured?: ShelfFeatured; // the course in the spotlight card
courses?: ShelfCourse[]; // the rest of the library on the shelf
upgrade?: ShelfUpgrade; // next product on the value ladder; omit to hide its cover
defaultTab?: ShelfTab;
actionLabel?: string; // e.g. "Continue lesson 4"
continueHref?: string;
onContinue?: (course: ShelfFeatured) => void;
actionDisabled?: boolean;
secondaryLabel?: string; // quiet line under the button
secondaryHref?: string;
onSecondary?: (course: ShelfFeatured) => void;
onOpen?: (course: ShelfCourse, index: number) => void;
onAction?: (upgrade: ShelfUpgrade) => void; // "Add to my library"
upgradeDisabled?: boolean;
copy?: CustomerPortal2CopyInput;
state?: "default" | "hover" | "active" | "disabled";
className?: string;
};
const TAB_ORDER: ShelfTab[] = ["progress", "completed", "all"];
const DEFAULT_COPY: CustomerPortal2Copy = {
greeting: "Welcome back, {name}.",
tabsLabel: "Filter your library",
tabs: { progress: "In progress", completed: "Completed", all: "All" },
empty: {
progress: "Nothing else in progress. Pick a course from All and start your next lesson.",
completed: "No finished courses yet. Your first one is a few lessons away.",
all: "Your shelf is ready for your first course.",
},
shelfLabel: "Your courses",
upNext: "Up next:",
percent: "{percent}%",
complete: "complete",
lessonsDone: "{done} of {total} lessons done",
lessons: "{total} lessons",
lessonsOne: "1 lesson",
progressLabel: "{title} progress",
percentDone: "{percent}% done",
completed: "Completed",
notStarted: "Not started",
separator: " · ",
upgradeFlag: "Your next level",
valueLabel: "Total value",
valueTurn: "but you won't pay that",
todayLabel: "today",
addLabel: "Add to my library",
addAria: "Add {title} to my library",
};
export function CustomerPortal2(props: CustomerPortal2Props) {
const {
headline = "Pick up right where you left off",
lead = "Every course you own lives on this shelf, and your next lesson is one tap away.",
customerName,
featured,
courses = [],
upgrade,
defaultTab = "all",
actionLabel = "Continue my course",
continueHref,
onContinue,
actionDisabled = false,
secondaryLabel = "or see every lesson in this course",
secondaryHref,
onSecondary,
onOpen,
onAction,
upgradeDisabled = false,
copy,
state = "default",
className,
} = props;
const c: CustomerPortal2Copy = {
...DEFAULT_COPY,
...copy,
tabs: { ...DEFAULT_COPY.tabs, ...copy?.tabs },
empty: { ...DEFAULT_COPY.empty, ...copy?.empty },
};
const uid = React.useId().replace(/[^a-zA-Z0-9_-]/g, "");
const reduce = useReducedMotion();
const [tab, setTab] = React.useState<ShelfTab>(defaultTab);
const tabRefs = React.useRef<Array<HTMLButtonElement | null>>([]);
const counts: Record<ShelfTab, number> = { progress: 0, completed: 0, all: courses.length };
courses.forEach((course) => {
const s = statusOf(course);
if (s === "progress") counts.progress += 1;
if (s === "completed") counts.completed += 1;
});
const visible = courses
.map((course, index) => ({ course, index }))
.filter(({ course }) => tab === "all" || statusOf(course) === tab);
const disabled = state === "disabled";
const mainDisabled = actionDisabled || disabled;
const upDisabled = upgradeDisabled || disabled;
const forced = state === "hover" ? " cp2--hover" : state === "active" ? " cp2--active" : "";
const pct = featured ? clampPct(featured.progress) : 0;
const greeting = customerName ? fill(c.greeting, { name: customerName }) : "";
const onTabKey = (event: React.KeyboardEvent<HTMLButtonElement>, index: number) => {
let next = index;
if (event.key === "ArrowRight") next = (index + 1) % TAB_ORDER.length;
else if (event.key === "ArrowLeft") next = (index + TAB_ORDER.length - 1) % TAB_ORDER.length;
else if (event.key === "Home") next = 0;
else if (event.key === "End") next = TAB_ORDER.length - 1;
else return;
event.preventDefault();
setTab(TAB_ORDER[next]);
tabRefs.current[next]?.focus();
};
return (
<section
className={`cf-customer-portal-2${forced}${className ? ` ${className}` : ""}`}
style={FX_HOST}
aria-labelledby={`${uid}-h`}
>
<style>{CSS}</style>
<Texture src={noise} tone="band-ink" />
<Spotlight />
<div className="cp2-wrap">
<header className="cp2-head">
<h2 id={`${uid}-h`} className="cp2-h">
{headline}
</h2>
{lead || greeting ? (
<p className="cp2-lead">
{greeting ? <strong>{greeting} </strong> : null}
{lead}
</p>
) : null}
</header>
{featured ? (
<article
className={`cp2-feature${featured.image ? "" : " cp2-feature--solo"}`}
aria-labelledby={`${uid}-ft`}
>
{featured.image ? (
<div className="cp2-feature-media">
<img src={featured.image} alt={featured.imageAlt ?? ""} decoding="async" />
</div>
) : null}
<div className="cp2-feature-body">
<h3 id={`${uid}-ft`} className="cp2-feature-title">
{featured.title}
</h3>
{featured.nextLesson ? (
<p className="cp2-next">
<strong>{c.upNext}</strong> {featured.nextLesson}
</p>
) : null}
{featured.progress != null ? (
<div className="cp2-progress">
<p className="cp2-pct">
<span className="cp2-pct-num">{fill(c.percent, { percent: pct })}</span>
<span className="cp2-pct-word">{c.complete}</span>
</p>
<div
className="cp2-bar"
role="progressbar"
aria-valuemin={0}
aria-valuemax={100}
aria-valuenow={pct}
aria-label={fill(c.progressLabel, { title: featured.title })}
>
<span className="cp2-bar-fill" style={{ width: `${pct}%` }} />
</div>
{featured.lessonsTotal ? (
<p className="cp2-lessons">
{fill(c.lessonsDone, { done: featured.lessonsDone ?? 0, total: featured.lessonsTotal })}
</p>
) : null}
</div>
) : null}
<div className="cp2-actions">
{continueHref && !mainDisabled ? (
<a className="cp2-btn cp2-btn--main" href={continueHref} onClick={() => onContinue?.(featured)}>
{actionLabel}
</a>
) : (
<button
type="button"
className="cp2-btn cp2-btn--main"
disabled={mainDisabled}
onClick={() => onContinue?.(featured)}
>
{actionLabel}
</button>
)}
{secondaryLabel ? (
secondaryHref ? (
<a className="cp2-quiet" href={secondaryHref} onClick={() => onSecondary?.(featured)}>
{secondaryLabel}
</a>
) : (
<button type="button" className="cp2-quiet" onClick={() => onSecondary?.(featured)}>
{secondaryLabel}
</button>
)
) : null}
</div>
</div>
</article>
) : null}
<div className="cp2-shelf">
<div className="cp2-tabs" role="tablist" aria-label={c.tabsLabel}>
{TAB_ORDER.map((key, i) => {
const active = tab === key;
return (
<button
key={key}
ref={(el) => {
tabRefs.current[i] = el;
}}
type="button"
role="tab"
id={`${uid}-tab-${key}`}
aria-selected={active}
aria-controls={`${uid}-panel`}
tabIndex={active ? 0 : -1}
className="cp2-tab"
onClick={() => setTab(key)}
onKeyDown={(event) => onTabKey(event, i)}
>
{active ? (
<motion.span
layoutId={`${uid}-pill`}
className="cp2-tab-pill"
aria-hidden="true"
transition={reduce ? { duration: 0 } : { type: "spring", bounce: 0.18, duration: 0.4 }}
/>
) : null}
<span className="cp2-tab-label">{c.tabs[key]}</span>
<span className="cp2-tab-count" aria-hidden="true">
{counts[key]}
</span>
</button>
);
})}
</div>
<div
className="cp2-scroll"
role="tabpanel"
id={`${uid}-panel`}
aria-labelledby={`${uid}-tab-${tab}`}
tabIndex={0}
>
<ul className="cp2-track" key={tab} aria-label={c.shelfLabel}>
{visible.length === 0 ? (
<li className="cp2-empty">
<BookOpen size={24} strokeWidth={2.5} aria-hidden="true" />
<span>{c.empty[tab]}</span>
</li>
) : (
visible.map(({ course, index }, i) => (
<li key={course.id} className="cp2-item" style={{ animationDelay: `${Math.min(i * 0.07, 0.28)}s` }}>
<CoverAction course={course} onOpen={() => onOpen?.(course, index)}>
<span className="cp2-frame">
{course.image ? (
<img src={course.image} alt={course.imageAlt ?? ""} loading="lazy" decoding="async" />
) : null}
</span>
<span className="cp2-title">{course.title}</span>
</CoverAction>
<StatusLine course={course} copy={c} />
</li>
))
)}
{upgrade ? (
<li
className="cp2-item cp2-item--up cp2-up--shelf"
style={{ animationDelay: `${Math.min(visible.length * 0.07, 0.28)}s` }}
>
<UpgradeOffer upgrade={upgrade} copy={c} disabled={upDisabled} onAction={onAction} />
</li>
) : null}
</ul>
</div>
{upgrade ? (
<div className="cp2-up-row">
<UpgradeOffer upgrade={upgrade} copy={c} disabled={upDisabled} onAction={onAction} />
</div>
) : null}
</div>
</div>
</section>
);
}
export default CustomerPortal2;
function CoverAction({
course,
onOpen,
children,
}: {
course: ShelfCourse;
onOpen: () => void;
children: React.ReactNode;
}) {
if (course.href) {
return (
<a className="cp2-cover" href={course.href} onClick={onOpen}>
{children}
</a>
);
}
return (
<button type="button" className="cp2-cover" onClick={onOpen}>
{children}
</button>
);
}
function UpgradeOffer({
upgrade,
copy,
disabled,
onAction,
}: {
upgrade: ShelfUpgrade;
copy: CustomerPortal2Copy;
disabled: boolean;
onAction?: (upgrade: ShelfUpgrade) => void;
}) {
const aria = fill(copy.addAria, { title: upgrade.title });
return (
<>
<span className="cp2-frame cp2-frame--muted">
{upgrade.image ? (
<img src={upgrade.image} alt={upgrade.imageAlt ?? ""} loading="lazy" decoding="async" />
) : null}
<span className="cp2-plus" aria-hidden="true">
<span className="cp2-plus-disc">
<Plus size={20} strokeWidth={2.5} />
</span>
</span>
</span>
<div className="cp2-up-body">
<p className="cp2-up-flag">{copy.upgradeFlag}</p>
<h3 className="cp2-up-title">{upgrade.title}</h3>
{upgrade.value || upgrade.price ? (
<div className="cp2-value">
{upgrade.value ? (
<p className="cp2-value-row">
<span className="cp2-value-label">{copy.valueLabel}</span>
<span className="cp2-value-amt">{upgrade.value}</span>
</p>
) : null}
{upgrade.value && upgrade.price ? <p className="cp2-value-turn">{copy.valueTurn}</p> : null}
{upgrade.price ? (
<p className="cp2-today">
<span className="cp2-today-amt">{upgrade.price}</span>
<span className="cp2-today-label">{copy.todayLabel}</span>
</p>
) : null}
</div>
) : null}
</div>
{upgrade.href && !disabled ? (
<a className="cp2-btn cp2-btn--sm" href={upgrade.href} aria-label={aria} onClick={() => onAction?.(upgrade)}>
{copy.addLabel}
</a>
) : (
<button
type="button"
className="cp2-btn cp2-btn--sm"
disabled={disabled}
aria-label={aria}
onClick={() => onAction?.(upgrade)}
>
{copy.addLabel}
</button>
)}
{upgrade.note ? (
<p className="cp2-up-note">
<ShieldCheck size={16} strokeWidth={2.5} aria-hidden="true" className="cp2-inline-icon" />
{upgrade.note}
</p>
) : null}
</>
);
}
function StatusLine({ course, copy }: { course: ShelfCourse; copy: CustomerPortal2Copy }) {
const s = statusOf(course);
const p = clampPct(course.progress);
if (s === "completed") {
return (
<p className="cp2-status">
<span className="cp2-badge" aria-hidden="true">
<Check size={12} strokeWidth={3} />
</span>
{copy.completed}
</p>
);
}
if (s === "progress") {
return (
<p className="cp2-status">
<span className="cp2-mini" aria-hidden="true">
<span style={{ width: `${p}%` }} />
</span>
{fill(copy.percentDone, { percent: p })}
</p>
);
}
const total = course.lessonsTotal;
const lessons = total ? (total === 1 ? copy.lessonsOne : fill(copy.lessons, { total })) : "";
return (
<p className="cp2-status">
{copy.notStarted}
{lessons ? `${copy.separator}${lessons}` : ""}
</p>
);
}
function clampPct(value?: number) {
if (value == null || Number.isNaN(value)) return 0;
return Math.max(0, Math.min(100, Math.round(value)));
}
function statusOf(course: ShelfCourse): "progress" | "completed" | "new" {
const p = clampPct(course.progress);
if (p >= 100) return "completed";
if (p > 0) return "progress";
return "new";
}
function fill(template: string, vars: Record<string, string | number>) {
return template.replace(/\{(\w+)\}/g, (match, key: string) => (key in vars ? String(vars[key]) : match));
}
const CSS = `
.cf-customer-portal-2 {
--cw: 164px;
--cw-up: 208px;
--gap: 24px;
--cp2-gutter: clamp(16px, 5vw, 48px);
--cp2-shadow: var(--shadow, oklch(0.22 0.03 260));
position: relative;
overflow: hidden;
background: var(--band);
color: var(--band-ink);
font-family: var(--font-body);
padding: clamp(56px, 8vw, 112px) var(--cp2-gutter) clamp(64px, 8.5vw, 120px);
}
.cf-customer-portal-2 *, .cf-customer-portal-2 *::before, .cf-customer-portal-2 *::after { box-sizing: border-box; }
.cf-customer-portal-2 p, .cf-customer-portal-2 h2, .cf-customer-portal-2 h3 { margin: 0; }
.cp2-wrap { position: relative; z-index: 1; max-width: 1120px; margin: 0 auto; }
.cp2-head { display: grid; gap: 16px; max-width: 46rem; margin: 0 0 clamp(32px, 4vw, 48px); }
.cp2-h {
font-family: var(--font-display);
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;
text-wrap: balance;
color: var(--band-ink);
}
.cp2-lead {
max-width: 60ch;
font-size: clamp(1.125rem, 1.5vw, 1.375rem);
line-height: 1.4;
font-weight: 500;
text-wrap: pretty;
color: color-mix(in oklch, var(--band-ink) 84%, var(--band));
}
.cp2-lead strong { color: var(--band-ink); font-weight: 800; }
.cp2-feature {
display: grid;
grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
gap: clamp(24px, 3.5vw, 48px);
align-items: start;
padding: clamp(20px, 3vw, 32px);
background: var(--card);
color: var(--ink);
border: 1px solid var(--card-border, oklch(from var(--ink) l c h / 0.12));
border-radius: var(--card-radius, var(--radius, 14px));
box-shadow: var(--card-shadow, var(--shadow-lg, 0 2px 4px oklch(from var(--cp2-shadow) l c h / 0.22), 0 12px 24px -8px oklch(from var(--cp2-shadow) l c h / 0.32)));
}
.cp2-feature--solo { grid-template-columns: minmax(0, 1fr); }
.cp2-feature-media {
aspect-ratio: 4 / 3;
border-radius: 12px;
overflow: hidden;
background: color-mix(in oklch, var(--ink) 6%, var(--card));
}
.cp2-feature-media img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 35%; }
.cp2-feature-body { display: flex; flex-direction: column; min-width: 0; padding-top: 4px; }
.cp2-feature-title {
font-family: var(--font-display);
font-weight: var(--display-weight, 800);
text-transform: var(--display-case, none);
letter-spacing: -0.01em;
font-size: clamp(1.3125rem, 1.8vw, 1.625rem);
line-height: 1.15;
text-wrap: balance;
color: var(--ink);
}
.cp2-next {
margin-top: 12px !important;
font-size: clamp(1.0625rem, 1.25vw, 1.125rem);
line-height: 1.5;
text-wrap: pretty;
color: var(--ink);
}
.cp2-next strong { font-weight: 800; }
.cp2-progress {
margin-top: 24px;
padding: 20px;
border-radius: 10px;
background: color-mix(in oklch, var(--ink) 4%, var(--card));
}
.cp2-pct { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-bottom: 12px !important; }
.cp2-pct-num {
font-family: var(--font-display);
font-weight: 800;
letter-spacing: -0.03em;
font-variant-numeric: tabular-nums;
font-size: clamp(2.5rem, 4.2vw, 3.75rem);
line-height: 1;
color: var(--ink);
}
.cp2-pct-word { font-size: clamp(1.125rem, 1.5vw, 1.375rem); font-weight: 600; line-height: 1.4; color: var(--muted); }
.cp2-bar {
height: 10px;
border-radius: 999px;
overflow: hidden;
background: color-mix(in oklch, var(--ink) 10%, var(--card));
}
.cp2-bar-fill {
display: block;
height: 100%;
border-radius: inherit;
background: var(--accent-fill, var(--accent));
transform-origin: left center;
}
.cp2-lessons { margin-top: 8px !important; font-size: 15px; font-weight: 600; line-height: 1.4; color: var(--muted); }
.cp2-actions { margin-top: 24px; display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
.cp2-actions .cp2-btn--main { width: 100%; min-width: 0; }
.cp2-btn {
display: inline-flex;
align-items: center;
justify-content: center;
min-height: 64px;
min-width: 280px;
padding: 0 28px;
border: 0;
border-radius: var(--button-radius, var(--radius, 12px));
font-family: var(--button-font, var(--font-display));
font-weight: var(--button-weight, 800);
text-transform: var(--button-case, none);
font-size: clamp(1.125rem, 1.55vw, 1.375rem);
line-height: 1.15;
text-align: center;
text-decoration: none;
color: var(--button-ink, var(--cta-ink));
text-shadow: var(--button-text-shadow, none);
background: linear-gradient(oklch(from var(--button-bg, var(--cta)) calc(l + 0.04) c h), oklch(from var(--button-bg-2, var(--cta-2)) calc(l - 0.02) c h));
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l + 0.14) c h / 0.7), inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--cp2-shadow) l c h / 0.3), 0 8px 16px -6px oklch(from var(--cp2-shadow) l c h / 0.4));
cursor: pointer;
transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.cp2-btn:hover:not(:disabled),
.cp2--hover .cp2-btn:not(:disabled) {
background: linear-gradient(oklch(from var(--button-bg, var(--cta)) calc(l - 0.01) c h), oklch(from var(--button-bg-2, var(--cta-2)) calc(l - 0.07) c h));
box-shadow: inset 0 1px 0 oklch(from var(--button-bg, var(--cta)) calc(l + 0.12) c h / 0.7), inset 0 -3px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.2) c h), 0 1px 2px oklch(from var(--cp2-shadow) l c h / 0.35), 0 10px 20px -6px oklch(from var(--cp2-shadow) l c h / 0.5);
}
.cp2-btn:active:not(:disabled),
.cp2--active .cp2-btn:not(:disabled) {
transform: translateY(1px);
box-shadow: inset 0 2px 3px oklch(from var(--button-bg, var(--cta)) calc(l - 0.22) c h / 0.55), inset 0 -2px 0 oklch(from var(--button-bg, var(--cta)) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--cp2-shadow) l c h / 0.3);
}
.cp2-btn:focus-visible { outline: 3px solid oklch(from var(--field-focus, var(--accent)) l c h / 0.6); outline-offset: 3px; }
.cp2-btn:disabled {
background: var(--button-2-bg, var(--secondary));
color: var(--button-2-ink, var(--secondary-ink));
text-shadow: none;
box-shadow: var(--button-2-shadow, var(--shadow-sm));
cursor: not-allowed;
transform: none;
}
.cp2-quiet {
align-self: center;
text-align: center;
padding: 0;
border: 0;
background: none;
font-family: var(--font-body);
font-size: 15px;
font-weight: 600;
line-height: 1.4;
color: var(--link, var(--accent));
text-decoration: underline;
text-decoration-color: oklch(from var(--link, var(--accent)) l c h / 0.45);
text-underline-offset: 0.18em;
cursor: pointer;
}
.cp2-quiet:hover { color: oklch(from var(--link, var(--accent)) calc(l - 0.08) c h); text-decoration-color: currentColor; }
.cp2-quiet:focus-visible { outline: 3px solid oklch(from var(--field-focus, var(--accent)) l c h / 0.5); outline-offset: 3px; border-radius: 4px; }
.cp2-shelf { margin-top: clamp(48px, 6vw, 64px); }
.cp2-tabs {
display: inline-flex;
max-width: 100%;
gap: 4px;
padding: 4px;
margin-bottom: 24px;
border-radius: 999px;
background: oklch(from var(--band-ink) l c h / 0.08);
border: 1px solid oklch(from var(--band-ink) l c h / 0.16);
}
.cp2-tab {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
min-height: 44px;
padding: 0 18px;
border: 0;
border-radius: 999px;
background: transparent;
color: var(--band-ink);
font-family: var(--font-body);
font-size: 15px;
font-weight: 700;
line-height: 1.2;
white-space: nowrap;
cursor: pointer;
transition: color 0.16s ease, background 0.16s ease;
}
.cp2-tab:hover:not([aria-selected='true']) { background: oklch(from var(--band-ink) l c h / 0.1); }
.cp2-tab[aria-selected='true'] { color: var(--ink); }
.cp2-tab:focus-visible { outline: 2px solid var(--band-ink); outline-offset: 2px; }
.cp2-tab-pill {
position: absolute;
inset: 0;
z-index: 0;
border-radius: inherit;
background: var(--card);
box-shadow: var(--shadow-sm, 0 1px 2px oklch(from var(--cp2-shadow) l c h / 0.25));
}
.cp2-tab-label, .cp2-tab-count { position: relative; z-index: 1; }
.cp2-tab-count {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 24px;
height: 24px;
padding: 0 8px;
border-radius: 999px;
font-size: 14px;
font-weight: 800;
font-variant-numeric: tabular-nums;
background: oklch(from var(--band-ink) l c h / 0.14);
}
.cp2-tab[aria-selected='true'] .cp2-tab-count { background: color-mix(in oklch, var(--ink) 8%, var(--card)); }
.cp2-scroll {
overflow-x: auto;
overscroll-behavior-x: contain;
margin: -12px -4px 0;
padding: 12px 4px 16px;
border-radius: 8px;
scroll-snap-type: x proximity;
scrollbar-width: thin;
scrollbar-color: oklch(from var(--band-ink) l c h / 0.3) transparent;
}
.cp2-scroll:focus-visible { outline: 2px solid var(--band-ink); outline-offset: 4px; }
.cp2-track {
position: relative;
display: flex;
align-items: flex-start;
gap: var(--gap);
width: max-content;
min-width: 100%;
margin: 0;
padding: 0;
list-style: none;
}
.cp2-track::before {
content: '';
position: absolute;
left: -4px;
right: -4px;
top: calc(var(--cw) * 4 / 3 - 4px);
height: 14px;
border-radius: 4px;
background: oklch(from var(--band) calc(l + 0.09) c h);
box-shadow: inset 0 1px 0 oklch(from var(--band-ink) l c h / 0.18), 0 1px 2px oklch(from var(--cp2-shadow) calc(l - 0.08) c h / 0.5), 0 10px 14px -6px oklch(from var(--cp2-shadow) calc(l - 0.08) c h / 0.6);
}
.cp2-item { position: relative; z-index: 1; flex: 0 0 auto; width: var(--cw); scroll-snap-align: start; }
.cp2-item--up { width: var(--cw-up); }
.cp2-cover {
display: block;
width: 100%;
padding: 0;
border: 0;
border-radius: 10px;
background: none;
color: inherit;
font: inherit;
text-align: left;
text-decoration: none;
cursor: pointer;
}
.cp2-cover:focus-visible { outline: 2px solid var(--band-ink); outline-offset: 4px; }
.cp2-frame {
position: relative;
display: block;
width: 100%;
height: calc(var(--cw) * 4 / 3);
border-radius: 8px;
overflow: hidden;
background: oklch(from var(--band) calc(l + 0.06) c h);
filter: drop-shadow(0 2px 3px oklch(from var(--cp2-shadow) calc(l - 0.08) c h / 0.45)) drop-shadow(0 10px 12px oklch(from var(--cp2-shadow) calc(l - 0.08) c h / 0.35));
transition: transform 0.16s ease, filter 0.16s ease;
}
.cp2-frame img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.cp2-cover:hover .cp2-frame,
.cp2--hover .cp2-item:first-child .cp2-cover .cp2-frame {
transform: translateY(-6px);
filter: drop-shadow(0 3px 3px oklch(from var(--cp2-shadow) calc(l - 0.08) c h / 0.5)) drop-shadow(0 16px 14px oklch(from var(--cp2-shadow) calc(l - 0.08) c h / 0.45));
}
.cp2-cover:active .cp2-frame,
.cp2--active .cp2-item:first-child .cp2-cover .cp2-frame { transform: translateY(-2px); }
.cp2-title {
display: block;
margin-top: 24px;
font-size: 17px;
font-weight: 700;
line-height: 1.3;
text-wrap: pretty;
color: var(--band-ink);
}
.cp2-cover:hover .cp2-title,
.cp2--hover .cp2-item:first-child .cp2-title {
text-decoration: underline;
text-decoration-color: oklch(from var(--band-ink) l c h / 0.5);
text-underline-offset: 0.18em;
}
.cp2-status {
display: flex;
align-items: center;
gap: 8px;
margin-top: 8px !important;
font-size: 15px;
font-weight: 600;
line-height: 1.4;
color: color-mix(in oklch, var(--band-ink) 82%, var(--band));
}
.cp2-badge {
flex: 0 0 auto;
display: inline-flex;
align-items: center;
justify-content: center;
width: 20px;
height: 20px;
border-radius: 999px;
background: var(--success);
color: oklch(from var(--success) 1 0 h);
}
.cp2-mini {
flex: 0 0 56px;
height: 6px;
border-radius: 999px;
overflow: hidden;
background: oklch(from var(--band-ink) l c h / 0.18);
}
.cp2-mini > span { display: block; height: 100%; border-radius: inherit; background: var(--accent-fill, var(--accent)); }
.cp2-frame--muted img { filter: grayscale(1); opacity: 0.5; }
.cp2-plus { position: absolute; inset: 0; display: grid; place-items: center; }
.cp2-plus-disc {
display: grid;
place-items: center;
width: 44px;
height: 44px;
border-radius: 999px;
background: var(--card);
color: var(--ink);
box-shadow: var(--shadow-md, 0 1px 2px oklch(from var(--cp2-shadow) l c h / 0.22), 0 4px 10px -2px oklch(from var(--cp2-shadow) l c h / 0.2));
}
.cp2-up-flag {
margin-top: 24px !important;
font-size: 14px;
font-weight: 800;
line-height: 1.2;
letter-spacing: 0.08em;
text-transform: uppercase;
color: color-mix(in oklch, var(--band-ink) 82%, var(--band));
}
.cp2-up-title { margin-top: 8px !important; font-family: var(--font-body); font-size: 17px; font-weight: 700; line-height: 1.3; text-wrap: pretty; color: var(--band-ink); }
.cp2-value { margin-top: 12px; }
.cp2-value-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.cp2-value-label { font-size: 15px; font-weight: 600; color: color-mix(in oklch, var(--band-ink) 82%, var(--band)); }
.cp2-value-amt {
font-family: var(--font-display);
font-weight: 800;
font-size: clamp(1.3125rem, 1.8vw, 1.625rem);
line-height: 1.15;
font-variant-numeric: tabular-nums;
color: var(--band-ink);
}
.cp2-value-turn { margin-top: 4px !important; font-size: 15px; font-style: italic; font-weight: 500; line-height: 1.4; color: color-mix(in oklch, var(--band-ink) 82%, var(--band)); }
.cp2-today { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; margin-top: 8px !important; }
.cp2-today-amt {
font-family: var(--font-display);
font-weight: 800;
letter-spacing: -0.03em;
font-size: clamp(2.5rem, 4.2vw, 3.75rem);
line-height: 1;
font-variant-numeric: tabular-nums;
color: var(--band-ink);
}
.cp2-today-label { font-size: 15px; font-weight: 700; color: var(--band-ink); }
.cp2-btn--sm { width: 100%; min-width: 0; min-height: 52px; margin-top: 16px; padding: 0 16px; font-size: 17px; }
.cp2-btn--sm:focus-visible { outline-color: var(--band-ink); }
.cp2-up-note { margin-top: 12px !important; font-size: 14px; font-weight: 600; line-height: 1.4; text-wrap: pretty; color: color-mix(in oklch, var(--band-ink) 82%, var(--band)); }
.cp2-up-row { display: none; }
.cp2-inline-icon { display: inline-block; vertical-align: -0.15em; margin-inline-end: 0.4em; }
.cp2-empty {
position: relative;
z-index: 1;
flex: 0 0 auto;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 12px;
width: 320px;
height: calc(var(--cw) * 4 / 3);
padding: 20px 24px;
border-radius: 8px;
background: oklch(from var(--band-ink) l c h / 0.06);
border: 1px solid oklch(from var(--band-ink) l c h / 0.16);
font-size: 15px;
font-weight: 500;
line-height: 1.4;
text-align: center;
text-wrap: pretty;
color: var(--band-ink);
}
@media (max-width: 720px) {
.cf-customer-portal-2 { --cw: 148px; --cw-up: 200px; --gap: 16px; }
.cp2-feature { grid-template-columns: minmax(0, 1fr); gap: 20px; }
.cp2-feature-media { aspect-ratio: 16 / 10; }
.cp2-up--shelf { display: none; }
.cp2-up-row {
display: grid;
grid-template-columns: 96px minmax(0, 1fr);
column-gap: 16px;
align-items: start;
margin-top: 24px;
padding: 20px;
border-radius: var(--card-radius, var(--radius, 14px));
background: oklch(from var(--band-ink) l c h / 0.06);
border: 1px solid oklch(from var(--band-ink) l c h / 0.16);
}
.cp2-up-row .cp2-frame { height: auto; aspect-ratio: 3 / 4; }
.cp2-up-row .cp2-plus-disc { width: 40px; height: 40px; }
.cp2-up-row .cp2-up-flag { margin-top: 0 !important; }
.cp2-up-row .cp2-btn--sm { grid-column: 1 / -1; min-height: 56px; margin-top: 20px; font-size: 18px; }
.cp2-up-row .cp2-up-note { grid-column: 1 / -1; text-align: center; }
.cp2-tabs { display: flex; width: 100%; }
.cp2-tab { flex: 1 1 0; padding: 0 8px; }
.cp2-scroll {
margin-inline: calc(-1 * var(--cp2-gutter));
padding-inline: var(--cp2-gutter);
scroll-padding-inline: var(--cp2-gutter);
border-radius: 0;
}
.cp2-empty { width: 260px; }
}
@media (max-width: 480px) {
.cp2-tab-count { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
.cp2-item { animation: cp2-rise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.cp2-bar-fill { animation: cp2-fill 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) 0.15s both; }
}
@media (prefers-reduced-motion: reduce) {
.cp2-frame, .cp2-btn, .cp2-tab { transition: none; }
}
@keyframes cp2-rise { from { opacity: 0.82; transform: translateY(8px); } }
@keyframes cp2-fill { from { transform: scaleX(0); } }
`;
pieces/checkout/customer-portal-2/specimen.tsx 86 lines
import __studioImage0dc15852 from "../assets/520226db1032d1d6.webp";
import __studioImage4a42c818 from "../assets/5f905162abd95735.webp";
import __studioImagec9b0d0af from "../assets/d6e9f85692558601.webp";
import * as React from "react";
import defaults from "../../studio-defaults.json";
import { slot } from "../../slots";
import studio from "../../fx/backdrops/studio";
import tabletop from "../../fx/backdrops/tabletop";
import light from "../../fx/backdrops/light";
import { CustomerPortal2 } from "../customer-portal-2";
export const states = ["default", "hover", "active", "disabled"];
type SpecimenState = "default" | "hover" | "active" | "disabled";
export default function CustomerPortal2Specimen({ state = "default" }: { state?: SpecimenState }) {
const sample = defaults.sample;
return (
<CustomerPortal2
state={state}
customerName="Jordan"
featured={{
id: "portrait-lighting",
title: "Portrait Lighting Essentials",
image: slot(
"item-1",
__studioImage0dc15852
),
imageAlt: "Photographer's camera framing a portrait lit by one large softbox",
progress: 62,
lessonsDone: 3,
lessonsTotal: 6,
nextLesson: "Lesson 4 · Shape soft light with one window",
}}
actionLabel="Continue lesson 4"
courses={[
{
id: "natural-light",
title: "Natural Light Portraits",
image: slot(
"item-2",
__studioImage4a42c818
),
imageAlt: "Man lit by golden window light",
progress: 100,
lessonsTotal: 8,
},
{
id: "product-home",
title: "Product Photography at Home",
image: slot(
"item-3",
__studioImagec9b0d0af
),
imageAlt: "Coffee mug styled on a kitchen table with a reflector",
progress: 35,
lessonsTotal: 7,
},
{
id: "strobes-101",
title: "Studio Strobes 101",
image: slot("item-4", studio),
imageAlt: "Photo studio with lighting stands",
progress: 0,
lessonsTotal: 9,
},
{
id: "tabletop",
title: "Food & Tabletop Light",
image: slot("item-5", tabletop),
imageAlt: "Styled tabletop scene",
progress: 100,
lessonsTotal: 6,
},
]}
upgrade={{
title: "Pro Retouching Workflow",
image: slot("item-6", light),
imageAlt: "Soft light across a studio wall",
value: sample.regularPrice,
price: sample.price,
note: sample.guarantee,
}}
/>
);
}
| Name | Type | Details |
|---|---|---|
headline OptionalCustomerPortal2 |
string |
|
lead OptionalCustomerPortal2 |
string |
|
customerName OptionalCustomerPortal2 |
string |
|
featured OptionalCustomerPortal2 |
ShelfFeatured |
|
courses OptionalCustomerPortal2 |
ShelfCourse[] |
|
upgrade OptionalCustomerPortal2 |
ShelfUpgrade |
|
defaultTab OptionalCustomerPortal2 |
ShelfTab |
|
actionLabel OptionalCustomerPortal2 |
string |
|
continueHref OptionalCustomerPortal2 |
string |
|
onContinue OptionalCustomerPortal2 |
(course: ShelfFeatured) => void |
|
actionDisabled OptionalCustomerPortal2 |
boolean |
|
secondaryLabel OptionalCustomerPortal2 |
string |
|
secondaryHref OptionalCustomerPortal2 |
string |
|
onSecondary OptionalCustomerPortal2 |
(course: ShelfFeatured) => void |
|
onOpen OptionalCustomerPortal2 |
(course: ShelfCourse, index: number) => void |
|
onAction OptionalCustomerPortal2 |
(upgrade: ShelfUpgrade) => void |
|
upgradeDisabled OptionalCustomerPortal2 |
boolean |
|
copy OptionalCustomerPortal2 |
CustomerPortal2CopyInput |
|
state OptionalCustomerPortal2 |
"default" | "hover" | "active" | "disabled" |
|
className OptionalCustomerPortal2 |
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-ink--button-2-shadow- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field-focus- Form inputs: background, ink, border, radius and focus colour.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
item-1- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-2- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-3- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-4- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-5- One image per offer item (item-1, item-2…), shown in stacks and lists.
item-6- One image per offer item (item-1, item-2…), shown in stacks and lists.
-
520226db1032d1d6.webp
image/webp · 34.5 KB
-
5f905162abd95735.webp
image/webp · 37.9 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
bec2a41897a3364d.webp
image/webp · 51.2 KB
-
c18141ad9dda999d.webp
image/webp · 14.4 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
d6e9f85692558601.webp
image/webp · 62.8 KB
-
e0015f5afe2d03e2.webp
image/webp · 29.5 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB
-
f6dd01ecec4a2c0e.webp
image/webp · 105 KB