@nhatdev94/common-ui 1.3.7 → 1.3.9
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.
- package/README.md +60 -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,66 @@ export default async function DemoPage() {
|
|
|
51
50
|
}
|
|
52
51
|
```
|
|
53
52
|
|
|
54
|
-
-
|
|
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
|
+
|
|
86
|
+
Next, we'll create a <DataTable /> component to render our table.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
// app/payments/page.tsx
|
|
90
|
+
|
|
91
|
+
import { columns, Payment } from "./columns"
|
|
92
|
+
import { DataTable } from "@nhatdev94/common-ui"
|
|
93
|
+
|
|
94
|
+
export default async function DemoPage() {
|
|
95
|
+
const data: Payment[] = [
|
|
96
|
+
{
|
|
97
|
+
id: "728ed52f",
|
|
98
|
+
amount: 100,
|
|
99
|
+
status: "pending",
|
|
100
|
+
email: "m@example.com",
|
|
101
|
+
},
|
|
102
|
+
// ...
|
|
103
|
+
]
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<div className="container mx-auto py-10">
|
|
107
|
+
<DataTable columns={columns} data={data} />
|
|
108
|
+
</div>
|
|
109
|
+
)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
```
|
|
55
113
|
|
|
56
114
|
------------------------------------------------------------------------
|
|
57
115
|
|