@nhatdev94/common-ui 1.3.8 → 1.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +59 -2
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -18,7 +18,6 @@ npm install @nhatdev94/common-ui
18
18
  Mở file CSS chính (ví dụ: src/index.css hoặc app/globals.css) và cấu hình:
19
19
  ``` bash
20
20
  @import "tailwindcss";
21
- // src/index.css
22
21
 
23
22
  /* -----------------------------------------------------------
24
23
  * IMPORT THEME
@@ -51,7 +50,65 @@ export default async function DemoPage() {
51
50
  }
52
51
  ```
53
52
 
54
- - [Data Table](./docs/table.md)
53
+ - **Data Table**
54
+ ```bash
55
+ // app/payments/columns.tsx
56
+ // Định nghĩa Column
57
+
58
+ "use client"
59
+
60
+ import { ColumnDef } from "@tanstack/react-table"
61
+
62
+ export type Payment = {
63
+ id: string
64
+ amount: number
65
+ status: "pending" | "processing" | "success" | "failed"
66
+ email: string
67
+ }
68
+
69
+ export const columns: ColumnDef<Payment>[] = [
70
+ {
71
+ accessorKey: "status",
72
+ header: "Status",
73
+ },
74
+ {
75
+ accessorKey: "email",
76
+ header: "Email",
77
+ },
78
+ {
79
+ accessorKey: "amount",
80
+ header: "Amount",
81
+ },
82
+ ]
83
+
84
+ ```
85
+ Tiếp theo, chúng ta sẽ tạo <DataTable /> component để hiển thị bảng của mình.
86
+
87
+ ```bash
88
+ // app/payments/page.tsx
89
+
90
+ import { columns, Payment } from "./columns"
91
+ import { DataTable } from "@nhatdev94/common-ui"
92
+
93
+ export default async function DemoPage() {
94
+ const data: Payment[] = [
95
+ {
96
+ id: "728ed52f",
97
+ amount: 100,
98
+ status: "pending",
99
+ email: "m@example.com",
100
+ },
101
+ // ...
102
+ ]
103
+
104
+ return (
105
+ <div className="container mx-auto py-10">
106
+ <DataTable columns={columns} data={data} />
107
+ </div>
108
+ )
109
+ }
110
+
111
+ ```
55
112
 
56
113
  ------------------------------------------------------------------------
57
114
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nhatdev94/common-ui",
3
- "version": "1.3.8",
3
+ "version": "1.3.10",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",