import { TriangleDownIcon, TriangleUpIcon } from '@chakra-ui/icons' import { Box, chakra, Table, Tbody, Td, Th, Thead, Tr } from '@chakra-ui/react' import React from 'react' import { useBlockLayout, useSortBy, useTable } from 'react-table' import { useSticky } from 'react-table-sticky' import { useViewport } from '../../../contexts' import space from '../../../styles/theme/foundations/space' interface ICustomTableProps { // columns: ColumnProps[] columns: any data: any } const CustomTable: React.FunctionComponent = (props) => { const { columns, data } = props const { width } = useViewport() const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } = useTable( { columns, data }, useSortBy, useBlockLayout, useSticky, ) return ( {headerGroups.map((headerGroup, key) => ( {headerGroup.headers.map((column: any, key2) => { return ( ) })} ))} {rows.map((row, key) => { prepareRow(row) const isLastRow = data.length - 1 === row.index return ( {row.cells.map((cell, key2) => ( ))} ) })}
{column.render('Header')} {column.isSorted ? ( column.isSortedDesc ? ( ) : ( ) ) : null}
{cell.render('Cell')}
) } export default CustomTable