import { Card, CardContent } from '../primitives'; import { cn } from '../lib/cn'; import { TrendingUp, TrendingDown, Minus } from 'lucide-react'; interface KpiCardProps { title: string; value: string | number; subtitle?: string; trend?: 'up' | 'down' | 'neutral'; trendValue?: string; icon?: React.ReactNode; className?: string; href?: string; } export function KpiCard({ title, value, subtitle, trend, trendValue, icon, className, href, }: KpiCardProps) { const formatValue = (val: string | number) => { if (typeof val === 'number') { return new Intl.NumberFormat('es-MX', { style: 'currency', currency: 'MXN', minimumFractionDigits: 0, maximumFractionDigits: 0, }).format(val); } return val; }; const Wrapper = href ? 'a' : 'div'; const wrapperProps = href ? { href, className: 'block' } : {}; return (

{title}

{icon &&
{icon}
}

{formatValue(value)}

{(subtitle || trend) && (
{trend && ( {trend === 'up' && } {trend === 'down' && } {trend === 'neutral' && } {trendValue} )} {subtitle && ( {subtitle} )}
)}
); }