This commit is contained in:
@@ -11,7 +11,14 @@ import {
|
||||
} from "@radix-ui/react-icons";
|
||||
import { cn } from "../../lib";
|
||||
import { Button } from "../button";
|
||||
import { Table, TableCell, TableHead, TableHeader, TableRow } from "../table";
|
||||
import {
|
||||
Table,
|
||||
TableCaption,
|
||||
TableCell,
|
||||
TableHead,
|
||||
TableHeader,
|
||||
TableRow,
|
||||
} from "../table";
|
||||
import type { HTMLAttributes } from "react";
|
||||
declare module "@tanstack/react-table" {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
@@ -28,6 +35,7 @@ type DataTableProps<T> = {
|
||||
className?: HTMLAttributes<HTMLTableElement>["className"];
|
||||
viewPagination?: boolean;
|
||||
onRowClick?: (row: T) => void;
|
||||
caption?: string;
|
||||
};
|
||||
|
||||
function DataTable<T>({
|
||||
@@ -36,10 +44,12 @@ function DataTable<T>({
|
||||
className,
|
||||
viewPagination,
|
||||
onRowClick,
|
||||
caption,
|
||||
}: DataTableProps<T>) {
|
||||
return (
|
||||
<>
|
||||
<Table className={cn("w-full", className)} variant={variant}>
|
||||
{caption && <TableCaption className="sr-only">{caption}</TableCaption>}
|
||||
<THead table={table} />
|
||||
<tbody>
|
||||
{table.getRowModel().rows.map((row) => {
|
||||
|
||||
Reference in New Issue
Block a user