weedscan-kz / web /src /components /StatCard.tsx
Rmano-Rudeson's picture
Release recovered WeedScan KZ models, source, and experiment evidence
3eba919 verified
Raw History Blame Contribute Delete
1.44 kB
import { motion } from "framer-motion";
import { LucideIcon } from "lucide-react";
interface StatCardProps {
icon: LucideIcon;
label: string;
value: string | number;
sub?: string;
variant?: "default" | "success" | "warning" | "destructive";
}
const variantStyles = {
default: "bg-card shadow-card",
success: "bg-success/10 border-success/20",
warning: "bg-warning/10 border-warning/20",
destructive: "bg-destructive/10 border-destructive/20",
};
const iconStyles = {
default: "bg-primary/10 text-primary",
success: "bg-success/15 text-success",
warning: "bg-warning/15 text-warning",
destructive: "bg-destructive/15 text-destructive",
};
const StatCard = ({ icon: Icon, label, value, sub, variant = "default" }: StatCardProps) => (
<motion.div
initial={{ opacity: 0, y: 16 }}
animate={{ opacity: 1, y: 0 }}
className={`rounded-xl border p-5 ${variantStyles[variant]}`}
>
<div className="flex items-start justify-between">
<div>
<p className="text-sm font-medium text-muted-foreground">{label}</p>
<p className="mt-1.5 text-2xl font-bold text-foreground">{value}</p>
{sub && <p className="mt-0.5 text-xs text-muted-foreground">{sub}</p>}
</div>
<div className={`flex h-10 w-10 items-center justify-center rounded-lg ${iconStyles[variant]}`}>
<Icon className="h-5 w-5" />
</div>
</div>
</motion.div>
);
export default StatCard;