import { Table as BTable, Form, Stack } from 'react-bootstrap'; import { v4 as uuidv4 } from 'uuid'; import { flexRender } from '@tanstack/react-table'; import Pagination from '@/components/Pagination'; import useTable from './useTable'; function Table({ data, columns, className }) { const { table, getPaginationProps } = useTable(data, columns); return ( { table.setPageSize(Number(e.target.value)); }} > {[10, 20, 30, 40, 50].map((pageSize) => ( ))} {table.getHeaderGroups().map((headerGroup) => ( {headerGroup.headers.map((header) => { const sortIcon = { asc: 'sorting_asc', desc: 'sorting_desc', }[header.column.getIsSorted()] ?? 'sorting'; return ( {header.isPlaceholder ? null : flexRender(header.column.columnDef.header, header.getContext())} ); })} ))} {table.getRowModel().rows.map((row) => ( {row.getVisibleCells().map((cell) => ( {flexRender(cell.column.columnDef.cell, cell.getContext())} ))} ))}
{table.getState().pagination.pageIndex * table.getState().pagination.pageSize + 1} -{' '} {Math.min( table.getState().pagination.pageIndex * table.getState().pagination.pageSize + table.getState().pagination.pageSize, table.getRowCount(), )}{' '} of {table.getRowCount().toLocaleString('ko-KR')}
); } export default Table;