import React, { useMemo } from 'react' // import PropTypes from 'prop-types' import { TableBody, TableCell, TableRow } from 'material-ui/Table' import { TBodyProps } from './interfaces' export * from './interfaces' const TBody: React.FC = (props) => { const { data, columnData } = props const content = useMemo(() => { if (!columnData) { return null } const columns = columnData.filter((n) => n.hidden !== true) if (!columns.length) { return null } return ( {data.map((n, index) => { const { id } = n return ( {columns.map((record, index2) => { const { id: fieldName, key, // label, disablePadding, padding, // numeric, renderer, ...other } = record const value = fieldName && typeof fieldName === 'string' ? n[fieldName] : undefined return ( {value !== undefined && renderer ? renderer(value, n) : value || ''} ) })} ) })} ) }, [columnData, data]) return content } export default TBody