@@ -27,13 +27,6 @@ import { type User } from '../data/schema'
2727import { DataTableBulkActions } from './data-table-bulk-actions'
2828import { usersColumns as columns } from './users-columns'
2929
30- declare module '@tanstack/react-table' {
31- // eslint-disable-next-line @typescript-eslint/no-unused-vars
32- interface ColumnMeta < TData , TValue > {
33- className : string
34- }
35- }
36-
3730type DataTableProps = {
3831 data : User [ ]
3932 search : Record < string , unknown >
@@ -70,6 +63,7 @@ export function UsersTable({ data, search, navigate }: DataTableProps) {
7063 ] ,
7164 } )
7265
66+ // eslint-disable-next-line react-hooks/incompatible-library
7367 const table = useReactTable ( {
7468 data,
7569 columns,
@@ -99,7 +93,12 @@ export function UsersTable({ data, search, navigate }: DataTableProps) {
9993 } , [ table , ensurePageInRange ] )
10094
10195 return (
102- < div className = 'space-y-4 max-sm:has-[div[role="toolbar"]]:mb-16' >
96+ < div
97+ className = { cn (
98+ 'max-sm:has-[div[role="toolbar"]]:mb-16' , // Add margin bottom to the table on mobile when the toolbar is visible
99+ 'flex flex-1 flex-col gap-4'
100+ ) }
101+ >
103102 < DataTableToolbar
104103 table = { table }
105104 searchPlaceholder = 'Filter users...'
@@ -134,7 +133,8 @@ export function UsersTable({ data, search, navigate }: DataTableProps) {
134133 colSpan = { header . colSpan }
135134 className = { cn (
136135 'bg-background group-hover/row:bg-muted group-data-[state=selected]/row:bg-muted' ,
137- header . column . columnDef . meta ?. className ?? ''
136+ header . column . columnDef . meta ?. className ,
137+ header . column . columnDef . meta ?. thClassName
138138 ) }
139139 >
140140 { header . isPlaceholder
@@ -162,7 +162,8 @@ export function UsersTable({ data, search, navigate }: DataTableProps) {
162162 key = { cell . id }
163163 className = { cn (
164164 'bg-background group-hover/row:bg-muted group-data-[state=selected]/row:bg-muted' ,
165- cell . column . columnDef . meta ?. className ?? ''
165+ cell . column . columnDef . meta ?. className ,
166+ cell . column . columnDef . meta ?. tdClassName
166167 ) }
167168 >
168169 { flexRender (
@@ -186,7 +187,7 @@ export function UsersTable({ data, search, navigate }: DataTableProps) {
186187 </ TableBody >
187188 </ Table >
188189 </ div >
189- < DataTablePagination table = { table } />
190+ < DataTablePagination table = { table } className = 'mt-auto' />
190191 < DataTableBulkActions table = { table } />
191192 </ div >
192193 )
0 commit comments