'use client'; import type { ReactNode } from 'react'; import { ArrowUpRight, ArrowDownRight } from 'lucide-react'; import { AnimatedCounter } from '@/components/ui/animated-counter'; import { cn } from '@/lib/utils'; type TrendDirection = 'up' | 'down' | 'neutral'; interface MetricCardProps { icon?: ReactNode; label: string; value: number; prefix?: string; suffix?: string; decimals?: number; description?: string; trend?: { value: string; direction: TrendDirection; label?: string; }; accentColor?: 'brand' | 'blue' | 'teal' | 'amber' | 'purple'; className?: string; theme?: 'light' | 'dark'; } const accentStyles: Record = { brand: 'text-brand-ink bg-brand-bg', blue: 'text-accent-blue bg-accent-blue/10', teal: 'text-accent-teal bg-accent-teal/10', amber: 'text-accent-amber bg-accent-amber/10', purple: 'text-accent-purple bg-accent-purple/10', }; const trendIcon = { up: ArrowUpRight, down: ArrowDownRight, neutral: ArrowUpRight, }; const trendColor: Record = { up: 'text-success', down: 'text-error', neutral: 'text-text-muted', }; export function MetricCard({ icon, label, value, prefix = '', suffix = '', decimals = 0, description, trend, accentColor = 'brand', className, theme = 'light', }: MetricCardProps) { const TrendIcon = trend ? trendIcon[trend.direction] : null; const isDark = theme === 'dark'; return (
{icon && (
{icon}
)} {trend && TrendIcon && (
{trend.value} {trend.label && {trend.label}}
)}
{label}
{description && (

{description}

)}
); }