Streak Recovery 1
Streak recovery card: names the missed day, shows the points still waiting in the challenge ledger and the next milestone,
Use it in a prompt
Use content/streak-recovery 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/streak-recovery.tsx. - Import it and pass your copy and images (Props tab):
import { StreakRecovery } from "@/components/funneldna/content/streak-recovery"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/content/streak-recovery/component.tsx 480 lines
// layout: scroll-panels
// Streak recovery card: names the missed day, shows the points still waiting in the challenge ledger and the next milestone,
// then one big catch-up button, so a participant who slips comes back instead of dropping out of the challenge.
import * as React from "react";
import { CalendarCheck2, CalendarX2, Check, Clock3, Trophy, X } from "lucide-react";
import { BackdropVideo, FX_HOST, Spot } from "../fx/fx";
import sweep from "../fx/loops/sweep";
import clock from "../fx/spots/clock";
import star from "../fx/spots/star";
export type StreakStatus = "behind" | "on-track" | "complete";
export type StreakRow = {
day: string;
task: string;
points: number;
/** Minutes the lesson takes; shown for the missed or next day. */
minutes?: number;
/** done earns its points; missed is the day to recover; today is next; upcoming is still ahead. */
state: "done" | "missed" | "today" | "upcoming";
};
/** Copy for one status. Placeholders: {day} {title} {minutes} {points} {done} {count} {total} {remaining} {after} {milestone} {goal}. */
export type StreakStatusCopy = {
chip: string;
headline: string;
lead: string;
seam: string;
seamExtra: string;
ledgerTitle: string;
label: string;
note: string;
};
/** Ledger and milestone copy. Same placeholders; row hints use {points}. */
export type StreakLedgerCopy = {
day: string;
task: string;
earned: string;
total: string;
/** Earned cell for a done row; {points}. */
plus: string;
dash: string;
notYet: string;
missedHint: string;
todayHint: string;
statusDone: string;
statusMissed: string;
statusToday: string;
statusUpcoming: string;
totalLabel: string;
unit: string;
goal: string;
goalReached: string;
goalHint: string;
scaleNow: string;
scaleGoal: string;
};
export type StreakRecoveryProps = {
/** Defaults to what the rows say: any missed day is behind, every day done is complete. */
status?: StreakStatus;
rows?: StreakRow[];
/** The next reward and the points it needs. */
milestone?: { label: string; points: number };
/** Used when the focus row has no minutes. */
defaultMinutes?: number;
copy?: { [K in StreakStatus]?: Partial<StreakStatusCopy> } & { ledger?: Partial<StreakLedgerCopy> };
href?: string;
onAction?: (status: StreakStatus) => void;
disabled?: boolean;
state?: "default" | "hover" | "active" | "disabled";
/** fx Spot asset overhanging the stage edge; defaults to clock (star when complete). */
spotImage?: string;
/** fx loop behind the dark stage. */
backdropLoop?: typeof sweep;
className?: string;
};
const DEFAULT_ROWS: StreakRow[] = [
{ day: "Day 1", task: "Watch the opening lesson", points: 20, state: "done" },
{ day: "Day 2", task: "Complete the Day 2 task", points: 20, state: "done" },
{ day: "Day 3", task: "Complete the Day 3 task", points: 20, minutes: 20, state: "missed" },
{ day: "Day 4", task: "Today’s lesson", points: 20, minutes: 20, state: "today" },
{ day: "Day 5", task: "The final lesson", points: 20, state: "upcoming" },
];
const DEFAULT_MILESTONE = { label: "your next milestone", points: 80 };
const DEFAULT_COPY: Record<StreakStatus, StreakStatusCopy> = {
behind: {
chip: "{day} missed",
headline: "Fell behind? Catch up on {day} in {minutes} minutes.",
lead: "“{title}” is one short lesson. Finish it tonight and you’re right back on pace.",
seam: "+{points} points waiting",
seamExtra: "until you finish {day}",
ledgerTitle: "{total} points banked. {day} adds {points} more.",
label: "Yes! Catch me up on {day}",
note: "Takes about {minutes} minutes",
},
"on-track": {
chip: "On pace · {done} of {count} days",
headline: "You’re on pace. {day} is ready when you are.",
lead: "“{title}” takes about {minutes} minutes. Do it today and keep your streak alive.",
seam: "+{points} points today",
seamExtra: "when you finish {day}",
ledgerTitle: "{total} points banked. Keep stacking.",
label: "Yes! Start {day} now",
note: "Takes about {minutes} minutes",
},
complete: {
chip: "All {count} days done",
headline: "You finished every day. Here’s your next step.",
lead: "You showed up for the whole challenge. Keep the momentum going while it’s fresh.",
seam: "{total} points earned",
seamExtra: "{done} of {count} days done",
ledgerTitle: "Every day done: {total} points",
label: "Yes! Show me my next step",
note: "Opens your next step",
},
};
const DEFAULT_LEDGER: StreakLedgerCopy = {
day: "Day",
task: "Task",
earned: "Earned",
total: "Total",
plus: "+{points}",
dash: "–",
notYet: "Not earned yet",
missedHint: "Catch up for +{points}",
todayHint: "Up next · +{points}",
statusDone: "Done",
statusMissed: "Missed",
statusToday: "Up next",
statusUpcoming: "Coming up",
totalLabel: "Your total",
unit: "pts",
goal: "{remaining} points to {milestone}",
goalReached: "You reached {milestone}",
goalHint: "{day} alone moves you to {after} points.",
scaleNow: "{total} now",
scaleGoal: "{goal} to unlock",
};
const STATUS_ICON = { behind: CalendarX2, "on-track": CalendarCheck2, complete: Trophy } as const;
export function StreakRecovery(props: StreakRecoveryProps) {
const {
rows = DEFAULT_ROWS,
milestone = DEFAULT_MILESTONE,
defaultMinutes = 20,
copy,
href,
onAction,
disabled = false,
state = "default",
spotImage,
backdropLoop = sweep,
className,
} = props;
const uid = React.useId();
const headId = `${uid}-head`;
const ledgerId = `${uid}-ledger`;
let running = 0;
const totals = rows.map((row) => {
if (row.state === "done") running += row.points;
return running;
});
const total = running;
const count = rows.length;
const done = rows.filter((row) => row.state === "done").length;
const derived: StreakStatus = rows.some((row) => row.state === "missed")
? "behind"
: count > 0 && done === count
? "complete"
: "on-track";
const status: StreakStatus = props.status ?? derived;
const focus =
status === "behind"
? rows.find((row) => row.state === "missed")
: status === "on-track"
? rows.find((row) => row.state === "today") ?? rows.find((row) => row.state !== "done")
: undefined;
const t: StreakStatusCopy = { ...DEFAULT_COPY[status], ...copy?.[status] };
const l: StreakLedgerCopy = { ...DEFAULT_LEDGER, ...copy?.ledger };
const gain = status === "behind" && focus ? focus.points : 0;
const reached = total >= milestone.points;
const values: Record<string, string | number> = {
day: focus?.day ?? "",
title: focus?.task ?? "",
minutes: focus?.minutes ?? defaultMinutes,
points: focus?.points ?? 0,
done,
count,
total,
remaining: Math.max(milestone.points - total, 0),
after: total + gain,
milestone: milestone.label,
goal: milestone.points,
};
const goal = Math.max(milestone.points, 1);
const nowPct = Math.min(total / goal, 1) * 100;
const afterPct = Math.min((total + gain) / goal, 1) * 100;
const goalLine = fill(reached ? l.goalReached : l.goal, values);
const ChipIcon = STATUS_ICON[status];
const NoteIcon = status === "complete" ? Trophy : Clock3;
const spotSrc = spotImage ?? (status === "complete" ? star : clock);
const isDisabled = disabled || state === "disabled";
const ctaClass = ["sr-cta", state === "hover" ? "is-hover" : "", state === "active" ? "is-active" : ""]
.filter(Boolean)
.join(" ");
const label = fill(t.label, values);
const statusLabel = { done: l.statusDone, missed: l.statusMissed, today: l.statusToday, upcoming: l.statusUpcoming };
const rootClass = ["cf-streak-recovery", `is-${status}`, className].filter(Boolean).join(" ");
return (
<section className={rootClass} aria-labelledby={headId}>
<style>{CSS}</style>
<div className="sr-stage sr-in" style={{ ...FX_HOST, "--i": 0 } as React.CSSProperties}>
<BackdropVideo video={backdropLoop} treatment="scrim-dark" />
<div className="sr-stage-copy">
<p className="sr-chip">
<ChipIcon size={16} strokeWidth={2.5} aria-hidden="true" />
{fill(t.chip, values)}
</p>
<h2 id={headId} className="sr-headline">
{fill(t.headline, values)}
</h2>
<p className="sr-lead">{fill(t.lead, values)}</p>
</div>
</div>
<div className="sr-seam sr-in" style={{ "--i": 1 } as React.CSSProperties}>
<span className="sr-spot" aria-hidden="true">
<Spot src={spotSrc} size={84} />
</span>
<span className="sr-seam-main">{fill(t.seam, values)}</span>
<span className="sr-seam-extra">{fill(t.seamExtra, values)}</span>
</div>
<div className="sr-ledger sr-in" style={{ "--i": 2 } as React.CSSProperties}>
<h3 id={ledgerId} className="sr-ledger-title">
{fill(t.ledgerTitle, values)}
</h3>
<table className="sr-table" role="table" aria-labelledby={ledgerId}>
<colgroup>
<col className="sr-col-day" />
<col />
<col className="sr-col-num" />
<col className="sr-col-num" />
</colgroup>
<thead role="rowgroup">
<tr role="row">
<th scope="col" role="columnheader">
{l.day}
</th>
<th scope="col" role="columnheader">
{l.task}
</th>
<th scope="col" role="columnheader" className="sr-num">
{l.earned}
</th>
<th scope="col" role="columnheader" className="sr-num">
{l.total}
</th>
</tr>
</thead>
<tbody role="rowgroup">
{rows.map((row, i) => {
const counted = row.state === "done" || row.state === "missed";
return (
<tr key={`${row.day}-${i}`} role="row" className={`is-${row.state}`}>
<th scope="row" role="rowheader">
<span className="sr-day">
<span className={`sr-badge is-${row.state}`} aria-hidden="true">
{row.state === "done" ? <Check size={14} strokeWidth={3} /> : null}
{row.state === "missed" ? <X size={14} strokeWidth={3} /> : null}
</span>
<span>{row.day}</span>
<span className="sr-only">{statusLabel[row.state]}</span>
</span>
</th>
<td role="cell" className="sr-task-cell">
<span className="sr-task">{row.task}</span>
{row.state === "missed" ? (
<span className="sr-hint is-missed">{fill(l.missedHint, { points: row.points })}</span>
) : null}
{row.state === "today" && status !== "complete" ? (
<span className="sr-hint is-today">{fill(l.todayHint, { points: row.points })}</span>
) : null}
</td>
<td role="cell" className="sr-num sr-earned" data-label={l.earned}>
{row.state === "done" ? (
fill(l.plus, { points: row.points })
) : row.state === "missed" ? (
"0"
) : (
<Dash dash={l.dash} label={l.notYet} />
)}
</td>
<td role="cell" className="sr-num sr-run" data-label={l.total}>
{counted ? totals[i] : <Dash dash={l.dash} label={l.notYet} />}
</td>
</tr>
);
})}
</tbody>
</table>
<p className="sr-total">
<span className="sr-total-label">{l.totalLabel}</span>
<span>
<span className="sr-total-num">{total}</span>
<span className="sr-total-unit">{l.unit}</span>
</span>
</p>
<div className="sr-goal">
<p className="sr-goal-line">
<Trophy className="sr-inline-icon" size={18} strokeWidth={2.5} aria-hidden="true" />
{goalLine}
</p>
<div
className="sr-bar"
role="progressbar"
aria-valuemin={0}
aria-valuemax={milestone.points}
aria-valuenow={Math.min(total, milestone.points)}
aria-label={goalLine}
>
{gain > 0 && !reached ? <span className="sr-bar-ghost" style={{ width: `${afterPct}%` }} /> : null}
<span className="sr-bar-fill" style={{ width: `${nowPct}%` }} />
</div>
<p className="sr-scale">
<span>{fill(l.scaleNow, values)}</span>
<span>{fill(l.scaleGoal, values)}</span>
</p>
{status === "behind" && gain > 0 && !reached ? (
<p className="sr-goal-hint">{fill(l.goalHint, values)}</p>
) : null}
</div>
</div>
<div className="sr-action sr-in" style={{ "--i": 3 } as React.CSSProperties}>
{href && !isDisabled ? (
<a className={ctaClass} href={href} onClick={onAction ? () => onAction(status) : undefined}>
{label}
</a>
) : (
<button type="button" className={ctaClass} disabled={isDisabled} onClick={() => onAction?.(status)}>
{label}
</button>
)}
<p className="sr-note">
<NoteIcon className="sr-inline-icon" size={16} strokeWidth={2.5} aria-hidden="true" />
{fill(t.note, values)}
</p>
</div>
</section>
);
}
export default StreakRecovery;
function Dash({ dash, label }: { dash: string; label: string }) {
return (
<>
<span aria-hidden="true">{dash}</span>
<span className="sr-only">{label}</span>
</>
);
}
function fill(text: string, values: Record<string, string | number>) {
return text.replace(/[{]([a-zA-Z]+)[}]/g, (match, key: string) => (key in values ? String(values[key]) : match));
}
const CSS = `
.cf-streak-recovery{--sr-pad:clamp(20px,6cqi,32px);--sr-spot:84px;--sr-radius:var(--card-radius,var(--radius,14px));container-type:inline-size;position:relative;box-sizing:border-box;width:100%;max-width:var(--streak-recovery-width,480px);margin-inline:auto;background:var(--card,#ffffff);color:var(--ink);font-family:var(--font-body);border:1px solid var(--card-border,oklch(from var(--ink) l c h / 0.12));border-radius:var(--sr-radius);box-shadow:var(--card-shadow,var(--shadow-md,0 1px 2px oklch(0.22 0.03 256 / 0.22),0 4px 10px -2px oklch(0.22 0.03 256 / 0.2)))}
.cf-streak-recovery *,.cf-streak-recovery *::before,.cf-streak-recovery *::after{box-sizing:border-box}
.cf-streak-recovery :where(h2,h3,p,table){margin:0}
.cf-streak-recovery .sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.cf-streak-recovery .sr-stage{position:relative;isolation:isolate;overflow:hidden;background:var(--band);color:var(--band-ink);border-radius:calc(var(--sr-radius) - 1px) calc(var(--sr-radius) - 1px) 0 0;padding:var(--sr-pad) var(--sr-pad) 64px}
.cf-streak-recovery .sr-stage-copy{position:relative;z-index:1}
.cf-streak-recovery .sr-chip{display:inline-flex;align-items:center;gap:8px;min-height:30px;padding:4px 12px;border-radius:999px;background:oklch(from var(--band-ink) l c h / 0.14);color:var(--band-ink);font-size:0.875rem;font-weight:800;line-height:1.2}
.cf-streak-recovery .sr-chip svg{flex:none}
.cf-streak-recovery .sr-headline{margin-top:16px;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(1.75rem,7.6cqi,2.25rem);line-height:1.06;color:var(--band-ink);text-wrap:balance}
.cf-streak-recovery .sr-lead{margin-top:12px;font-size:1.0625rem;font-weight:500;line-height:1.45;color:var(--band-ink);text-wrap:pretty}
.cf-streak-recovery .sr-seam{position:relative;z-index:2;display:flex;flex-wrap:wrap;align-items:baseline;column-gap:8px;row-gap:2px;min-height:calc(var(--sr-spot) / 2 + 16px);padding:14px var(--sr-pad) 0 calc(var(--sr-pad) + var(--sr-spot) + 14px)}
.cf-streak-recovery .sr-spot{position:absolute;left:var(--sr-pad);top:calc(var(--sr-spot) / -2);display:grid;place-items:center;width:var(--sr-spot);height:var(--sr-spot);pointer-events:none}
.cf-streak-recovery .sr-seam-main{font-family:var(--font-display);font-weight:800;font-size:1.0625rem;line-height:1.3;color:var(--ink)}
.cf-streak-recovery .sr-seam-extra{font-size:0.9375rem;font-weight:600;line-height:1.4;color:var(--muted)}
.cf-streak-recovery .sr-ledger{padding:24px var(--sr-pad) 0}
.cf-streak-recovery .sr-ledger-title{font-family:var(--font-display);font-weight:800;letter-spacing:-0.01em;font-size:1.3125rem;line-height:1.15;color:var(--ink);text-wrap:balance}
.cf-streak-recovery .sr-table{width:100%;margin-top:12px;border-collapse:separate;border-spacing:0;table-layout:fixed;font-size:1rem;line-height:1.3}
.cf-streak-recovery .sr-col-day{width:5.75rem}
.cf-streak-recovery .sr-col-num{width:4.75rem}
.cf-streak-recovery .sr-table thead th{padding:10px 12px;background:color-mix(in oklch,var(--ink) 5%,var(--card));border-bottom:1px solid oklch(from var(--ink) l c h / 0.16);color:var(--ink);font-size:0.875rem;font-weight:800;line-height:1.2;text-align:left;white-space:nowrap}
.cf-streak-recovery .sr-table thead th:first-child{border-top-left-radius:10px}
.cf-streak-recovery .sr-table thead th:last-child{border-top-right-radius:10px}
.cf-streak-recovery .sr-table tbody th,.cf-streak-recovery .sr-table tbody td{padding:12px;border-bottom:1px solid oklch(from var(--ink) l c h / 0.1);vertical-align:top;text-align:left;font-weight:500;color:var(--ink)}
.cf-streak-recovery .sr-table .sr-num{text-align:right;font-variant-numeric:tabular-nums}
.cf-streak-recovery .sr-table tbody td.sr-num{font-weight:700}
.cf-streak-recovery .sr-table tbody td.sr-run{font-weight:800}
.cf-streak-recovery .sr-day{display:flex;flex-wrap:wrap;align-items:center;gap:6px;min-height:22px;font-size:0.9375rem;font-weight:800;white-space:nowrap}
.cf-streak-recovery .sr-badge{flex:none;display:inline-grid;place-items:center;width:22px;height:22px;border-radius:999px;color:var(--status-glyph,#ffffff)}
.cf-streak-recovery .sr-badge.is-done{background:var(--success)}
.cf-streak-recovery .sr-badge.is-missed{background:var(--danger)}
.cf-streak-recovery .sr-badge.is-today{box-shadow:inset 0 0 0 2px var(--accent)}
.cf-streak-recovery .sr-badge.is-upcoming{box-shadow:inset 0 0 0 2px oklch(from var(--ink) l c h / 0.28)}
.cf-streak-recovery .sr-table tr.is-missed > *{background:var(--danger-soft)}
.cf-streak-recovery .sr-table tr.is-done td.sr-num:not(.sr-run){color:var(--success)}
.cf-streak-recovery .sr-table tr.is-today td.sr-num,.cf-streak-recovery .sr-table tr.is-upcoming td.sr-num{color:var(--muted);font-weight:600}
.cf-streak-recovery .sr-table tr.is-upcoming .sr-task,.cf-streak-recovery .sr-table tr.is-upcoming .sr-day{color:var(--muted)}
.cf-streak-recovery .sr-task{display:block;overflow-wrap:anywhere;text-wrap:pretty}
.cf-streak-recovery .sr-hint{display:block;margin-top:4px;font-size:0.9375rem;font-weight:700;line-height:1.3;text-wrap:pretty}
.cf-streak-recovery .sr-hint.is-missed{color:var(--danger)}
.cf-streak-recovery .sr-hint.is-today{color:var(--accent)}
.cf-streak-recovery .sr-total{display:flex;align-items:baseline;justify-content:space-between;gap:12px;margin-top:20px}
.cf-streak-recovery .sr-total-label{font-size:0.9375rem;font-weight:700;color:var(--muted)}
.cf-streak-recovery .sr-total-num{font-family:var(--font-display);font-weight:var(--display-weight,800);font-size:2.5rem;line-height:1;letter-spacing:-0.03em;font-variant-numeric:tabular-nums;color:var(--ink)}
.cf-streak-recovery .sr-total-unit{margin-left:6px;font-size:1.0625rem;font-weight:700;color:var(--muted)}
.cf-streak-recovery .sr-goal{margin-top:16px}
.cf-streak-recovery .sr-goal-line{font-size:1.0625rem;font-weight:700;line-height:1.35;color:var(--ink);text-wrap:pretty}
.cf-streak-recovery .sr-inline-icon{display:inline-block;vertical-align:-0.15em;margin-inline-end:0.4em;color:var(--accent)}
.cf-streak-recovery.is-complete .sr-goal-line .sr-inline-icon{color:var(--success)}
.cf-streak-recovery .sr-bar{position:relative;height:12px;margin-top:12px;border-radius:999px;background:color-mix(in oklch,var(--ink) 9%,var(--card));overflow:hidden}
.cf-streak-recovery .sr-bar > span{position:absolute;inset:0 auto 0 0;border-radius:inherit;transform-origin:left center}
.cf-streak-recovery .sr-bar-ghost{background:oklch(from var(--accent-fill,var(--accent)) l c h / 0.4)}
.cf-streak-recovery .sr-bar-fill{background:linear-gradient(90deg,oklch(from var(--accent-fill,var(--accent)) calc(l + 0.06) c h),var(--accent-fill,var(--accent)))}
.cf-streak-recovery.is-complete .sr-bar-fill{background:var(--success)}
.cf-streak-recovery .sr-scale{display:flex;justify-content:space-between;gap:12px;margin-top:8px;font-size:0.9375rem;font-weight:600;line-height:1.4;color:var(--muted);font-variant-numeric:tabular-nums}
.cf-streak-recovery .sr-goal-hint{margin-top:8px;font-size:0.9375rem;font-weight:600;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-streak-recovery .sr-action{padding:28px var(--sr-pad) var(--sr-pad)}
.cf-streak-recovery .sr-cta{--sr-bg:var(--button-bg,var(--cta));--sr-sh:var(--shadow,oklch(0.22 0.03 256));display:flex;align-items:center;justify-content:center;width:100%;min-height:64px;padding:12px 24px;border:0;border-radius:var(--button-radius,var(--radius,12px));background:linear-gradient(oklch(from var(--sr-bg) calc(l + 0.04) c h),var(--button-bg-2,oklch(from var(--sr-bg) calc(l - 0.02) c h)));color:var(--button-ink,var(--cta-ink));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,4.6cqi,1.25rem);line-height:1.15;text-align:center;text-decoration:none;text-shadow:var(--button-text-shadow,none);text-wrap:balance;cursor:pointer;box-shadow:var(--button-shadow,inset 0 1px 0 oklch(from var(--sr-bg) calc(l + 0.14) c h / 0.7),inset 0 -3px 0 oklch(from var(--sr-bg) calc(l - 0.16) c h),0 1px 2px oklch(from var(--sr-sh) l c h / 0.3),0 8px 16px -6px oklch(from var(--sr-sh) l c h / 0.45));transition:background .16s ease,box-shadow .16s ease,transform .16s ease;-webkit-tap-highlight-color:transparent}
.cf-streak-recovery .sr-cta:not(:disabled):hover,.cf-streak-recovery .sr-cta.is-hover{background:linear-gradient(oklch(from var(--sr-bg) calc(l - 0.01) c h),oklch(from var(--sr-bg) calc(l - 0.07) c h));box-shadow:inset 0 1px 0 oklch(from var(--sr-bg) calc(l + 0.1) c h / 0.7),inset 0 -3px 0 oklch(from var(--sr-bg) calc(l - 0.2) c h),0 1px 2px oklch(from var(--sr-sh) l c h / 0.32),0 10px 18px -6px oklch(from var(--sr-sh) l c h / 0.55)}
.cf-streak-recovery .sr-cta:not(:disabled):active,.cf-streak-recovery .sr-cta.is-active{transform:translateY(1px);background:linear-gradient(oklch(from var(--sr-bg) calc(l - 0.06) c h),oklch(from var(--sr-bg) calc(l - 0.1) c h));box-shadow:inset 0 2px 4px oklch(from var(--sr-sh) l c h / 0.35),inset 0 -2px 0 oklch(from var(--sr-bg) calc(l - 0.2) c h),0 1px 2px oklch(from var(--sr-sh) l c h / 0.3)}
.cf-streak-recovery .sr-cta:focus-visible{outline:3px solid oklch(from var(--field-focus,var(--accent)) l c h / 0.6);outline-offset:3px}
.cf-streak-recovery .sr-cta: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}
.cf-streak-recovery .sr-note{margin-top:12px;text-align:center;font-size:0.9375rem;font-weight:600;line-height:1.4;color:var(--muted);text-wrap:pretty}
.cf-streak-recovery .sr-note .sr-inline-icon{color:var(--muted)}
@container (max-width: 420px){
.cf-streak-recovery .sr-table,.cf-streak-recovery .sr-table tbody{display:block}
.cf-streak-recovery .sr-table colgroup,.cf-streak-recovery .sr-table thead{display:none}
.cf-streak-recovery .sr-table tbody tr{display:grid;grid-template-columns:minmax(0,1fr) auto auto;grid-template-areas:"day earned total" "task earned total";column-gap:16px;row-gap:4px;padding:12px;border-bottom:1px solid oklch(from var(--ink) l c h / 0.1)}
.cf-streak-recovery .sr-table tbody tr:first-child{border-top:1px solid oklch(from var(--ink) l c h / 0.16)}
.cf-streak-recovery .sr-table tbody th,.cf-streak-recovery .sr-table tbody td,.cf-streak-recovery .sr-table tr.is-missed > *{padding:0;border:0;background:none}
.cf-streak-recovery .sr-table tbody th{grid-area:day}
.cf-streak-recovery .sr-table tbody td.sr-task-cell{grid-area:task;padding-left:28px}
.cf-streak-recovery .sr-table tbody td.sr-earned{grid-area:earned}
.cf-streak-recovery .sr-table tbody td.sr-run{grid-area:total}
.cf-streak-recovery .sr-table tbody td.sr-num{display:flex;flex-direction:column;align-items:flex-end;gap:2px;min-width:3.25rem}
.cf-streak-recovery .sr-table tbody td.sr-num::before{content:attr(data-label);font-size:0.875rem;font-weight:700;line-height:1.2;color:var(--muted)}
.cf-streak-recovery .sr-table tbody tr.is-missed{background:var(--danger-soft);border-radius:10px;border-bottom-color:transparent}
.cf-streak-recovery .sr-day{gap:6px}
}
@media (prefers-reduced-motion: no-preference){
.cf-streak-recovery .sr-in{animation:cf-streak-recovery-rise .45s cubic-bezier(.2,.7,.2,1) both;animation-delay:calc(var(--i,0) * .07s)}
.cf-streak-recovery .sr-spot{animation:cf-streak-recovery-pop .3s .2s cubic-bezier(.2,.7,.2,1) both}
.cf-streak-recovery .sr-bar-fill{animation:cf-streak-recovery-fill .7s .3s cubic-bezier(.2,.7,.2,1) both}
}
@keyframes cf-streak-recovery-rise{from{opacity:.82;transform:translateY(8px)}}
@keyframes cf-streak-recovery-pop{from{transform:scale(.9)}}
@keyframes cf-streak-recovery-fill{from{transform:scaleX(0)}}
@media (prefers-reduced-motion: reduce){
.cf-streak-recovery .sr-cta{transition:none}
.cf-streak-recovery .sr-cta:not(:disabled):active,.cf-streak-recovery .sr-cta.is-active{transform:none}
}
`;
pieces/content/streak-recovery/specimen.tsx 35 lines
import { StreakRecovery, type StreakRow, type StreakStatus } from "../streak-recovery";
import defaults from "../../studio-defaults.json";
export const states = ["default", "on-track", "complete", "hover", "active", "disabled"];
const LESSONS = [
{ day: "Day 1", task: "Pick your one offer", minutes: 15 },
{ day: "Day 2", task: "Map your funnel pages", minutes: 20 },
{ day: "Day 3", task: "Write your headline", minutes: 18 },
{ day: "Day 4", task: "Draft your page copy", minutes: 22 },
{ day: "Day 5", task: "Run the launch check", minutes: 15 },
];
const PROGRESS: Record<StreakStatus, StreakRow["state"][]> = {
behind: ["done", "done", "missed", "today", "upcoming"],
"on-track": ["done", "done", "done", "today", "upcoming"],
complete: ["done", "done", "done", "done", "done"],
};
export default function StreakRecoverySpecimen({ state = "default" }: { state?: string }) {
const status: StreakStatus = state === "on-track" || state === "complete" ? state : "behind";
const rows: StreakRow[] = LESSONS.map((lesson, i) => ({ ...lesson, points: 20, state: PROGRESS[status][i] }));
const buttonState = state === "hover" || state === "active" || state === "disabled" ? state : "default";
const bonus = defaults.sample.items[2]?.name ?? "Launch Checklist";
return (
<StreakRecovery
status={status}
rows={rows}
milestone={{ label: `the ${bonus} bonus`, points: 80 }}
state={buttonState}
onAction={() => {}}
/>
);
}
| Name | Type | Details |
|---|---|---|
status OptionalStreakRecovery |
StreakStatus |
|
rows OptionalStreakRecovery |
StreakRow[] |
|
milestone OptionalStreakRecovery |
{ label: string; points: number } |
|
defaultMinutes OptionalStreakRecovery |
number |
|
copy OptionalStreakRecovery |
{ [K in StreakStatus]?: Partial<StreakStatusCopy> } & { ledger?: Partial<StreakLedgerCopy> } |
|
href OptionalStreakRecovery |
string |
|
onAction OptionalStreakRecovery |
(status: StreakStatus) => void |
|
disabled OptionalStreakRecovery |
boolean |
|
state OptionalStreakRecovery |
"default" | "hover" | "active" | "disabled" |
|
spotImage OptionalStreakRecovery |
string |
|
backdropLoop OptionalStreakRecovery |
typeof sweep |
|
className OptionalStreakRecovery |
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.
This piece reads no image slots.
- 3f53d2ed889fcb35.mp4 video/mp4 · 188 KB
-
4b8007624c8cad38.webp
image/webp · 12.9 KB
- 77f5156a8b9c01c4.webm video/webm · 113 KB
-
7c36d7f4dd4ae594.webp
image/webp · 26.5 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB
-
f6a8de367400456e.webp
image/webp · 14.6 KB