Files
front-AT/app/Components/Global/table.tsx
T

40 lines
940 B
TypeScript
Raw Normal View History

2025-10-08 12:01:52 -06:00
"use client";
import styles from "./table.module.css";
interface TableProps {
headers: string[];
data: Array<Record<string, any>>;
}
export default function Table({ headers, data }: TableProps) {
return (
<div className={styles.tableContainer}>
<table>
<thead>
<tr>
{headers.map((header, index) => (
<th key={index}>{header}</th>
))}
</tr>
</thead>
<tbody>
{data.length > 0 ? (
data.map((row, rowIndex) => (
<tr key={rowIndex}>
{headers.map((header, colIndex) => (
2026-02-05 13:26:17 -06:00
<td key={colIndex} className={styles[row[header]]}>{row[header]}</td>
2025-10-08 12:01:52 -06:00
))}
</tr>
))
) : (
<tr>
<td colSpan={headers.length}>No hay registros</td>
</tr>
)}
</tbody>
</table>
</div>
);
}