import type { LucideIcon } from "lucide-react" import { Badge } from "@/components/ui/badge" import { Progress } from "@/components/ui/progress" import type { Tone } from "@/data/types" import { cn } from "@/lib/utils" /* =========================================================================== The KPI card from IMAGE 1: uppercase label, status chip, icon, headline figure, supporting line and an optional progress bar. =========================================================================== */ const SURFACE: Record = { neutral: "border-line bg-surface", primary: "border-line bg-surface", good: "border-line bg-surface", warn: "border-warn-edge bg-warn-soft", bad: "border-bad-edge bg-bad-soft", } const VALUE: Record = { neutral: "text-ink", primary: "text-ink", good: "text-ink", warn: "text-ink", bad: "text-bad", } const ICON_WRAP: Record = { neutral: "bg-surface-sunk text-ink-3", primary: "bg-primary-soft text-primary", good: "bg-good-soft text-good", warn: "bg-warn-soft text-warn", bad: "bg-bad-soft text-bad", } export interface MetricCardProps { label: string value: string sub: string icon: LucideIcon badge?: string badgeTone?: Tone tone?: Tone progress?: number /** Compact form used on Home (section 10): no progress bar, tighter type. */ compact?: boolean } export function MetricCard({ label, value, sub, icon: Icon, badge, badgeTone = "neutral", tone = "neutral", progress, compact = false, }: MetricCardProps) { return (
{label}
{badge && !compact && ( {badge} )}
{value}

{sub}

{progress !== undefined && !compact && }
) }