|
|
@@ -27,13 +27,6 @@ import { type User } from '../data/schema'
|
|
|
import { DataTableBulkActions } from './data-table-bulk-actions'
|
|
|
import { usersColumns as columns } from './users-columns'
|
|
|
|
|
|
-declare module '@tanstack/react-table' {
|
|
|
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
- interface ColumnMeta<TData, TValue> {
|
|
|
- className: string
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
type DataTableProps = {
|
|
|
data: User[]
|
|
|
search: Record<string, unknown>
|
|
|
@@ -70,6 +63,7 @@ export function UsersTable({ data, search, navigate }: DataTableProps) {
|
|
|
],
|
|
|
})
|
|
|
|
|
|
+ // eslint-disable-next-line react-hooks/incompatible-library
|
|
|
const table = useReactTable({
|
|
|
data,
|
|
|
columns,
|
|
|
@@ -99,7 +93,12 @@ export function UsersTable({ data, search, navigate }: DataTableProps) {
|
|
|
}, [table, ensurePageInRange])
|
|
|
|
|
|
return (
|
|
|
- <div className='space-y-4 max-sm:has-[div[role="toolbar"]]:mb-16'>
|
|
|
+ <div
|
|
|
+ className={cn(
|
|
|
+ 'max-sm:has-[div[role="toolbar"]]:mb-16', // Add margin bottom to the table on mobile when the toolbar is visible
|
|
|
+ 'flex flex-1 flex-col gap-4'
|
|
|
+ )}
|
|
|
+ >
|
|
|
<DataTableToolbar
|
|
|
table={table}
|
|
|
searchPlaceholder='Filter users...'
|
|
|
@@ -134,7 +133,8 @@ export function UsersTable({ data, search, navigate }: DataTableProps) {
|
|
|
colSpan={header.colSpan}
|
|
|
className={cn(
|
|
|
'bg-background group-hover/row:bg-muted group-data-[state=selected]/row:bg-muted',
|
|
|
- header.column.columnDef.meta?.className ?? ''
|
|
|
+ header.column.columnDef.meta?.className,
|
|
|
+ header.column.columnDef.meta?.thClassName
|
|
|
)}
|
|
|
>
|
|
|
{header.isPlaceholder
|
|
|
@@ -162,7 +162,8 @@ export function UsersTable({ data, search, navigate }: DataTableProps) {
|
|
|
key={cell.id}
|
|
|
className={cn(
|
|
|
'bg-background group-hover/row:bg-muted group-data-[state=selected]/row:bg-muted',
|
|
|
- cell.column.columnDef.meta?.className ?? ''
|
|
|
+ cell.column.columnDef.meta?.className,
|
|
|
+ cell.column.columnDef.meta?.tdClassName
|
|
|
)}
|
|
|
>
|
|
|
{flexRender(
|
|
|
@@ -186,7 +187,7 @@ export function UsersTable({ data, search, navigate }: DataTableProps) {
|
|
|
</TableBody>
|
|
|
</Table>
|
|
|
</div>
|
|
|
- <DataTablePagination table={table} />
|
|
|
+ <DataTablePagination table={table} className='mt-auto' />
|
|
|
<DataTableBulkActions table={table} />
|
|
|
</div>
|
|
|
)
|