import { cn } from "cn"; import type * as React from "react"; import { Avatar, AvatarFallback, AvatarImage } from "@/registry/edmi/ui/avatar"; import { Card } from "@/registry/edmi/ui/card"; import type { Elevation } from "@/registry/edmi/ui/elevation"; type TickerItem = { symbol: string; price: string; /** Signed percentage string, e.g. `+0.42%` or `−0.31%`. Sign sets the color. */ change: string; /** Avatar image; falls back to the symbol's first letter. */ image?: string; href?: string; }; const isDown = (s: string) => /^[-−–]/.test(s.trim()); function TickerCell({ item }: { item: TickerItem }) { const content = ( <>
{item.image ? : null} {item.symbol.charAt(0)} {item.symbol}
{item.price}
{item.change}
); const cls = "block min-w-[150px] flex-1 px-[18px] py-3.5 not-first:border-l not-first:border-border"; return item.href ? ( {content} ) : (
{content}
); } // Horizontal row of price cells (avatar + symbol, mono price, up/down change). function TickerStrip({ className, items, elevation, ...props }: Omit, "children"> & { items: TickerItem[]; /** ✦ depth of the strip (forwarded to Card). */ elevation?: Elevation; }) { return ( {items.map((item) => ( ))} ); } export type { TickerItem }; export { TickerStrip };