%PDF- %PDF-
| Direktori : /home2/rezakur1/ai.rezakurnia.com/zh-router-frontend/src/components/dashboard/ |
| Current File : //home2/rezakur1/ai.rezakurnia.com/zh-router-frontend/src/components/dashboard/StatCard.tsx |
import type { ReactNode } from "react";
import Card from "@/components/ui/Card";
import { formatNumber } from "@/lib/format";
const accentMap: Record<string, string> = {
pink: "text-brand-300",
rose: "text-blue-300",
fuchsia: "text-sky-300",
hot: "text-blue-200",
};
interface StatCardProps {
label: string;
value: number;
icon: ReactNode;
accent?: keyof typeof accentMap;
hint?: string;
}
export default function StatCard({
label,
value,
icon,
accent = "pink",
hint,
}: StatCardProps) {
return (
<Card className="p-4 sm:p-5">
<div className="flex items-start justify-between">
<div className="min-w-0">
<p className="text-xs font-medium text-slate-400">{label}</p>
<p className="mt-1.5 text-xl font-bold tracking-tight tabular-nums text-white sm:mt-2 sm:text-3xl">
{formatNumber(value)}
</p>
{hint && <p className="mt-1 text-[11px] text-slate-500">{hint}</p>}
</div>
<div
className={`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-white/[0.06] bg-white/[0.04] ${accentMap[accent]}`}
>
{icon}
</div>
</div>
</Card>
);
}