1import { createColumnHelper } from "@tanstack/react-table"
2
3import { DataGrid, useDataGrid } from "@/components/mizzle/data/data-grid"
4import type { DataGridFeatures } from "@/utils/data-grid-features"
5
6const helper = createColumnHelper<DataGridFeatures, Invoice>()
7
8const columns = helper.columns([
9 helper.accessor("id", { header: "Invoice", size: 120 }),
10 helper.accessor("customer", { header: "Customer", size: 200 }),
11 helper.accessor("amount", {
12 header: "Amount",
13 size: 120,
14 meta: { align: "end" },
15 }),
16])
17
18export function Invoices({ invoices }: { invoices: Invoice[] }) {
19 const table = useDataGrid({
20 columns,
21 data: invoices,
22 getRowId: (row) => row.id,
23 })
24
25 return <DataGrid table={table} className="h-96" />
26}