'use client'; import React from 'react'; import { cn } from '@/utils/helpers'; type ColorVariant = 'blue' | 'green' | 'yellow' | 'red' | 'purple' | 'orange' | 'gray'; interface StatCardProps { title: string; value: number | string; icon?: React.ReactNode; color?: ColorVariant; subtitle?: string; className?: string; } const colorClasses: Record = { blue: { bg: 'bg-blue-50', text: 'text-blue-600', iconBg: 'bg-blue-100 text-blue-600' }, green: { bg: 'bg-green-50', text: 'text-green-600', iconBg: 'bg-green-100 text-green-600' }, yellow: { bg: 'bg-yellow-50', text: 'text-yellow-600', iconBg: 'bg-yellow-100 text-yellow-600' }, red: { bg: 'bg-red-50', text: 'text-red-600', iconBg: 'bg-red-100 text-red-600' }, purple: { bg: 'bg-purple-50', text: 'text-purple-600', iconBg: 'bg-purple-100 text-purple-600' }, orange: { bg: 'bg-orange-50', text: 'text-orange-600', iconBg: 'bg-orange-100 text-orange-600' }, gray: { bg: 'bg-gray-50', text: 'text-gray-600', iconBg: 'bg-gray-100 text-gray-600' }, }; export const StatCard: React.FC = ({ title, value, icon, color = 'blue', subtitle, className, }) => { const colors = colorClasses[color]; const formattedValue = typeof value === 'number' ? value.toLocaleString('fr-FR') : value; return (

{title}

{formattedValue}

{subtitle && (

{subtitle}

)}
{icon && (
{icon}
)}
); }; export default StatCard;