Order History 1
Order history as a shipment timeline: past orders newest first, each opening to its items, a status stepper and a one-tap reorder, beside a sticky "your usual" box that turns past orders into the next one.
Use it in a prompt
Use checkout/order-history 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/order-history.tsx. - Import it and pass your copy and images (Props tab):
import { OrderHistory } from "@/components/funneldna/checkout/order-history"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/checkout/order-history/component.tsx 1019 lines
// layout: sticky-offer-side
// Order history as a shipment timeline: past orders newest first, each opening to its items, a status stepper and a one-tap reorder, beside a sticky "your usual" box that turns past orders into the next one.
import * as React from "react";
import { Check, ChevronDown, Truck } from "lucide-react";
import { Spot } from "../fx/fx";
import truck from "../fx/spots/truck";
export type OrderStatus = "ordered" | "shipped" | "delivered";
export type OrderItem = {
/** Stable product id that matches the same product across orders (for "your usual"); falls back to the name. */
sku?: string;
name: string;
/** Size or variant line under the name. */
detail?: string;
quantity?: number;
/** Unit price as display text. */
price?: string;
/** Slot "item-n": product cut-out on a transparent background. */
image?: string;
imageAlt?: string;
/** No longer sold: still listed, but left out of every reorder. */
discontinued?: boolean;
};
export type Order = {
id: string;
number: string;
/** ISO date (YYYY-MM-DD) the order was placed. */
date: string;
/** Order total as display text. */
total: string;
status: OrderStatus;
/** One line above the stepper, e.g. the arrival date the carrier gave. */
statusNote?: string;
/** Display date under each stepper stop. */
stepDates?: Partial<Record<OrderStatus, string>>;
trackingHref?: string;
items: OrderItem[];
};
export type OrderHistoryAction =
| { type: "reorder"; orderId: string; items: OrderItem[] }
| { type: "reorder-usual"; items: OrderItem[] };
export type OrderHistoryCopy = {
/** Placeholder: {number}. */
orderLabel: string;
/** Placeholder: {count}. */
itemCount: string;
itemCountOne: string;
/** Placeholder: {count}. */
quantity: string;
/** Unit price shown when the quantity is above one. Placeholder: {price}. */
each: string;
/** Status chip text. */
status: Record<OrderStatus, string>;
/** Stepper stop labels. */
steps: Record<OrderStatus, string>;
stepsLabel: string;
stepDone: string;
stepTodo: string;
listLabel: string;
track: string;
reorder: string;
/** Button label when every item in the order is discontinued. */
reorderUnavailable: string;
discontinued: string;
skipNote: string;
unavailableNote: string;
usualTitle: string;
/** Placeholder: {count}. */
usualCount: string;
usualCountOne: string;
usualAction: string;
/** Placeholder: {count}. */
usualNote: string;
usualNoteOne: string;
emptyTitle: string;
emptyText: string;
emptyAction: string;
};
export type OrderHistoryCopyInput = Partial<Omit<OrderHistoryCopy, "status" | "steps">> & {
status?: Partial<Record<OrderStatus, string>>;
steps?: Partial<Record<OrderStatus, string>>;
};
export type OrderHistoryProps = {
headline?: string;
/** Phrase inside the headline that gets the marker stroke. */
highlight?: string;
lead?: string;
/** Newest first. An empty list shows the "No orders yet" state. */
orders?: Order[];
/** Order open on load; defaults to the newest. Pass null to start with every order closed. */
defaultOpenId?: string | null;
/** Show the sticky "your usual" box built from the orders. */
showUsual?: boolean;
/** Most products listed in the usual box. */
usualLimit?: number;
/** Shop link in the empty state. */
shopHref?: string;
/** BCP 47 locale for order dates. */
locale?: string;
copy?: OrderHistoryCopyInput;
onAction?: (action: OrderHistoryAction) => void;
state?: "default" | "hover" | "active" | "disabled";
className?: string;
};
const DEFAULT_COPY: OrderHistoryCopy = {
orderLabel: "Order {number}",
itemCount: "{count} items",
itemCountOne: "1 item",
quantity: "Qty {count}",
each: "{price} each",
status: { ordered: "Order placed", shipped: "On its way", delivered: "Delivered" },
steps: { ordered: "Ordered", shipped: "Shipped", delivered: "Delivered" },
stepsLabel: "Delivery progress",
stepDone: "done",
stepTodo: "not yet",
listLabel: "Your orders, newest first",
track: "Track this package",
reorder: "Send it again",
reorderUnavailable: "No longer made",
discontinued: "No longer made",
skipNote: "Items marked “No longer made” stay out of your new order.",
unavailableNote: "Everything in this order has been retired, so it can’t be sent again.",
usualTitle: "Your usual, ready to send",
usualCount: "Ordered {count} times",
usualCountOne: "Ordered once",
usualAction: "Send my usual",
usualNote: "Built from your {count} orders.",
usualNoteOne: "Built from your last order.",
emptyTitle: "No orders yet",
emptyText: "Your orders will show up here, from checkout to your door, ready to send again in one tap.",
emptyAction: "Start shopping",
};
const STEPS: OrderStatus[] = ["ordered", "shipped", "delivered"];
export function OrderHistory(props: OrderHistoryProps) {
const {
headline = "Every order, from checkout to doorstep. Restock in one tap.",
highlight = "Restock in one tap.",
lead = "Open an order to see where it is and what was inside. Running low? Send the same order again from right here.",
orders = [],
defaultOpenId,
showUsual = true,
usualLimit = 3,
shopHref = "#",
locale = "en-US",
copy,
onAction,
state = "default",
className,
} = props;
const c = mergeCopy(copy);
const uid = React.useId();
const [openId, setOpenId] = React.useState<string | null>(
defaultOpenId === undefined ? orders[0]?.id ?? null : defaultOpenId,
);
const fmt = React.useMemo(() => dateFormats(locale), [locale]);
const usual = React.useMemo(
() => (showUsual ? buildUsual(orders, usualLimit) : []),
[orders, showUsual, usualLimit],
);
const root = "cf-order-history" + (className ? " " + className : "");
const locked = state === "disabled";
if (orders.length === 0) {
return (
<section className={root} aria-labelledby={uid + "-empty"}>
<style>{CSS}</style>
<div className="oh-empty">
<div className="oh-empty__spot">
<Spot src={truck} size={112} />
</div>
<h2 id={uid + "-empty"} className="oh-title">
{c.emptyTitle}
</h2>
<p className="oh-lead">{c.emptyText}</p>
<a className="oh-cta oh-cta--auto" href={shopHref}>
{c.emptyAction}
</a>
</div>
</section>
);
}
const firstClosed = orders.find((o) => o.id !== openId)?.id;
const usualImages = usual.filter((u) => u.item.image);
const ctaState = state === "hover" ? " is-hover" : state === "active" ? " is-active" : "";
return (
<section className={root} aria-labelledby={uid + "-title"}>
<style>{CSS}</style>
<div className={"oh-wrap" + (usual.length ? "" : " oh-wrap--solo")}>
<header className="oh-head">
<h2 id={uid + "-title"} className="oh-title">
{markPhrase(headline, highlight)}
</h2>
{lead ? <p className="oh-lead">{lead}</p> : null}
</header>
<ol className="oh-list" aria-label={c.listLabel}>
{orders.map((order, i) => {
const open = order.id === openId;
const status: OrderStatus = STEPS.includes(order.status) ? order.status : "ordered";
const reached = STEPS.indexOf(status);
const sendable = order.items.filter((it) => !it.discontinued);
const retired = order.items.length - sendable.length;
const count = order.items.reduce((n, it) => n + qty(it), 0);
const peek = order.items.filter((it) => it.image).slice(0, 3);
const day = parseISODate(order.date);
const key = uid + "-" + i;
const cardCls = "oh-card" + (state === "hover" && order.id === firstClosed ? " is-hover" : "");
return (
<li
key={order.id}
className={"oh-row" + (open ? " is-open" : "")}
style={{ "--i": String(Math.min(i, 4)) } as React.CSSProperties}
>
<div className="oh-when" aria-hidden="true">
<span className="oh-when__md">{day ? fmt.md.format(day) : order.date}</span>
{day ? <span className="oh-when__y">{fmt.y.format(day)}</span> : null}
</div>
<span className="oh-node" aria-hidden="true" />
<div className={cardCls}>
<h3 className="oh-h">
<button
type="button"
id={key + "-sum"}
className="oh-sum"
aria-expanded={open}
aria-controls={key + "-panel"}
onClick={() => setOpenId(open ? null : order.id)}
>
<span className="oh-sum__date">
<time dateTime={order.date}>{day ? fmt.full.format(day) : order.date}</time>
</span>
<span className="oh-sum__main">
<span className="oh-num" id={key + "-num"}>
{fill(c.orderLabel, { number: order.number })}
</span>
<span className="oh-peek">
{peek.length ? (
<span className="oh-peek__imgs" aria-hidden="true">
{peek.map((it, j) => (
<img
key={j}
className="oh-peek__img"
src={it.image}
alt=""
width={40}
height={40}
loading="lazy"
/>
))}
</span>
) : null}
<span className="oh-peek__count">
{count === 1 ? c.itemCountOne : fill(c.itemCount, { count })}
</span>
</span>
</span>
<span className="oh-sum__total">{order.total}</span>
<span className="oh-chip" data-status={status}>
{c.status[status]}
</span>
<ChevronDown className="oh-chev" size={20} strokeWidth={2.5} aria-hidden="true" />
</button>
</h3>
<div className="oh-panel" id={key + "-panel"} role="region" aria-labelledby={key + "-sum"}>
<div className="oh-panel__clip">
<div className="oh-panel__body">
<div className="oh-track">
{order.statusNote ? (
<p className="oh-track__note">
<Truck size={18} strokeWidth={2.5} aria-hidden="true" />
{order.statusNote}
</p>
) : null}
<ol
className="oh-steps"
aria-label={c.stepsLabel}
style={{ "--p": String(reached / 2) } as React.CSSProperties}
>
{STEPS.map((s, j) => {
const done = j <= reached;
return (
<li
key={s}
className={"oh-step" + (done ? " is-done" : "")}
aria-current={j === reached ? "step" : undefined}
style={{ "--d": (0.18 + j * 0.3).toFixed(2) + "s" } as React.CSSProperties}
>
<span className="oh-dot" aria-hidden="true">
<Check strokeWidth={3} />
</span>
<span className="oh-step__label">
{c.steps[s]}
<span className="oh-sr">{" (" + (done ? c.stepDone : c.stepTodo) + ")"}</span>
</span>
{order.stepDates?.[s] ? (
<span className="oh-step__date">{order.stepDates[s]}</span>
) : null}
</li>
);
})}
</ol>
</div>
<ul className="oh-items">
{order.items.map((it, j) => (
<li key={j} className={"oh-item" + (it.discontinued ? " is-gone" : "")}>
{it.image ? (
<img
className="oh-item__img"
src={it.image}
alt={it.imageAlt ?? ""}
width={72}
height={72}
loading="lazy"
/>
) : (
<span className="oh-item__img" aria-hidden="true" />
)}
<div className="oh-item__text">
<p className="oh-item__name">{it.name}</p>
<p className="oh-item__meta">
{[it.detail, fill(c.quantity, { count: qty(it) })].filter(Boolean).join(" · ")}
</p>
{it.discontinued ? (
<span className="oh-chip oh-chip--gone">{c.discontinued}</span>
) : null}
</div>
{it.price ? (
<span className="oh-item__price">
{qty(it) > 1 ? fill(c.each, { price: it.price }) : it.price}
</span>
) : null}
</li>
))}
</ul>
<div className="oh-actions">
<button
type="button"
className={"oh-cta oh-cta--sm" + (state === "active" && open ? " is-active" : "")}
disabled={locked || sendable.length === 0}
aria-describedby={key + "-num"}
onClick={() => onAction?.({ type: "reorder", orderId: order.id, items: sendable })}
>
{sendable.length === 0 ? c.reorderUnavailable : c.reorder}
</button>
{order.trackingHref ? (
<a className="oh-link" href={order.trackingHref}>
<Truck size={18} strokeWidth={2.5} aria-hidden="true" />
{c.track}
</a>
) : null}
{sendable.length === 0 ? (
<p className="oh-actions__note">{c.unavailableNote}</p>
) : retired > 0 ? (
<p className="oh-actions__note">{c.skipNote}</p>
) : null}
</div>
</div>
</div>
</div>
</div>
</li>
);
})}
</ol>
{usual.length ? (
<aside className={"oh-usual" + (usualImages.length ? " has-fan" : "")} aria-labelledby={uid + "-usual"}>
{usualImages.length ? (
<div className="oh-usual__fan" aria-hidden="true">
{usualImages.map((u) => (
<img key={u.key} className="oh-usual__img" src={u.item.image} alt="" width={160} height={160} />
))}
</div>
) : null}
<h3 id={uid + "-usual"} className="oh-usual__title">
{c.usualTitle}
</h3>
<ul className="oh-usual__list">
{usual.map((u) => (
<li key={u.key} className="oh-usual__row">
<div>
<p className="oh-usual__name">{u.item.name}</p>
<p className="oh-usual__count">
{u.times === 1 ? c.usualCountOne : fill(c.usualCount, { count: u.times })}
</p>
</div>
{u.item.price ? <span className="oh-usual__price">{u.item.price}</span> : null}
</li>
))}
</ul>
<button
type="button"
className={"oh-cta" + ctaState}
disabled={locked}
onClick={() => onAction?.({ type: "reorder-usual", items: usual.map((u) => u.item) })}
>
{c.usualAction}
</button>
<p className="oh-usual__note">
{orders.length === 1 ? c.usualNoteOne : fill(c.usualNote, { count: orders.length })}
</p>
</aside>
) : null}
</div>
</section>
);
}
export default OrderHistory;
type UsualEntry = { key: string; item: OrderItem; times: number };
function buildUsual(orders: Order[], limit: number): UsualEntry[] {
const retired = new Set<string>();
orders.forEach((o) =>
o.items.forEach((it) => {
if (it.discontinued) retired.add(it.sku ?? it.name);
}),
);
const map = new Map<string, UsualEntry>();
orders.forEach((o) => {
const seen = new Set<string>();
o.items.forEach((it) => {
const k = it.sku ?? it.name;
if (retired.has(k) || seen.has(k)) return;
seen.add(k);
const entry = map.get(k);
if (entry) entry.times += 1;
else map.set(k, { key: k, item: it, times: 1 });
});
});
return Array.from(map.values())
.sort((a, b) => b.times - a.times)
.slice(0, Math.max(1, limit));
}
function qty(it: OrderItem) {
return Math.max(1, Math.round(it.quantity ?? 1));
}
function fill(template: string, vars: Record<string, string | number>) {
return Object.keys(vars).reduce((s, k) => s.split("{" + k + "}").join(String(vars[k])), template);
}
function markPhrase(text: string, phrase?: string): React.ReactNode {
const at = phrase ? text.indexOf(phrase) : -1;
if (!phrase || at < 0) return text;
return (
<>
{text.slice(0, at)}
<mark className="oh-mark">{phrase}</mark>
{text.slice(at + phrase.length)}
</>
);
}
function parseISODate(iso: string): Date | null {
const parts = iso.split("-").map(Number);
if (parts.length !== 3 || parts.some((n) => !Number.isFinite(n))) return null;
const d = new Date(Date.UTC(parts[0], parts[1] - 1, parts[2]));
return Number.isNaN(d.getTime()) ? null : d;
}
function dateFormats(locale: string) {
const make = (o: Intl.DateTimeFormatOptions) => {
try {
return new Intl.DateTimeFormat(locale, { ...o, timeZone: "UTC" });
} catch {
return new Intl.DateTimeFormat("en-US", { ...o, timeZone: "UTC" });
}
};
return {
md: make({ month: "short", day: "numeric" }),
y: make({ year: "numeric" }),
full: make({ month: "short", day: "numeric", year: "numeric" }),
};
}
function mergeCopy(copy?: OrderHistoryCopyInput): OrderHistoryCopy {
return {
...DEFAULT_COPY,
...copy,
status: { ...DEFAULT_COPY.status, ...copy?.status },
steps: { ...DEFAULT_COPY.steps, ...copy?.steps },
};
}
const CSS = `
.cf-order-history {
--oh-line: oklch(from var(--ink) l c h / 0.14);
--oh-hair: oklch(from var(--ink) l c h / 0.1);
--oh-well: color-mix(in oklch, var(--ink) 4%, var(--card));
--oh-chip: color-mix(in oklch, var(--ink) 6%, var(--card));
--oh-shade: var(--shadow, oklch(0.22 0.03 260));
--oh-badge-ink: var(--on-status, #fff);
--oh-ease: cubic-bezier(.2, .7, .2, 1);
--oh-drop: drop-shadow(0 2px 3px oklch(from var(--oh-shade) l c h / 0.24)) drop-shadow(0 10px 12px oklch(from var(--oh-shade) l c h / 0.16));
--oh-focus: oklch(from var(--field-focus, var(--accent)) l c h / 0.55);
display: block;
background: var(--surface);
color: var(--ink);
font-family: var(--font-body);
padding: clamp(56px, 8vw, 112px) clamp(16px, 5vw, 48px) clamp(64px, 8.5vw, 120px);
overflow-x: clip;
}
.cf-order-history *, .cf-order-history *::before, .cf-order-history *::after { box-sizing: border-box; }
.cf-order-history .oh-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.cf-order-history .oh-wrap {
max-width: 1120px;
margin: 0 auto;
display: grid;
grid-template-columns: minmax(0, 1fr) clamp(300px, 30vw, 360px);
grid-template-areas: "head aside" "list aside";
grid-template-rows: auto 1fr;
column-gap: clamp(32px, 5vw, 72px);
align-items: start;
}
.cf-order-history .oh-wrap--solo { max-width: 880px; grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "list"; }
.cf-order-history .oh-head { grid-area: head; margin-bottom: 40px; animation: oh-rise .45s var(--oh-ease) both; }
.cf-order-history .oh-title {
margin: 0 0 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(2rem, 3.6vw, 3.25rem);
line-height: 1.06;
color: var(--ink);
text-wrap: balance;
}
.cf-order-history .oh-mark {
color: inherit;
background: linear-gradient(transparent 52%, var(--marker, #fae37c) 52%, var(--marker, #fae37c) 92%, transparent 92%);
padding: 0 .06em;
border-radius: .12em .3em .18em .34em;
-webkit-box-decoration-break: clone;
box-decoration-break: clone;
}
.cf-order-history .oh-lead {
margin: 0;
max-width: 60ch;
font-size: clamp(1.125rem, 1.5vw, 1.375rem);
line-height: 1.4;
font-weight: 500;
color: var(--muted);
text-wrap: pretty;
}
.cf-order-history .oh-list { grid-area: list; list-style: none; margin: 0; padding: 0; }
.cf-order-history .oh-row {
position: relative;
display: grid;
grid-template-columns: 104px 40px minmax(0, 1fr);
padding-bottom: 12px;
animation: oh-rise .45s var(--oh-ease) both;
animation-delay: calc(var(--i, 0) * .07s);
}
.cf-order-history .oh-row::before {
content: "";
position: absolute;
left: 123px;
width: 2px;
top: 35px;
bottom: -35px;
border-radius: 2px;
background: var(--oh-line);
}
.cf-order-history .oh-row:last-child::before { display: none; }
.cf-order-history .oh-when {
grid-column: 1;
display: flex;
flex-direction: column;
align-items: flex-end;
gap: 2px;
padding-top: 20px;
text-align: right;
min-width: 0;
}
.cf-order-history .oh-when__md {
font-family: var(--font-display);
font-weight: var(--display-weight, 800);
font-size: clamp(1.3125rem, 1.8vw, 1.625rem);
line-height: 1.15;
letter-spacing: -0.01em;
font-variant-numeric: tabular-nums;
color: var(--ink);
}
.cf-order-history .oh-when__y { font-size: .9375rem; line-height: 1.4; font-weight: 600; color: var(--muted); }
.cf-order-history .oh-node {
grid-column: 2;
justify-self: center;
position: relative;
z-index: 1;
width: 14px;
height: 14px;
margin-top: 28px;
border-radius: 50%;
background: var(--surface);
border: 2px solid oklch(from var(--ink) l c h / 0.32);
transition: background-color .2s ease, border-color .2s ease;
}
.cf-order-history .is-open > .oh-node { background: var(--accent-fill, var(--accent)); border-color: var(--accent-fill, var(--accent)); }
.cf-order-history .oh-card {
grid-column: 3;
min-width: 0;
background: var(--card);
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(--shadow-sm, 0 1px 1px oklch(0.22 0.03 260 / 0.18), 0 1px 3px oklch(0.22 0.03 260 / 0.14));
transition: box-shadow .16s ease, border-color .16s ease, transform .16s ease;
}
.cf-order-history .oh-row:not(.is-open) > .oh-card:hover, .cf-order-history .oh-row:not(.is-open) > .oh-card.is-hover {
border-color: oklch(from var(--ink) l c h / 0.24);
box-shadow: var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2));
transform: translateY(-1px);
}
.cf-order-history .is-open > .oh-card {
border-color: oklch(from var(--accent) l c h / 0.4);
box-shadow: var(--card-shadow, var(--shadow-md, 0 1px 2px oklch(0.22 0.03 260 / 0.22), 0 4px 10px -2px oklch(0.22 0.03 260 / 0.2)));
}
.cf-order-history .oh-h { margin: 0; font: inherit; }
.cf-order-history .oh-sum {
display: grid;
grid-template-columns: minmax(0, 1fr) auto 20px;
grid-template-areas: "main total chev" "main chip chev";
align-items: start;
column-gap: 20px;
row-gap: 8px;
width: 100%;
margin: 0;
padding: 20px 24px;
border: 0;
border-radius: var(--card-radius, var(--radius, 14px));
background: transparent;
color: var(--ink);
font: inherit;
text-align: left;
cursor: pointer;
transition: background-color .16s ease;
}
.cf-order-history .is-open .oh-sum { border-radius: var(--card-radius, var(--radius, 14px)) var(--card-radius, var(--radius, 14px)) 0 0; }
.cf-order-history .oh-sum:active { background: var(--oh-well); }
.cf-order-history .oh-sum:focus-visible { outline: 3px solid var(--oh-focus); outline-offset: 2px; }
.cf-order-history .oh-sum__date { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.cf-order-history .oh-sum__main { grid-area: main; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.cf-order-history .oh-num {
font-size: clamp(1.0625rem, 1.25vw, 1.125rem);
line-height: 1.5;
font-weight: 800;
color: var(--ink);
overflow-wrap: anywhere;
}
.cf-order-history .oh-peek { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cf-order-history .oh-peek__imgs { display: flex; flex: 0 0 auto; }
.cf-order-history .oh-peek__img { display: block; width: 40px; height: 40px; object-fit: contain; filter: var(--oh-drop); }
.cf-order-history .oh-peek__img + .oh-peek__img { margin-left: -10px; }
.cf-order-history .oh-peek__count { font-size: .9375rem; line-height: 1.4; font-weight: 600; color: var(--muted); }
.cf-order-history .oh-sum__total {
grid-area: total;
justify-self: end;
font-family: var(--font-display);
font-weight: var(--display-weight, 800);
font-size: clamp(1.3125rem, 1.8vw, 1.625rem);
line-height: 1.15;
letter-spacing: -0.01em;
font-variant-numeric: tabular-nums;
color: var(--ink);
white-space: nowrap;
}
.cf-order-history .oh-sum .oh-chip { grid-area: chip; justify-self: end; }
.cf-order-history .oh-chev { grid-area: chev; justify-self: end; margin-top: 4px; color: var(--muted); transition: transform .3s var(--oh-ease), color .16s ease; }
.cf-order-history .oh-sum:hover .oh-chev, .cf-order-history .oh-card.is-hover .oh-chev { color: var(--ink); }
.cf-order-history .is-open .oh-chev { transform: rotate(180deg); }
.cf-order-history .oh-chip {
display: inline-flex;
align-items: center;
gap: 8px;
min-height: 28px;
padding: 4px 12px;
border-radius: 999px;
background: var(--oh-chip);
color: var(--ink);
font-size: .875rem;
line-height: 1.2;
font-weight: 800;
white-space: nowrap;
}
.cf-order-history .oh-chip::before { content: ""; flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.cf-order-history .oh-chip[data-status="shipped"]::before { background: var(--accent-fill, var(--accent)); }
.cf-order-history .oh-chip[data-status="delivered"] { background: var(--success-soft, color-mix(in oklch, var(--success) 14%, var(--card))); color: var(--success); }
.cf-order-history .oh-chip[data-status="delivered"]::before { background: var(--success); }
.cf-order-history .oh-chip--gone { margin-top: 8px; }
.cf-order-history .oh-chip--gone::before { display: none; }
.cf-order-history .oh-panel {
display: grid;
grid-template-rows: 0fr;
visibility: hidden;
transition: grid-template-rows .42s var(--oh-ease), visibility 0s linear .42s;
}
.cf-order-history .is-open .oh-panel {
grid-template-rows: 1fr;
visibility: visible;
transition: grid-template-rows .42s var(--oh-ease), visibility 0s;
}
.cf-order-history .oh-panel__clip { min-height: 0; overflow: hidden; }
.cf-order-history .oh-panel__body { display: flex; flex-direction: column; gap: 24px; padding: 4px 24px 24px; }
.cf-order-history .oh-track { padding: 20px; border-radius: 10px; background: var(--oh-well); }
.cf-order-history .oh-track__note {
margin: 0 0 20px;
font-size: clamp(1.0625rem, 1.25vw, 1.125rem);
line-height: 1.4;
font-weight: 700;
color: var(--ink);
text-wrap: pretty;
}
.cf-order-history .oh-track__note svg, .cf-order-history .oh-link svg { display: inline-block; vertical-align: -0.18em; margin-inline-end: .45em; }
.cf-order-history .oh-steps {
--dot: 28px;
position: relative;
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 8px;
margin: 0;
padding: 0;
list-style: none;
}
.cf-order-history .oh-steps::before, .cf-order-history .oh-steps::after {
content: "";
position: absolute;
top: calc(var(--dot) / 2 - 2px);
left: calc(var(--dot) / 2);
right: calc(var(--dot) / 2);
height: 4px;
border-radius: 999px;
}
.cf-order-history .oh-steps::before { background: oklch(from var(--ink) l c h / 0.12); }
.cf-order-history .oh-steps::after {
background: var(--success);
transform: scaleX(var(--p, 0));
transform-origin: left center;
transition: transform .6s var(--oh-ease) .18s;
}
.cf-order-history .oh-row:not(.is-open) .oh-steps::after { transform: scaleX(0); transition: transform 0s linear .42s; }
.cf-order-history .oh-step {
position: relative;
z-index: 1;
display: flex;
flex-direction: column;
align-items: center;
gap: 8px;
min-width: 0;
text-align: center;
}
.cf-order-history .oh-step:first-child { align-items: flex-start; text-align: left; }
.cf-order-history .oh-step:last-child { align-items: flex-end; text-align: right; }
.cf-order-history .oh-dot {
display: grid;
place-items: center;
width: var(--dot);
height: var(--dot);
border-radius: 50%;
background: var(--card);
border: 2px solid oklch(from var(--ink) l c h / 0.24);
color: transparent;
}
.cf-order-history .oh-dot svg { width: 60%; height: 60%; }
.cf-order-history .oh-step.is-done .oh-dot {
background: var(--success);
border-color: var(--success);
color: var(--oh-badge-ink);
transition: background-color .25s ease var(--d, 0s), border-color .25s ease var(--d, 0s), color .25s ease var(--d, 0s);
}
.cf-order-history .oh-row:not(.is-open) .oh-step.is-done .oh-dot {
background: var(--card);
border-color: oklch(from var(--ink) l c h / 0.24);
color: transparent;
transition: background-color 0s linear .42s, border-color 0s linear .42s, color 0s linear .42s;
}
.cf-order-history .oh-step__label { font-size: .9375rem; line-height: 1.3; font-weight: 800; color: var(--ink); }
.cf-order-history .oh-step__date { margin-top: -4px; font-size: .9375rem; line-height: 1.3; font-weight: 500; color: var(--muted); }
.cf-order-history .oh-items { list-style: none; margin: 0; padding: 0; }
.cf-order-history .oh-item {
display: grid;
grid-template-columns: 72px minmax(0, 1fr) auto;
align-items: start;
column-gap: 16px;
padding: 16px 0;
border-top: 1px solid var(--oh-hair);
}
.cf-order-history .oh-item:first-child { padding-top: 0; border-top: 0; }
.cf-order-history .oh-item:last-child { padding-bottom: 0; }
.cf-order-history .oh-item__img { display: block; width: 72px; height: 72px; object-fit: contain; filter: var(--oh-drop); }
.cf-order-history .oh-item.is-gone .oh-item__img { opacity: .55; filter: grayscale(.8) var(--oh-drop); }
.cf-order-history .oh-item__text { min-width: 0; }
.cf-order-history .oh-item__name {
margin: 0;
font-size: clamp(1.0625rem, 1.25vw, 1.125rem);
line-height: 1.35;
font-weight: 800;
color: var(--ink);
text-wrap: pretty;
}
.cf-order-history .oh-item__meta { margin: 4px 0 0; font-size: .9375rem; line-height: 1.4; font-weight: 500; color: var(--muted); text-wrap: pretty; }
.cf-order-history .oh-item__price {
font-size: clamp(1.0625rem, 1.25vw, 1.125rem);
line-height: 1.35;
font-weight: 800;
font-variant-numeric: tabular-nums;
color: var(--ink);
white-space: nowrap;
}
.cf-order-history .oh-actions {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 12px 24px;
padding-top: 20px;
border-top: 1px solid var(--oh-hair);
}
.cf-order-history .oh-actions__note { flex: 1 0 100%; margin: 0; font-size: .9375rem; line-height: 1.4; font-weight: 500; color: var(--muted); text-wrap: pretty; }
.cf-order-history .oh-link {
font-size: clamp(1.0625rem, 1.25vw, 1.125rem);
line-height: 1.4;
font-weight: 700;
color: var(--link, var(--accent));
text-decoration: underline;
text-decoration-thickness: 1.5px;
text-decoration-color: oklch(from var(--link, var(--accent)) l c h / 0.45);
text-underline-offset: .18em;
border-radius: 4px;
transition: color .16s ease;
}
.cf-order-history .oh-link:hover { color: oklch(from var(--link, var(--accent)) calc(l - 0.08) c h); text-decoration-color: currentColor; }
.cf-order-history .oh-link:focus-visible { outline: 3px solid var(--oh-focus); outline-offset: 3px; }
.cf-order-history .oh-cta {
--oh-b: var(--button-bg, var(--cta));
--oh-b2: var(--button-bg-2, var(--cta-2));
display: inline-flex;
align-items: center;
justify-content: center;
gap: 8px;
width: 100%;
min-height: 64px;
margin: 0;
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;
white-space: nowrap;
color: var(--button-ink, var(--cta-ink));
text-shadow: var(--button-text-shadow, none);
background: linear-gradient(oklch(from var(--oh-b) calc(l + 0.04) c h), oklch(from var(--oh-b2) calc(l - 0.02) c h));
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--oh-b) calc(l + 0.14) c h / 0.7), inset 0 -3px 0 oklch(from var(--oh-b) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--oh-shade) l c h / 0.3), 0 8px 16px -6px oklch(from var(--oh-shade) l c h / 0.45));
cursor: pointer;
transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.cf-order-history .oh-cta:hover:not(:disabled), .cf-order-history .oh-cta.is-hover:not(:disabled) {
background: linear-gradient(oklch(from var(--oh-b) calc(l - 0.01) c h), oklch(from var(--oh-b2) calc(l - 0.07) c h));
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--oh-b) calc(l + 0.12) c h / 0.7), inset 0 -3px 0 oklch(from var(--oh-b) calc(l - 0.18) c h), 0 1px 2px oklch(from var(--oh-shade) l c h / 0.32), 0 12px 20px -8px oklch(from var(--oh-shade) l c h / 0.5));
transform: translateY(-1px);
}
.cf-order-history .oh-cta:active:not(:disabled), .cf-order-history .oh-cta.is-active:not(:disabled) {
background: linear-gradient(oklch(from var(--oh-b) calc(l - 0.04) c h), oklch(from var(--oh-b2) calc(l - 0.08) c h));
box-shadow: inset 0 2px 4px oklch(from var(--oh-b) calc(l - 0.22) c h / 0.55), inset 0 -2px 0 oklch(from var(--oh-b) calc(l - 0.16) c h), 0 1px 1px oklch(from var(--oh-shade) l c h / 0.25);
transform: translateY(1px);
}
.cf-order-history .oh-cta:focus-visible { outline: 3px solid var(--oh-focus); outline-offset: 3px; }
.cf-order-history .oh-cta:disabled {
background: var(--button-2-bg, var(--secondary));
color: var(--button-2-ink, var(--secondary-ink));
text-shadow: none;
box-shadow: none;
cursor: not-allowed;
transform: none;
}
.cf-order-history .oh-cta--sm { width: auto; min-height: 56px; padding: 0 24px; font-size: 1.125rem; }
.cf-order-history .oh-cta--auto { width: auto; margin-top: 32px; }
.cf-order-history .oh-usual {
grid-area: aside;
position: sticky;
top: 24px;
align-self: start;
padding: clamp(20px, 3vw, 32px);
background: var(--card);
border: 1px solid oklch(from var(--accent) l c h / 0.4);
border-radius: var(--card-radius, var(--radius, 14px));
box-shadow: var(--shadow-lg, 0 2px 4px oklch(0.22 0.03 260 / 0.22), 0 12px 24px -8px oklch(0.22 0.03 260 / 0.32));
animation: oh-rise .45s var(--oh-ease) .07s both;
}
.cf-order-history .oh-usual__fan { display: flex; justify-content: center; align-items: flex-end; margin: 0 0 20px; }
.cf-order-history .oh-usual__img { position: relative; z-index: 3; display: block; width: 46%; max-width: 160px; height: auto; aspect-ratio: 1; object-fit: contain; filter: var(--oh-drop); }
.cf-order-history .oh-usual__img:nth-child(2) { z-index: 2; width: 40%; max-width: 140px; margin-left: -12%; }
.cf-order-history .oh-usual__img:nth-child(3) { z-index: 1; width: 34%; max-width: 120px; margin-left: -10%; }
.cf-order-history .oh-usual__title {
margin: 0 0 8px;
font-family: var(--font-display);
font-weight: var(--display-weight, 800);
letter-spacing: -0.01em;
text-transform: var(--display-case, none);
font-size: clamp(1.3125rem, 1.8vw, 1.625rem);
line-height: 1.15;
color: var(--ink);
text-align: center;
text-wrap: balance;
}
.cf-order-history .oh-usual__list { list-style: none; margin: 0 0 24px; padding: 0; }
.cf-order-history .oh-usual__row {
display: grid;
grid-template-columns: minmax(0, 1fr) auto;
align-items: start;
gap: 16px;
padding: 12px 0;
border-top: 1px solid var(--oh-hair);
}
.cf-order-history .oh-usual__row:first-child { border-top: 0; }
.cf-order-history .oh-usual__name { margin: 0; font-size: clamp(1.0625rem, 1.25vw, 1.125rem); line-height: 1.35; font-weight: 800; color: var(--ink); }
.cf-order-history .oh-usual__count { margin: 2px 0 0; font-size: .9375rem; line-height: 1.4; font-weight: 500; color: var(--muted); }
.cf-order-history .oh-usual__price {
font-size: clamp(1.0625rem, 1.25vw, 1.125rem);
line-height: 1.35;
font-weight: 800;
font-variant-numeric: tabular-nums;
color: var(--ink);
white-space: nowrap;
}
.cf-order-history .oh-usual__note { margin: 12px 0 0; font-size: .9375rem; line-height: 1.4; font-weight: 600; color: var(--muted); text-align: center; text-wrap: pretty; }
.cf-order-history .oh-empty { max-width: 46rem; margin: 0 auto; display: flex; flex-direction: column; align-items: center; text-align: center; animation: oh-rise .45s var(--oh-ease) both; }
.cf-order-history .oh-empty__spot { margin-bottom: 24px; }
.cf-order-history .oh-empty .oh-lead { max-width: 52ch; }
@keyframes oh-rise { from { opacity: .82; transform: translateY(8px); } }
@media (max-width: 1024px) {
.cf-order-history .oh-wrap { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "aside" "list"; grid-template-rows: auto; }
.cf-order-history .oh-usual { position: static; margin-bottom: 40px; }
}
@media (min-width: 641px) and (max-width: 1024px) {
.cf-order-history .oh-usual.has-fan { display: grid; grid-template-columns: 220px minmax(0, 1fr); column-gap: 32px; align-items: start; }
.cf-order-history .oh-usual.has-fan > .oh-usual__fan { grid-column: 1; grid-row: 1 / span 4; margin: 0; }
.cf-order-history .oh-usual.has-fan > :not(.oh-usual__fan) { grid-column: 2; }
.cf-order-history .oh-usual.has-fan .oh-usual__title, .cf-order-history .oh-usual.has-fan .oh-usual__note { text-align: left; }
}
@media (max-width: 640px) {
.cf-order-history .oh-head { margin-bottom: 32px; }
.cf-order-history .oh-usual { margin-bottom: 32px; }
.cf-order-history .oh-usual__fan { margin-bottom: 16px; }
.cf-order-history .oh-row { grid-template-columns: minmax(0, 1fr); }
.cf-order-history .oh-row::before, .cf-order-history .oh-when, .cf-order-history .oh-node { display: none; }
.cf-order-history .oh-card { grid-column: 1; box-shadow: var(--shadow-sm, 0 1px 1px oklch(0.22 0.03 260 / 0.18), 0 1px 3px oklch(0.22 0.03 260 / 0.14)); }
.cf-order-history .oh-sum {
grid-template-columns: minmax(0, 1fr) auto 20px;
grid-template-areas: "date chip chev" "main total total";
column-gap: 12px;
row-gap: 12px;
padding: 16px;
}
.cf-order-history .oh-sum__date {
position: static;
grid-area: date;
align-self: center;
width: auto;
height: auto;
overflow: visible;
clip-path: none;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
font-size: .9375rem;
line-height: 1.4;
font-weight: 700;
color: var(--muted);
}
.cf-order-history .oh-sum .oh-chip { align-self: center; }
.cf-order-history .oh-chev { margin-top: 0; align-self: center; }
.cf-order-history .oh-sum__total { align-self: end; }
.cf-order-history .oh-panel__body { gap: 20px; padding: 0 16px 16px; }
.cf-order-history .oh-track { padding: 16px; }
.cf-order-history .oh-steps { --dot: 24px; }
.cf-order-history .oh-step__label, .cf-order-history .oh-step__date { font-size: .875rem; }
.cf-order-history .oh-item { grid-template-columns: 56px minmax(0, 1fr) auto; column-gap: 12px; }
.cf-order-history .oh-item__img { width: 56px; height: 56px; }
.cf-order-history .oh-actions { justify-content: center; gap: 16px; }
.cf-order-history .oh-actions .oh-cta--sm { width: 100%; }
.cf-order-history .oh-actions__note { text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
.cf-order-history *, .cf-order-history *::before, .cf-order-history *::after { animation: none !important; transition: none !important; }
}
`;
pieces/checkout/order-history/specimen.tsx 101 lines
import __studioImage38260b70 from "../assets/1867dac6bd2ebe55.webp";
import __studioImage0f804b69 from "../assets/7aa0afc6c83b1821.webp";
import __studioImage0579827b from "../assets/c46fddc0ffeb8ca8.webp";
// Specimen: Saltmeadow, a fictional skincare brand, with four past orders newest first: one on its way, one product retired.
import * as React from "react";
import { OrderHistory, type Order, type OrderItem } from "../order-history";
import { slot } from "../../slots";
export const states = ["default", "hover", "active", "disabled"];
type SpecimenState = "default" | "hover" | "active" | "disabled";
export default function OrderHistorySpecimen({ state = "default" }: { state?: SpecimenState }) {
const serum: OrderItem = {
sku: "sm-tidepool-serum",
name: "Tidepool Serum",
detail: "30 ml · Sea kelp + niacinamide",
price: "$48.00",
image: slot(
"item-1",
__studioImage38260b70,
),
imageAlt: "Tidepool Serum amber dropper bottle",
};
const cleanser: OrderItem = {
sku: "sm-sea-salt-cleanser",
name: "Sea Salt Cleanser",
detail: "150 ml · Foaming gel",
price: "$38.00",
image: slot(
"item-2",
__studioImage0f804b69,
),
imageAlt: "Sea Salt Cleanser pump bottle",
};
const balm: OrderItem = {
sku: "sm-kelp-night-balm",
name: "Kelp Night Balm",
detail: "50 ml · Overnight barrier balm",
price: "$44.00",
image: slot(
"item-3",
__studioImage0579827b,
),
imageAlt: "Kelp Night Balm ceramic jar",
discontinued: true,
};
const orders: Order[] = [
{
id: "sm-20417",
number: "SM-20417",
date: "2026-11-14",
total: "$86.00",
status: "shipped",
statusNote: "Arriving Thursday, Nov 20",
stepDates: { ordered: "Nov 14", shipped: "Nov 16" },
trackingHref: "#track-sm-20417",
items: [serum, cleanser],
},
{
id: "sm-19873",
number: "SM-19873",
date: "2026-10-02",
total: "$76.00",
status: "delivered",
stepDates: { ordered: "Oct 2", shipped: "Oct 3", delivered: "Oct 7" },
trackingHref: "#track-sm-19873",
items: [{ ...cleanser, quantity: 2 }],
},
{
id: "sm-18920",
number: "SM-18920",
date: "2026-08-19",
total: "$92.00",
status: "delivered",
stepDates: { ordered: "Aug 19", shipped: "Aug 20", delivered: "Aug 25" },
trackingHref: "#track-sm-18920",
items: [balm, serum],
},
{
id: "sm-17504",
number: "SM-17504",
date: "2026-06-03",
total: "$44.00",
status: "delivered",
stepDates: { ordered: "Jun 3", shipped: "Jun 4", delivered: "Jun 9" },
items: [balm],
},
];
return (
<OrderHistory
headline="Your Saltmeadow shelf, restocked in one tap."
highlight="restocked in one tap."
orders={orders}
shopHref="#shop"
state={state}
/>
);
}
| Name | Type | Details |
|---|---|---|
headline OptionalOrderHistory |
string |
|
highlight OptionalOrderHistory |
string |
|
lead OptionalOrderHistory |
string |
|
orders OptionalOrderHistory |
Order[] |
|
defaultOpenId OptionalOrderHistory |
string | null |
|
showUsual OptionalOrderHistory |
boolean |
|
usualLimit OptionalOrderHistory |
number |
|
shopHref OptionalOrderHistory |
string |
|
locale OptionalOrderHistory |
string |
|
copy OptionalOrderHistory |
OrderHistoryCopyInput |
|
onAction OptionalOrderHistory |
(action: OrderHistoryAction) => void |
|
state OptionalOrderHistory |
"default" | "hover" | "active" | "disabled" |
|
className OptionalOrderHistory |
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- 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.
--marker- The highlighter colour behind key phrases.
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.
-
1867dac6bd2ebe55.webp
image/webp · 20.6 KB
-
75ba15955a7397f6.webp
image/webp · 18.6 KB
-
7aa0afc6c83b1821.webp
image/webp · 22.6 KB
-
c46fddc0ffeb8ca8.webp
image/webp · 20.5 KB