"use client"; // 종목 페이지 상단 가격 헤더. // 표시: 종목명 / (코드·시장) / 현재가 / 전일대비 (절대값 + 퍼센트). // 한국 거래소 관행대로 상승=빨강, 하락=파랑. type Props = { name: string; code: string; market: string; current: number | null; prev: number | null; asOf?: string | null; }; export function PriceHero({ name, code, market, current, prev, asOf }: Props) { const change = current != null && prev != null ? current - prev : null; const pct = change != null && prev ? (change / prev) * 100 : null; const tone = change == null || change === 0 ? "text-zinc-400" : change > 0 ? "text-rose-400" : "text-sky-400"; const arrow = change == null || change === 0 ? "—" : change > 0 ? "▲" : "▼"; return (
{code} · {market}

{name}

{current != null ? current.toLocaleString() : "-"} {change != null && pct != null && ( {arrow} {Math.abs(change).toLocaleString()}{" "} ({pct >= 0 ? "+" : ""} {pct.toFixed(2)}%) )}
{asOf && (
기준 {asOf}
)}
); }