'use client'; /** * KpiCard — Single KPI metric card with title, value, subtitle, icon, trend indicator, * and optional sparkline mini-chart. * * Styling: * - bg-divisi-card, border border-divisi-border, rounded-xl, p-4 * - Trend up = green (text-green-500), trend down = red (text-red-500) * - Sparkline positioned to the right of the value/trend area * - Subtle hover effect with shadow elevation and border glow * - Value is large and prominent * * Requirements: 4.1, 4.2, 4.4, 17.2, 17.5 */ import Sparkline from '@/components/charts/Sparkline'; import { divisiColors } from '@/lib/constants/theme'; interface KpiCardProps { title: string; value: string | number; subtitle?: string; icon?: React.ReactNode; trend?: { value: number; direction: 'up' | 'down' }; sparklineData?: number[]; } export default function KpiCard({ title, value, subtitle, icon, trend, sparklineData }: KpiCardProps) { // Determine sparkline color based on trend direction const sparklineColor = trend?.direction === 'down' ? '#ef4444' : divisiColors.accent; return (
{title}
{value}
{subtitle && ({subtitle}
)} {trend && (