2025-12-04 12:48:41 +09:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
import { Card, CardContent } from "@/components/ui/card";
|
|
|
|
|
import { LucideIcon } from "lucide-react";
|
|
|
|
|
|
|
|
|
|
interface StatCardData {
|
|
|
|
|
label: string;
|
|
|
|
|
value: string | number;
|
|
|
|
|
icon?: LucideIcon;
|
|
|
|
|
iconColor?: string;
|
|
|
|
|
trend?: {
|
|
|
|
|
value: string;
|
|
|
|
|
isPositive: boolean;
|
|
|
|
|
};
|
2025-12-30 21:56:01 +09:00
|
|
|
onClick?: () => void;
|
|
|
|
|
isActive?: boolean;
|
2025-12-04 12:48:41 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface StatCardsProps {
|
|
|
|
|
stats: StatCardData[];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function StatCards({ stats }: StatCardsProps) {
|
|
|
|
|
return (
|
2026-01-06 09:58:10 +09:00
|
|
|
<div className="grid grid-cols-2 sm:grid-cols-3 gap-3 md:gap-4">
|
2025-12-04 12:48:41 +09:00
|
|
|
{stats.map((stat, index) => {
|
|
|
|
|
const Icon = stat.icon;
|
2025-12-30 21:56:01 +09:00
|
|
|
const isClickable = !!stat.onClick;
|
|
|
|
|
|
2025-12-04 12:48:41 +09:00
|
|
|
return (
|
2025-12-30 21:56:01 +09:00
|
|
|
<Card
|
|
|
|
|
key={index}
|
2026-01-05 18:59:04 +09:00
|
|
|
className={`flex-1 min-w-0 transition-colors ${
|
2025-12-30 21:56:01 +09:00
|
|
|
isClickable ? 'cursor-pointer hover:border-primary/50' : ''
|
|
|
|
|
} ${
|
|
|
|
|
stat.isActive ? 'border-primary bg-primary/5' : ''
|
|
|
|
|
}`}
|
|
|
|
|
onClick={stat.onClick}
|
|
|
|
|
>
|
2025-12-04 12:48:41 +09:00
|
|
|
<CardContent className="p-3 md:p-4 lg:p-6">
|
|
|
|
|
<div className="flex items-center justify-between">
|
|
|
|
|
<div className="flex-1">
|
|
|
|
|
<p className="sm:text-xs md:text-sm text-muted-foreground mb-1 md:mb-2 uppercase tracking-wide text-[12px]">
|
|
|
|
|
{stat.label}
|
|
|
|
|
</p>
|
|
|
|
|
<p className="font-bold text-[24px]">
|
|
|
|
|
{stat.value}
|
|
|
|
|
</p>
|
|
|
|
|
{stat.trend && (
|
|
|
|
|
<p className={`text-[10px] sm:text-xs md:text-sm mt-1 md:mt-2 font-medium ${stat.trend.isPositive ? 'text-green-600' : 'text-red-600'}`}>
|
|
|
|
|
{stat.trend.value}
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
{Icon && (
|
|
|
|
|
<Icon
|
|
|
|
|
className={`w-8 h-8 sm:w-9 sm:h-9 md:w-10 md:h-10 lg:w-12 lg:h-12 opacity-15 ${stat.iconColor || 'text-blue-600'}`}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</CardContent>
|
|
|
|
|
</Card>
|
|
|
|
|
);
|
|
|
|
|
})}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|