import { Button, Text, Icon, Table, TableBody, TableCell, TableColumn, TableHeader, TableRow, } from 'react-basics'; import { formatDistance } from 'date-fns'; import Link from 'next/link'; import { Edit } from 'components/icons'; import styles from './UsersTable.module.css'; const columns = [ { name: 'username', label: 'Username', style: { flex: 2 } }, { name: 'role', label: 'Role', style: { flex: 2 } }, { name: 'created', label: 'Created' }, { name: 'action', label: ' ' }, ]; export default function UsersTable({ data = [] }) { return ( {(column, index) => { return ( {column.label} ); }} {(row, keys, rowIndex) => { row.created = formatDistance(new Date(row.createdAt), new Date(), { addSuffix: true, }); row.action = (
); return ( {(data, key, colIndex) => { return ( {data[key]} ); }} ); }}
); }