import { Minus, TrendingDown, TrendingUp } from "lucide-react";
import Link from "@/components/link";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
interface StatsCardProps {
title: string;
value: string | number;
description?: string;
icon?: React.ReactNode;
href?: string;
/** Percentage change vs previous period. Positive = up, negative = down, undefined = no trend */
trend?: number;
}
export function StatsCard({
title,
value,
description,
icon,
href,
trend,
}: StatsCardProps) {
const content = (
{title}
{icon && {icon}
}
{value}
{trend !== undefined &&
}
{description && (
{description}
)}
);
if (href) {
return {content};
}
return content;
}
function TrendBadge({ value }: { value: number }) {
if (value === 0) {
return (
0%
);
}
const isUp = value > 0;
return (
{isUp ? (
) : (
)}
{isUp ? "+" : ""}
{value}%
);
}