Files

38 lines
1.1 KiB
TypeScript
Raw Permalink Normal View History

2025-08-20 14:14:33 +02:00
"use client";
2025-08-20 16:41:27 +02:00
import type { Player } from "@lordicon/react";
2025-08-20 14:14:33 +02:00
import { motion } from "framer-motion";
import { useRef } from "react";
import LordIcon from "./LordIcon";
export default function StatCard({
label,
value,
icon,
}: {
label: string;
2025-08-20 16:41:27 +02:00
value: string | number | null;
2025-08-20 14:14:33 +02:00
icon: string;
}) {
2025-08-20 16:41:27 +02:00
const iconRef = useRef<Player | null>(null);
2025-08-20 14:14:33 +02:00
return (
<motion.div
className="rounded-2xl bg-[#11131c] p-5 border border-white/10 hover:border-blue-500/40 transition-colors shadow-md"
whileHover={{ scale: 1.03 }}
onMouseEnter={() => iconRef.current?.playFromBeginning()}
onMouseLeave={() => iconRef.current?.goToFirstFrame()}
>
<div className="flex items-center gap-3">
<div className="p-3 rounded-xl bg-blue-500/20 text-blue-400">
<LordIcon ref={iconRef} url={icon} size={28} colorize="#3b82f6" />
</div>
<div>
<div className="text-sm text-neutral-400">{label}</div>
2025-08-20 16:41:27 +02:00
<div className="text-xl font-bold text-white">{value ?? "—"}</div>
2025-08-20 14:14:33 +02:00
</div>
</div>
</motion.div>
);
}