import * as React from 'react'; import { cn } from '@/lib/utils'; import { PriceDelta, type PriceDeltaDirection } from './price-delta'; export interface MarketIndexProps extends React.HTMLAttributes { /** Tên index, vd "GGX Market". */ name: string; /** Giá trị hiện tại. */ value: string | number; /** Biến động % so với mốc tham chiếu. */ changePercent: number; /** Biến động tuyệt đối (optional). */ change?: string | number; /** Khung thời gian, vd "24h". */ window?: string; /** Ép direction cho delta. */ direction?: PriceDeltaDirection; } /** * Index lớn hiển thị chỉ số thị trường tổng: dùng cho header/hero dashboard. */ export function MarketIndex({ name, value, changePercent, change, window = '24h', direction, className, ...rest }: MarketIndexProps) { return (
{name} {value}
{typeof change !== 'undefined' ? ( {change} ({window}) ) : ( {window} )}
); }