refactor: move sortable fields in table

This commit is contained in:
Sammy Teillet
2023-04-24 13:53:49 +02:00
parent 00ad3a89b5
commit bc91e97695
3 changed files with 33 additions and 13 deletions

View File

@ -10,6 +10,7 @@ import TableHeader from './table-header/TableHeader';
import { IconProp } from '@fortawesome/fontawesome-svg-core';
import styled from '@emotion/styled';
import { SortType } from './table-header/SortAndFilterBar';
import { faCalendar } from '@fortawesome/pro-regular-svg-icons';
type OwnProps<TData> = {
data: Array<TData>;
@ -75,12 +76,22 @@ function Table<TData>({
getCoreRowModel: getCoreRowModel(),
});
const sortsAvailable: Array<SortType> = [
{
id: 'created_at',
label: 'Created at',
order: 'asc',
icon: faCalendar,
},
];
return (
<StyledTableWithHeader>
<TableHeader
viewName={viewName}
viewIcon={viewIcon}
onSortsUpdate={onSortsUpdate}
sortsAvailable={sortsAvailable}
/>
<StyledTable>
<thead>