import { type ReactNode } from 'react'; import { TREND_STYLES } from './constants'; const DEFAULT_VALUE_CLASS = 'text-dark-100'; export interface StatCardDelta { /** Signed percent change vs the comparison period. */ percent: number; trend: 'up' | 'down' | 'stable'; } interface StatCardProps { label: string; value: string | number; icon?: ReactNode; valueClassName?: string; /** Optional period-over-period change shown next to the value. */ delta?: StatCardDelta | null; } export function StatCard({ label, value, icon, valueClassName = DEFAULT_VALUE_CLASS, delta, }: StatCardProps) { const trendStyle = delta ? (TREND_STYLES[delta.trend] ?? TREND_STYLES.stable) : null; return (