import * as React from 'react'; import { cn } from '@/lib/utils'; import { PriceDelta, type PriceDeltaDirection } from './price-delta'; export interface StatCardProps extends React.HTMLAttributes { /** Tên chỉ số, vd "Giá TB/m²". */ label: string; /** Giá trị chính, đã format sẵn (string) hoặc number. */ value: string | number; /** Đơn vị đi kèm, vd "tr/m²". */ unit?: string; /** Delta % (nếu có). */ delta?: number; /** Ép direction của delta. */ deltaDirection?: PriceDeltaDirection; /** Mô tả phụ, vd "24h", "7 ngày". */ sublabel?: string; /** Prefix icon. */ icon?: React.ReactNode; } /** * Card KPI compact cho Market Dashboard. * Bố cục: label (sans muted) + value (mono lớn) + delta (signal). */ export function StatCard({ label, value, unit, delta, deltaDirection, sublabel, icon, className, ...rest }: StatCardProps) { return (
{icon ? {icon} : null} {label}
{value} {unit ? {unit} : null}
{typeof delta === 'number' ? ( ) : ( )} {sublabel ? ( {sublabel} ) : null}
); }