import type { LucideIcon } from "lucide-react"; import type { ReactNode } from "react"; import { Link } from "@/lib/router"; import { Card } from "./ui/card"; interface MetricCardProps { icon: LucideIcon; value: string | number; label: string; description?: ReactNode; to?: string; onClick?: () => void; /** Use the shared bordered Card surface instead of an unframed metric. */ appearance?: "plain" | "card"; } export function MetricCard({ icon: Icon, value, label, description, to, onClick, appearance = "plain" }: MetricCardProps) { const isClickable = !!(to || onClick); const content = (

{value}

{label}

{description && (
{description}
)}
); const surfaceClassName = `h-full px-4 py-4 sm:px-5 sm:py-5 rounded-lg transition-colors${isClickable ? " hover:bg-accent/50 cursor-pointer" : ""}`; const inner = appearance === "card" ? {content} :
{content}
; if (to) { return ( {inner} ); } if (onClick) { return (
{inner}
); } return inner; }