"use client" import {Card, CardContent, CardHeader, CardTitle} from "@/components/ui/card" import CountUp from "react-countup" import {cn} from "@/lib/utils" import type {ReactNode} from "react" type MetricCardProps = { title: string value: number suffix?: string icon?: ReactNode className?: string trend?: { delta: number; label?: string } // delta in percent } export default function MetricCard({ title, value, suffix, icon, className, trend, }: MetricCardProps) { const trendColor = trend && trend.delta !== 0 ? trend.delta > 0 ? "text-emerald-600" : "text-rose-600" : "text-muted-foreground" return ( {title} {icon}
{suffix ? {suffix} : null}
{trend ? (

{trend.delta > 0 ? "โ†‘" : trend.delta < 0 ? "โ†“" : "โ€”"} {Math.abs(trend.delta)}%{" "} {trend.label ? ยท {trend.label} : null}

) : null}
) }