import React from "react"; import type { StatCardData } from "../scenarios/types"; interface StatCardsProps { stats: StatCardData[]; } const COLOR_MAP: Record< NonNullable, { card: string; text: string; badge: string } > = { slate: { card: "border-slate-200 bg-slate-50/70", text: "text-slate-900", badge: "bg-slate-100 text-slate-700", }, blue: { card: "border-blue-200 bg-blue-50/60", text: "text-blue-900", badge: "bg-blue-100 text-blue-700", }, emerald: { card: "border-emerald-200 bg-emerald-50/60", text: "text-emerald-900", badge: "bg-emerald-100 text-emerald-700", }, rose: { card: "border-rose-200 bg-rose-50/60", text: "text-rose-900", badge: "bg-rose-100 text-rose-700", }, amber: { card: "border-amber-200 bg-amber-50/60", text: "text-amber-900", badge: "bg-amber-100 text-amber-700", }, purple: { card: "border-purple-200 bg-purple-50/60", text: "text-purple-900", badge: "bg-purple-100 text-purple-700", }, }; export const StatCards: React.FC = ({ stats }) => { if (!stats || stats.length === 0) return null; return (
{stats.map((st) => { const colorStyle = COLOR_MAP[st.color ?? "slate"]; return (
{st.label} {st.delta && ( {st.delta.direction === "up" ? "↑ " : st.delta.direction === "down" ? "↓ " : "• "} {st.delta.value} )}
{st.value} {st.unit && ( {st.unit} )}
{st.subtext && (

{st.subtext}

)}
); })}
); };