Spaces:
Sleeping
Sleeping
File size: 885 Bytes
010c33f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | import React from 'react'
export default function DataTable({ table, maxHeight = 320 }) {
if (!table || !table.columns || !table.rows) {
return <div className="empty-box">Sem dados.</div>
}
return (
<div className="table-wrapper" style={{ maxHeight }}>
<table>
<thead>
<tr>
{table.columns.map((col) => (
<th key={col}>{col}</th>
))}
</tr>
</thead>
<tbody>
{table.rows.map((row, i) => (
<tr key={i}>
{table.columns.map((col) => (
<td key={`${i}-${col}`}>{String(row[col] ?? '')}</td>
))}
</tr>
))}
</tbody>
</table>
{table.truncated ? (
<div className="table-hint">Mostrando {table.returned_rows} de {table.total_rows} linhas.</div>
) : null}
</div>
)
}
|