// import { Badge } from "@/components/ui/badge"; import { Separator } from "@/components/ui/separator"; import type { DashboardStockItem } from "@/features/trade/types/trade.types"; import { cn } from "@/lib/utils"; interface StockHeaderProps { stock: DashboardStockItem; price: string; change: string; changeRate: string; high?: string; low?: string; volume?: string; } /** * @description 선택된 종목의 현재가/등락/시세 요약 헤더를 렌더링합니다. * @see features/trade/components/layout/TradeDashboardContent.tsx - StockHeader 사용 (header prop으로 전달) */ export function StockHeader({ stock, price, change, changeRate, high, low, volume, }: StockHeaderProps) { const changeRateNum = parseFloat(changeRate); const isRise = changeRateNum > 0; const isFall = changeRateNum < 0; const colorClass = isRise ? "text-red-500" : isFall ? "text-blue-600 dark:text-blue-400" : "text-foreground"; const bgGlowClass = isRise ? "from-red-500/10 to-transparent dark:from-red-500/15" : isFall ? "from-blue-500/10 to-transparent dark:from-blue-500/15" : "from-brand-500/10 to-transparent"; // 전일종가 계산 (현재가 - 변동액) const prevClose = stock.prevClose > 0 ? stock.prevClose.toLocaleString("ko-KR") : "--"; const open = stock.open > 0 ? stock.open.toLocaleString("ko-KR") : "--"; return (
{/* ========== STOCK SUMMARY ========== */}
{/* 종목명 + 코드 */}

{stock.name}

{stock.market}
{stock.symbol}
{/* 현재가 + 등락 */}
{price}
{isRise ? "▲" : isFall ? "▼" : ""} {changeRate}% {isRise && "+"} {change}
{/* ========== MOBILE STATS ========== */}
{/* ========== DESKTOP STATS ========== */}
); } /** 모바일 통계 카드 */ function StatCard({ label, value, tone, }: { label: string; value: string; tone?: "ask" | "bid"; }) { return (

{label}

{value}

); } /** 데스크톱 통계 항목 */ function DesktopStat({ label, value, tone, }: { label: string; value: string; tone?: "ask" | "bid"; }) { return (
{label} {value}
); }