import './domestic-summary.scss'; import { moveDir, formatFlucRate, formatIndexClose } from '@/types/worldIndex'; import { type DomesticIndexRow, formatIndexChange, formatCount } from '@/types/domesticSummary'; // 국내 증시 요약 — 코스피/코스닥/KOSPI200 카드. 지수값·전일비·등락률 + 등락종목수(코스피/코스닥만). // (투자자별 순매수·베이시스는 미지원으로 제외) type Props = { rows: DomesticIndexRow[]; }; const ARROW = { up: '▲', down: '▼', flat: '–' } as const; export default function DomesticSummary({ rows }: Props) { if (rows.length === 0) { return null; } return (
{rows.map((row) => { const dir = moveDir(row.flucRateBp); const hasBreadth = row.advances !== null && row.advances !== undefined; return (
{row.name}
{formatIndexClose(row.close)} {formatIndexChange(row.changeVal)} {formatFlucRate(row.flucRateBp)}
{hasBreadth && (
상한 {formatCount(row.limitUp)} 상승 {formatCount(row.advances)} 보합 {formatCount(row.unchanged)} 하락 {formatCount(row.declines)} 하한 {formatCount(row.limitDown)}
)}
); })}
); }