Files
JML/src/components/StatCard.tsx

33 lines
1.1 KiB
TypeScript

import { LucideIcon } from 'lucide-react';
interface StatCardProps {
label: string;
value: string | number;
icon: LucideIcon;
color?: string;
trend?: string;
trendUp?: boolean;
}
export default function StatCard({ label, value, icon: Icon, color = 'text-accent', trend, trendUp }: StatCardProps) {
const bgColor = color.replace('text-', 'bg-');
return (
<div className="bg-white rounded-xl p-5 shadow-sm border border-slate-100 hover:shadow-md transition-shadow">
<div className="flex items-start justify-between">
<div className={`w-12 h-12 rounded-xl ${bgColor}/10 flex items-center justify-center`}>
<Icon className={`w-6 h-6 ${color}`} />
</div>
{trend && (
<span className={`text-xs font-semibold px-2 py-1 rounded-full ${trendUp ? 'bg-green-100 text-green-700' : 'bg-red-100 text-red-700'}`}>
{trend}
</span>
)}
</div>
<div className="mt-4">
<p className="text-2xl font-extrabold text-slate-800">{value}</p>
<p className="text-sm text-slate-500 mt-1">{label}</p>
</div>
</div>
);
}