48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
'use no memo'
|
|
|
|
import { type ColumnDef } from '@tanstack/react-table'
|
|
|
|
import { DataGridColumnHeader } from '@/components/reui/data-grid/data-grid-column-header'
|
|
|
|
export interface ClientRow {
|
|
id: string
|
|
username: string
|
|
createdAt: string
|
|
}
|
|
|
|
/**
|
|
* Managed clients columns.
|
|
* Preview: https://reui.io/preview/base/data-grid-base-1
|
|
* Docs: https://reui.io/docs/components/base/data-grid
|
|
*/
|
|
export function createClientsColumns(): ColumnDef<ClientRow, unknown>[] {
|
|
return [
|
|
{
|
|
id: 'username',
|
|
accessorKey: 'username',
|
|
header: ({ column }) => (
|
|
<DataGridColumnHeader title="Username" visibility={true} column={column} />
|
|
),
|
|
cell: ({ row }) => (
|
|
<span className="font-medium">{row.original.username}</span>
|
|
),
|
|
enableSorting: true,
|
|
size: 200,
|
|
},
|
|
{
|
|
id: 'createdAt',
|
|
accessorKey: 'createdAt',
|
|
header: ({ column }) => (
|
|
<DataGridColumnHeader title="Created" visibility={true} column={column} />
|
|
),
|
|
cell: ({ row }) => (
|
|
<span className="text-muted-foreground text-xs tabular-nums">
|
|
{row.original.createdAt}
|
|
</span>
|
|
),
|
|
enableSorting: true,
|
|
size: 200,
|
|
},
|
|
]
|
|
}
|