import React from 'react' ; import styles from './styles.module.scss' ; import { TableRow } from './TableRow' ; import { TableHeader } from './TableHeader' ; interface TableProps { header ? : Array < any > ; data : Array < any > ; size ? : string ; className ? : string ; } const Table = ( { className = '' , size = 'md' , header , data = [ ] , } ) : JSX . Element => { return ( < div className = { `${ styles . root } ${ styles [ size ] } ${ className }` } > { header && < TableHeader name = { header [ 0 ] } value = { header [ 1 ] } / > } { data . map ( ( [ name , value ] , idx ) => ( < TableRow key = { idx } name = { name } value = { value } / > ) ) } < /div>); } ; export default Table ;