mtg-lets-trade

Website/webapp to facilitate trading between players of Magic: The Gathering
git clone https://kevincorvisier.fr/git/mtg-lets-trade.git
Log | Files | Refs

DataTableBody.tsx (481B)


      1 import { ColumnDef, RowDef } from "./ColumnDef";
      2 
      3 type Props<T> = {
      4 	data: T[],
      5 	columns: ColumnDef<T>[],
      6 	rows: RowDef<T>
      7 };
      8 
      9 export default function DataTableBody<T>({ data, rows, columns }: Props<T>) {
     10 	return (
     11 		<tbody>
     12 			{data.flatMap(row => {
     13 				return (
     14 					<tr key={rows.key(row)}>
     15 
     16 						{columns.flatMap(column => {
     17 							return (
     18 								<td key={column.key}>
     19 									{column.render(row)}
     20 								</td>
     21 							)
     22 						})}
     23 
     24 					</tr>
     25 				)
     26 			})}
     27 		</tbody>
     28 	)
     29 };