data table
This commit is contained in:
27
apps/hub/app/_components/PaginatedTable.tsx
Normal file
27
apps/hub/app/_components/PaginatedTable.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import SortableTable, { SortableTableProps } from './Table';
|
||||
|
||||
interface PaginatedTableProps<TData>
|
||||
extends Omit<SortableTableProps<TData>, 'data'> {
|
||||
prismaGetter: (
|
||||
fnProps: {
|
||||
cursor: number;
|
||||
take: number;
|
||||
} & any
|
||||
) => Promise<any>;
|
||||
}
|
||||
|
||||
export async function PaginatedTable<TData>({
|
||||
prismaGetter,
|
||||
...restProps
|
||||
}: PaginatedTableProps<TData>) {
|
||||
const data = await prismaGetter({
|
||||
cursor: 0,
|
||||
take: 10,
|
||||
});
|
||||
|
||||
return (
|
||||
<div>
|
||||
<SortableTable data={data} {...restProps} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user