diff --git a/src/components/vulnerability-database/vulnerability-data-table/columns.tsx b/src/components/vulnerability-database/vulnerability-data-table/columns.tsx index 0a28e928..00d436d3 100644 --- a/src/components/vulnerability-database/vulnerability-data-table/columns.tsx +++ b/src/components/vulnerability-database/vulnerability-data-table/columns.tsx @@ -17,10 +17,10 @@ export const columns: ColumnDef[] = [ { accessorKey: 'cve', header: 'ID', - size: 150, + size: 200, cell: ({ row }) => ( -
{row.getValue('cve')}
+ {row.getValue('cve')} ), }, @@ -28,22 +28,25 @@ export const columns: ColumnDef[] = [ accessorKey: 'description', header: 'Description', size: 600, + meta: { + className: 'hidden md:table-cell' + }, cell: ({ row }) => { const description = row.getValue('description') as string const truncated = description?.length > 100 ? description.substring(0, 100) + '...' : description - return
{truncated}
+ return {truncated} }, }, { accessorKey: 'cvss', - size: 100, + size: 90, header: ({ column }) => { return (
column.toggleSorting(column.getIsSorted() === 'asc') } @@ -53,15 +56,18 @@ export const columns: ColumnDef[] = [
) }, - cell: ({ row }) =>
{row.getValue('cvss')}
, + cell: ({ row }) => {row.getValue('cvss')}, }, { accessorKey: 'datePublished', size: 150, + meta: { + className: 'hidden md:table-cell' + }, header: ({ column }) => { return (
column.toggleSorting(column.getIsSorted() === 'asc') } @@ -82,7 +88,7 @@ export const columns: ColumnDef[] = [ ? formatDistanceToNow(date, { addSuffix: true }) : format(date, 'd. MMM yy') - return
{formatted}
+ return {formatted} }, }, ] diff --git a/src/components/vulnerability-database/vulnerability-data-table/data-table.tsx b/src/components/vulnerability-database/vulnerability-data-table/data-table.tsx index df9b4ba2..21762a00 100644 --- a/src/components/vulnerability-database/vulnerability-data-table/data-table.tsx +++ b/src/components/vulnerability-database/vulnerability-data-table/data-table.tsx @@ -23,6 +23,7 @@ import { TableHeader, TableRow, } from '@/components/ui/table' +import { cn } from '@/lib/utils' const PAGE_SIZE = 10 @@ -66,13 +67,17 @@ export function DataTable({ return (
- +
{table.getHeaderGroups().map((headerGroup) => ( {headerGroup.headers.map((header) => { return ( - + {header.isPlaceholder ? null : flexRender( @@ -95,7 +100,10 @@ export function DataTable({ {columns.map((column, cellIndex) => ( @@ -126,7 +134,11 @@ export function DataTable({ {row.getVisibleCells().map((cell) => ( {flexRender( cell.column.columnDef.cell, diff --git a/src/types/tanstack-table.d.ts b/src/types/tanstack-table.d.ts new file mode 100644 index 00000000..82ee0508 --- /dev/null +++ b/src/types/tanstack-table.d.ts @@ -0,0 +1,7 @@ +import '@tanstack/react-table' + +declare module '@tanstack/react-table' { + interface ColumnMeta { + className?: string + } +} \ No newline at end of file