import * as React from 'react' import { cn } from '../../lib/utils' import { SparklineTrend } from './SparklineTrend' export interface MetricCardTrend { value: number isPositive?: boolean label?: string } export interface MetricCardProps { label: string value: string | number icon: React.ComponentType<{ className?: string }> iconColor?: string trend?: MetricCardTrend sparklineData?: number[] href?: string isLoading?: boolean error?: boolean className?: string } export function MetricCard({ label, value, icon: Icon, iconColor = 'text-blue-500', trend, sparklineData, href, isLoading, error, className, }: MetricCardProps) { const content = (
{isLoading ? '\u2014' : error ? 'Error' : value}
{/* Trend Indicator */} {trend && !isLoading && !error && ({trend.label}
)} {/* Sparkline */} {sparklineData && sparklineData.length > 1 && !isLoading && !error && (