"use client";
import { Card, CardContent } from "@/components/ui/card";
import { cn } from "@/lib/utils";
import { ReactNode } from "react";
interface StatCardProps {
title: string;
value: string | number;
icon: ReactNode;
trend?: {
value: number;
isPositive: boolean;
};
color?: "primary" | "accent" | "green" | "blue" | "purple" | "orange";
}
const colorVariants = {
primary: {
bg: "bg-primary-50",
icon: "bg-primary-100 text-primary-600",
text: "text-primary-700",
},
accent: {
bg: "bg-accent-50",
icon: "bg-accent-100 text-accent-600",
text: "text-accent-700",
},
green: {
bg: "bg-green-50",
icon: "bg-green-100 text-green-600",
text: "text-green-700",
},
blue: {
bg: "bg-blue-50",
icon: "bg-blue-100 text-blue-600",
text: "text-blue-700",
},
purple: {
bg: "bg-purple-50",
icon: "bg-purple-100 text-purple-600",
text: "text-purple-700",
},
orange: {
bg: "bg-orange-50",
icon: "bg-orange-100 text-orange-600",
text: "text-orange-700",
},
};
export function StatCard({ title, value, icon, trend, color = "primary" }: StatCardProps) {
const colors = colorVariants[color];
return (
{title}
{value}
{trend && (
{trend.isPositive ? (
) : (
)}
{trend.isPositive ? "+" : ""}
{trend.value}%
vs ayer
)}
{icon}
);
}
// Loading skeleton for stat card
export function StatCardSkeleton() {
return (
);
}