Rename website column. Table component.
This commit is contained in:
25
components/Table.js
Normal file
25
components/Table.js
Normal file
@@ -0,0 +1,25 @@
|
||||
import React from 'react';
|
||||
import styles from './Table.module.css';
|
||||
|
||||
export default function Table({ columns, rows }) {
|
||||
return (
|
||||
<table className={styles.table}>
|
||||
<thead>
|
||||
<tr>
|
||||
{columns.map(({ key, label }) => (
|
||||
<th key={key}>{label}</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{rows.map((row, rowIndex) => (
|
||||
<tr key={rowIndex}>
|
||||
{columns.map(({ key }) => (
|
||||
<td key={`${rowIndex}${key}`}>{row[key]}</td>
|
||||
))}
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user