Skip to content

Commit 7a2bc0b

Browse files
committed
feat: enhance DataTableRenderer with improved styling and no data message
1 parent 65fdf63 commit 7a2bc0b

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

packages/components/src/renderers/complex/data-table.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -403,12 +403,13 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
403403
</div>
404404

405405
{/* Table */}
406-
<Table>
406+
<div className="rounded-md border max-h-[600px] overflow-auto relative">
407+
<Table>
407408
{caption && <TableCaption>{caption}</TableCaption>}
408-
<TableHeader>
409+
<TableHeader className="sticky top-0 bg-background z-10 shadow-sm">
409410
<TableRow>
410411
{selectable && (
411-
<TableHead className="w-12">
412+
<TableHead className="w-12 bg-background">
412413
<Checkbox
413414
checked={allPageRowsSelected ? true : somePageRowsSelected ? 'indeterminate' : false}
414415
onCheckedChange={handleSelectAll}
@@ -423,7 +424,7 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
423424
return (
424425
<TableHead
425426
key={col.accessorKey}
426-
className={`${col.className || ''} ${sortable && col.sortable !== false ? 'cursor-pointer select-none' : ''} ${isDragging ? 'opacity-50' : ''} ${isDragOver ? 'border-l-2 border-primary' : ''} relative group`}
427+
className={`${col.className || ''} ${sortable && col.sortable !== false ? 'cursor-pointer select-none' : ''} ${isDragging ? 'opacity-50' : ''} ${isDragOver ? 'border-l-2 border-primary' : ''} relative group bg-background`}
427428
style={{
428429
width: columnWidth,
429430
minWidth: columnWidth
@@ -455,7 +456,7 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
455456
);
456457
})}
457458
{rowActions && (
458-
<TableHead className="w-24 text-right">Actions</TableHead>
459+
<TableHead className="w-24 text-right bg-background">Actions</TableHead>
459460
)}
460461
</TableRow>
461462
</TableHeader>
@@ -464,9 +465,13 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
464465
<TableRow>
465466
<TableCell
466467
colSpan={columns.length + (selectable ? 1 : 0) + (rowActions ? 1 : 0)}
467-
className="h-24 text-center text-muted-foreground"
468+
className="h-96 text-center text-muted-foreground"
468469
>
469-
No data available
470+
<div className="flex flex-col items-center justify-center gap-2">
471+
<Search className="h-8 w-8 text-muted-foreground/50" />
472+
<p>No results found</p>
473+
<p className="text-xs text-muted-foreground/50">Try adjusting your filters or search query.</p>
474+
</div>
470475
</TableCell>
471476
</TableRow>
472477
) : (
@@ -527,6 +532,7 @@ const DataTableRenderer = ({ schema }: { schema: DataTableSchema }) => {
527532
)}
528533
</TableBody>
529534
</Table>
535+
</div>
530536

531537
{/* Pagination */}
532538
{pagination && sortedData.length > 0 && (

0 commit comments

Comments
 (0)