Customer order lifecycle on the mono design system: red + provenance tokens, useReveal hook, lib/data pricing model, ProvenanceBadge/CellProvenance, OrderStepper, and 4 routes with live pricing, 50/50 escrow, simulated production, 4-view validation. tsc clean; next build green (5 routes). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
58 lines
1.9 KiB
TypeScript
58 lines
1.9 KiB
TypeScript
import Link from "next/link";
|
|
|
|
const STEPS = [
|
|
{ n: 1, label: "Konfigurera", href: "/bestall" },
|
|
{ n: 2, label: "Förskott", href: "/bestall/forskott" },
|
|
{ n: 3, label: "Produktion", href: null },
|
|
{ n: 4, label: "Validera", href: null },
|
|
] as const;
|
|
|
|
/** Mono 4-step indicator. Active step carries the single red marker. */
|
|
export function OrderStepper({ active }: { active: 1 | 2 | 3 | 4 }) {
|
|
return (
|
|
<nav
|
|
aria-label="Beställningssteg"
|
|
className="flex w-full items-center gap-0 border-b border-border bg-background"
|
|
>
|
|
{STEPS.map((s, i) => {
|
|
const isActive = s.n === active;
|
|
const isDone = s.n < active;
|
|
const inner = (
|
|
<span className="flex items-center gap-3">
|
|
<span
|
|
className="flex h-6 w-6 items-center justify-center font-mono text-[11px]"
|
|
style={{
|
|
backgroundColor: isActive ? "var(--accent-red)" : isDone ? "var(--foreground)" : "transparent",
|
|
color: isActive || isDone ? "#fff" : "var(--muted-foreground)",
|
|
border: isActive || isDone ? "none" : "1px solid var(--border)",
|
|
}}
|
|
>
|
|
{s.n}
|
|
</span>
|
|
<span
|
|
className="font-mono text-[11px] uppercase tracking-[0.12em]"
|
|
style={{ color: isActive ? "var(--foreground)" : "var(--muted-foreground)" }}
|
|
>
|
|
{s.label}
|
|
</span>
|
|
</span>
|
|
);
|
|
return (
|
|
<div
|
|
key={s.n}
|
|
className="flex flex-1 items-center justify-center border-r border-border px-4 py-3 last:border-r-0"
|
|
>
|
|
{s.href && (isDone || isActive) ? (
|
|
<Link href={s.href} className="transition-opacity hover:opacity-70">
|
|
{inner}
|
|
</Link>
|
|
) : (
|
|
inner
|
|
)}
|
|
</div>
|
|
);
|
|
})}
|
|
</nav>
|
|
);
|
|
}
|