-
diff --git a/packages/common/components/src/ui/index.ts b/packages/common/components/src/ui/index.ts
index 403cd158e..8b8ec807e 100644
--- a/packages/common/components/src/ui/index.ts
+++ b/packages/common/components/src/ui/index.ts
@@ -15,4 +15,5 @@ export * from "./popover";
export * from "./radio-group";
export * from "./slider";
export * from "./switch";
+export * from "./table";
export * from "./tabs";
diff --git a/packages/common/components/src/ui/table/index.tsx b/packages/common/components/src/ui/table/index.tsx
index 100b16c8f..72c2bd18b 100644
--- a/packages/common/components/src/ui/table/index.tsx
+++ b/packages/common/components/src/ui/table/index.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable @typescript-eslint/no-explicit-any */
import "./table.css";
import {
@@ -6,14 +5,45 @@ import {
getCoreRowModel,
useReactTable,
type ColumnDef,
+ type RowData,
+ type Table,
} from "@tanstack/react-table";
+declare module "@tanstack/react-table" {
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
+ interface ColumnMeta
{
+ align: "left" | "center" | "right";
+ }
+}
+
+function TableHead({ table }: { table: Table }) {
+ return (
+
+ {table.getHeaderGroups().map((headerGroup) => (
+
+ {headerGroup.headers.map((header) => (
+ |
+ {header.isPlaceholder
+ ? null
+ : flexRender(
+ header.column.columnDef.header,
+ header.getContext(),
+ )}
+ |
+ ))}
+
+ ))}
+
+ );
+}
+
interface TableProps {
data: T[];
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
columns: ColumnDef[];
}
-function Table({ data, columns }: TableProps) {
+function BasicTable({ data, columns }: TableProps) {
const table = useReactTable({
data,
columns,
@@ -21,36 +51,23 @@ function Table({ data, columns }: TableProps) {
});
return (
-
-
-
- {table.getHeaderGroups().map((headerGroup) => (
-
- {headerGroup.headers.map((header) => (
- |
- {header.isPlaceholder
- ? null
- : flexRender(
- header.column.columnDef.header,
- header.getContext(),
- )}
- |
- ))}
-
- ))}
-
-
- {table.getRowModel().rows.map((row) => (
-
- {row.getVisibleCells().map((cell) => (
-
+
+
+
+ {table.getRowModel().rows.map((row) => (
+
+ {row.getVisibleCells().map((cell) => {
+ const { meta } = cell.column.columnDef;
+ return (
+ |
{flexRender(cell.column.columnDef.cell, cell.getContext())}
|
- ))}
-
- ))}
-
- {/*
+ );
+ })}
+
+ ))}
+
+ {/*
{table.getFooterGroups().map((footerGroup) => (
{footerGroup.headers.map((header) => (
@@ -66,9 +83,8 @@ function Table({ data, columns }: TableProps) {
))}
*/}
-
-
+ |
);
}
-export { Table };
+export { BasicTable };
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 8533bb2cb..3d7c23e28 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -36,6 +36,9 @@ importers:
'@common/components':
specifier: workspace:*
version: link:../../packages/common/components
+ '@tanstack/react-table':
+ specifier: ^8.21.2
+ version: 8.21.2(react-dom@18.3.1)(react@18.3.1)
next:
specifier: 15.1.7
version: 15.1.7(react-dom@18.3.1)(react@18.3.1)
@@ -43,6 +46,9 @@ importers:
'@eslint/eslintrc':
specifier: ^3
version: 3.3.0
+ '@faker-js/faker':
+ specifier: ^9.5.0
+ version: 9.5.0
'@types/node':
specifier: ^22.13.1
version: 22.13.5
@@ -976,6 +982,11 @@ packages:
levn: 0.4.1
dev: true
+ /@faker-js/faker@9.5.0:
+ resolution: {integrity: sha512-3qbjLv+fzuuCg3umxc9/7YjrEXNaKwHgmig949nfyaTx8eL4FAsvFbu+1JcFUj1YAXofhaDn6JdEUBTYuk0Ssw==}
+ engines: {node: '>=18.0.0', npm: '>=9.0.0'}
+ dev: true
+
/@feature-sliced/filesystem@2.4.0:
resolution: {integrity: sha512-aOFdPACNvkFXYb+gNHId8UCRD5fm7Z9/RV6JgBPlgEvm1QtLS4idg2XeHMDGnHrNRCS4ki+0RauxVZxm+g9pvw==}
dependencies: