mirror of
https://github.com/escalante29/WealthySmart.git
synced 2026-07-17 15:28:47 +02:00
All checks were successful
Deploy to VPS / deploy (push) Successful in 28s
Replace custom markup across all pages and components with shadcn/ui primitives (Dialog, Sheet, Select, Card, Tabs, etc.). Add reusable DataTable component powered by @tanstack/react-table with sortable column headers and client-side pagination. Introduce TransactionList with responsive mobile cards and desktop DataTable, dashboard section customization (DashboardSection, SectionConfigDialog), and settings API types. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import { type Column } from '@tanstack/react-table';
|
|
import { ArrowDown, ArrowUp, ArrowUpDown } from 'lucide-react';
|
|
|
|
import { cn } from '@/lib/utils';
|
|
import { Button } from '@/components/ui/button';
|
|
|
|
interface DataTableColumnHeaderProps<TData, TValue> {
|
|
column: Column<TData, TValue>;
|
|
title: string;
|
|
className?: string;
|
|
}
|
|
|
|
export function DataTableColumnHeader<TData, TValue>({
|
|
column,
|
|
title,
|
|
className,
|
|
}: DataTableColumnHeaderProps<TData, TValue>) {
|
|
if (!column.getCanSort()) {
|
|
return <div className={cn(className)}>{title}</div>;
|
|
}
|
|
|
|
const sorted = column.getIsSorted();
|
|
|
|
return (
|
|
<Button
|
|
variant="ghost"
|
|
size="sm"
|
|
className={cn('-ml-3 h-8', className)}
|
|
onClick={() => column.toggleSorting(sorted === 'asc')}
|
|
>
|
|
{title}
|
|
{sorted === 'desc' ? (
|
|
<ArrowDown className="ml-1 h-3.5 w-3.5" />
|
|
) : sorted === 'asc' ? (
|
|
<ArrowUp className="ml-1 h-3.5 w-3.5" />
|
|
) : (
|
|
<ArrowUpDown className="ml-1 h-3.5 w-3.5 text-muted-foreground/50" />
|
|
)}
|
|
</Button>
|
|
);
|
|
}
|