| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- 'use client';
- import DataTable, { DataTableColumn } from '@/components/table/DataTable';
- import { SriBondRow } from '@/types/market';
- import { formatKrwCompact } from '@/lib/utils/stock';
- import { formatRatePercent } from '@/lib/utils/market';
- function buildColumns(): DataTableColumn<SriBondRow>[] {
- return [
- {
- key: 'name',
- header: '종목명',
- align: 'left',
- priority: 'high',
- cellClassName: 'data-table__cell--name',
- cell: (row) => (
- <span className='stock-cell'>
- <span className='stock-cell__name'>{row.name}</span>
- <span className='stock-cell__code'>{row.code}</span>
- </span>
- )
- },
- {
- key: 'issuer',
- header: '발행기관',
- align: 'left',
- priority: 'medium',
- cell: (row) => row.issuerName
- },
- {
- key: 'sriType',
- header: '유형',
- align: 'center',
- priority: 'medium',
- cell: (row) => <span className='market__cls-badge'>{row.sriBondType}</span>
- },
- {
- key: 'coupon',
- header: '표면금리',
- align: 'right',
- priority: 'high',
- cell: (row) => formatRatePercent(row.couponRate, 3)
- },
- {
- key: 'issueAmount',
- header: '발행액',
- align: 'right',
- priority: 'high',
- cell: (row) => formatKrwCompact(row.issueAmount)
- },
- {
- key: 'redemption',
- header: '상환일',
- align: 'center',
- priority: 'low',
- cell: (row) => row.redemptionDate || '—'
- }
- ];
- }
- export default function SriBondsTable({ rows }: { rows: SriBondRow[] })
- {
- return (
- <DataTable<SriBondRow>
- caption='SRI 채권 목록 — 종목명, 발행기관, 유형, 표면금리, 발행액, 상환일'
- columns={buildColumns()}
- rows={rows}
- rowKey={(row) => row.code}
- emptyMessage='표시할 SRI 채권이 없습니다.'
- />
- );
- }
|