import * as React from 'react'; import { cn } from '@/lib/utils'; import { PriceDelta, type PriceDeltaDirection } from './price-delta'; export interface TickerItem { id: string; label: string; changePercent: number; direction?: PriceDeltaDirection; } export interface TickerStripProps extends React.HTMLAttributes { items: TickerItem[]; /** Tắt animation (cho unit test / reduced motion). */ paused?: boolean; } /** * Thanh chạy ngang hiển thị biến động giá top quận. * Render 2 lần liên tiếp để tạo vòng lặp mượt với animation `-50%`. */ export function TickerStrip({ items, paused, className, ...rest }: TickerStripProps) { const duplicated = React.useMemo(() => [...items, ...items], [items]); return (
{duplicated.map((item, idx) => ( {item.label} ))}
); }