import type { ComponentType } from "react"; import { Card, CardContent, CardHeader, CardTitle } from "../ui/card.js"; import { cn } from "../utils.js"; export interface StatsCardProps { title: string; value: string; icon: ComponentType<{ className?: string }>; description: string; trend?: { value: number; label?: string }; } /** A metric card with an optional positive/negative percentage trend. */ export function StatsCard({ title, value, icon: Icon, description, trend, }: StatsCardProps) { return ( {title}
{value}

{trend && ( 0 ? "text-foreground" : "text-destructive", )} > {trend.value > 0 ? "+" : ""} {trend.value}%{trend.label ? ` ${trend.label}` : ""} )} {description}

); }