2022-12-27 01:57:59 +01:00
|
|
|
import {
|
|
|
|
Table,
|
|
|
|
TableHeader,
|
|
|
|
TableBody,
|
|
|
|
TableRow,
|
|
|
|
TableCell,
|
|
|
|
TableColumn,
|
|
|
|
Button,
|
|
|
|
Icon,
|
|
|
|
} from 'react-basics';
|
|
|
|
import styles from './TeamsTable.module.css';
|
|
|
|
|
2023-01-10 08:59:26 +01:00
|
|
|
const columns = [
|
|
|
|
{ name: 'username', label: 'Username', style: { flex: 4 } },
|
|
|
|
{ name: 'role', label: 'Role' },
|
|
|
|
{ name: 'action', label: '' },
|
|
|
|
];
|
|
|
|
|
|
|
|
export default function TeamMembersTable({ data = [] }) {
|
2022-12-27 01:57:59 +01:00
|
|
|
return (
|
2023-01-10 08:59:26 +01:00
|
|
|
<Table className={styles.table} columns={columns} rows={data}>
|
2022-12-27 01:57:59 +01:00
|
|
|
<TableHeader>
|
|
|
|
{(column, index) => {
|
|
|
|
return (
|
|
|
|
<TableColumn key={index} style={{ ...column.style }}>
|
|
|
|
{column.label}
|
|
|
|
</TableColumn>
|
|
|
|
);
|
|
|
|
}}
|
|
|
|
</TableHeader>
|
|
|
|
<TableBody>
|
|
|
|
{(row, keys, rowIndex) => {
|
|
|
|
row.action = (
|
|
|
|
<div className={styles.actions}>
|
2023-01-10 08:59:26 +01:00
|
|
|
<Button>
|
|
|
|
<Icon icon="cross" />
|
|
|
|
Remove
|
|
|
|
</Button>
|
2022-12-27 01:57:59 +01:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<TableRow key={rowIndex} data={row} keys={keys}>
|
|
|
|
{(data, key, colIndex) => {
|
|
|
|
return (
|
|
|
|
<TableCell
|
|
|
|
key={colIndex}
|
|
|
|
className={styles.cell}
|
|
|
|
style={{ ...columns[colIndex]?.style }}
|
|
|
|
>
|
2023-01-10 08:59:26 +01:00
|
|
|
{data[key] ?? data?.user?.[key]}
|
2022-12-27 01:57:59 +01:00
|
|
|
</TableCell>
|
|
|
|
);
|
|
|
|
}}
|
|
|
|
</TableRow>
|
|
|
|
);
|
|
|
|
}}
|
|
|
|
</TableBody>
|
|
|
|
</Table>
|
|
|
|
);
|
|
|
|
}
|