From 02621d05d848b0c058ca4a09f1b6b06acd78948e Mon Sep 17 00:00:00 2001 From: ghost2023 Date: Wed, 10 Jun 2026 10:02:09 +0300 Subject: [PATCH] chore: migrate to mantine from shadcn for datatable --- .../src/components/data-table/error.tsx | 10 ++--- .../src/components/data-table/skeleton.tsx | 10 ++--- .../src/components/data-table/table.tsx | 41 ++++++++----------- 3 files changed, 27 insertions(+), 34 deletions(-) diff --git a/packages/ui-common/src/components/data-table/error.tsx b/packages/ui-common/src/components/data-table/error.tsx index e240784d7..6db0a7fef 100644 --- a/packages/ui-common/src/components/data-table/error.tsx +++ b/packages/ui-common/src/components/data-table/error.tsx @@ -1,6 +1,6 @@ +import { Table } from "@mantine/core"; import { Table as TanstackTable } from "@tanstack/react-table"; -import { TableCell, TableRow } from "../table"; import { Button } from "../button"; export function DataTableError({ @@ -15,8 +15,8 @@ export function DataTableError({ onRetry?: () => void; }) { return ( - - + +
@@ -34,7 +34,7 @@ export function DataTableError({ )}
- - + + ); } diff --git a/packages/ui-common/src/components/data-table/skeleton.tsx b/packages/ui-common/src/components/data-table/skeleton.tsx index 307f47bdc..bd6ffed36 100644 --- a/packages/ui-common/src/components/data-table/skeleton.tsx +++ b/packages/ui-common/src/components/data-table/skeleton.tsx @@ -1,16 +1,16 @@ +import { Table } from "@mantine/core"; import { Table as TanstackTable } from "@tanstack/react-table"; import { Skeleton } from "../skeleton"; -import { TableCell, TableRow } from "../table"; export function DataTableSkeleton({ table }: { table: TanstackTable }) { return Array.from({ length: 10 }).map((_, i) => ( - + {table.getAllColumns().map((column) => ( - + - + ))} - + )); } diff --git a/packages/ui-common/src/components/data-table/table.tsx b/packages/ui-common/src/components/data-table/table.tsx index adbd6e428..5dbe7277b 100644 --- a/packages/ui-common/src/components/data-table/table.tsx +++ b/packages/ui-common/src/components/data-table/table.tsx @@ -4,14 +4,7 @@ import { getPaginationRowModel, useReactTable, } from "@tanstack/react-table"; -import { - Table, - TableBody, - TableCell, - TableHead, - TableHeader, - TableRow, -} from "../table"; +import { Table } from "@mantine/core"; import { DataTableProps } from "./types"; import { DataTableSkeleton } from "./skeleton"; import { DataTableError } from "./error"; @@ -56,12 +49,12 @@ export function DataTable({ <>
- + {table.getHeaderGroups().map((headerGroup) => ( - + {headerGroup.headers.map((header) => { return ( - ) @@ -75,13 +68,13 @@ export function DataTable({ header.column.columnDef.header, header.getContext(), )} - + ); })} - + ))} - - + + {status === "loading" && } {status === "error" && ( ({ {status === "success" && (table.getRowModel().rows?.length ? ( table.getRowModel().rows.map((row) => ( - { @@ -129,7 +122,7 @@ export function DataTable({ } > {row.getVisibleCells().map((cell) => ( - ) @@ -140,21 +133,21 @@ export function DataTable({ cell.column.columnDef.cell, cell.getContext(), )} - + ))} - + )) ) : ( - - + {emptyMessage ?? "No data"} - - + + ))} - +