27 lines
869 B
TypeScript
27 lines
869 B
TypeScript
import clsx from 'clsx'
|
|
|
|
interface StatsCardProps {
|
|
icon: string
|
|
value: string | number
|
|
label: string
|
|
trend?: { value: number; isPositive: boolean }
|
|
className?: string
|
|
}
|
|
|
|
export default function StatsCard({ icon, value, label, trend, className }: StatsCardProps) {
|
|
return (
|
|
<div className={clsx('bg-white rounded-xl p-4 border border-gray-200', className)}>
|
|
<div className="flex items-start justify-between mb-2">
|
|
<span className="text-2xl">{icon}</span>
|
|
{trend && (
|
|
<span className={clsx('text-sm font-semibold', trend.isPositive ? 'text-green-600' : 'text-red-600')}>
|
|
{trend.isPositive ? '↗' : '↘'} {Math.abs(trend.value)}%
|
|
</span>
|
|
)}
|
|
</div>
|
|
<div className="text-2xl font-bold mb-1">{value}</div>
|
|
<div className="text-sm text-gray-600">{label}</div>
|
|
</div>
|
|
)
|
|
}
|