-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new featured: allow resize to the table
- Loading branch information
Showing
7 changed files
with
226 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
"use client" | ||
|
||
import TableDemo from "@/components/docs/collections/table/table-demo" | ||
import TableResizeDemo from "@/components/docs/collections/table/table-resize-demo" | ||
|
||
export default function Page() { | ||
return <div /> | ||
return ( | ||
<div className="p-32 grid gap-10"> | ||
<TableResizeDemo /> | ||
<TableDemo /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 104 additions & 0 deletions
104
components/docs/collections/table/table-resize-demo.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
"use client" | ||
|
||
import { NumberFormatter } from "@internationalized/number" | ||
import { IconDotsVertical } from "justd-icons" | ||
import { Card, Menu, Table } from "ui" | ||
|
||
export default function TableResizeDemo() { | ||
return ( | ||
<Card> | ||
<Table allowResize aria-label="Vocalists"> | ||
<Table.Header> | ||
<Table.Column className="max-w-0">ID</Table.Column> | ||
<Table.Column isRowHeader isResizable> | ||
Name | ||
</Table.Column> | ||
<Table.Column isResizable>Email</Table.Column> | ||
<Table.Column>Age</Table.Column> | ||
<Table.Column>Role</Table.Column> | ||
<Table.Column isResizable>Band</Table.Column> | ||
<Table.Column>Status</Table.Column> | ||
</Table.Header> | ||
<Table.Body items={items}> | ||
{(item) => ( | ||
<Table.Row id={item.id}> | ||
<Table.Cell>{item.id}</Table.Cell> | ||
<Table.Cell>{item.name}</Table.Cell> | ||
<Table.Cell>{item.email}</Table.Cell> | ||
<Table.Cell>{item.age}</Table.Cell> | ||
<Table.Cell>{item.role}</Table.Cell> | ||
<Table.Cell>{item.band}</Table.Cell> | ||
<Table.Cell>{item.status}</Table.Cell> | ||
</Table.Row> | ||
)} | ||
</Table.Body> | ||
</Table> | ||
</Card> | ||
) | ||
} | ||
|
||
const items = [ | ||
{ | ||
id: 1, | ||
name: "Randy Blythe", | ||
email: "randy.blythe@example.com", | ||
age: 52, | ||
role: "Vocalist", | ||
band: "Lamb of God", | ||
status: "Active" | ||
}, | ||
{ | ||
id: 2, | ||
name: "Phil Anselmo", | ||
email: "phil.anselmo@example.com", | ||
age: 55, | ||
role: "Vocalist", | ||
band: "Pantera", | ||
status: "Active" | ||
}, | ||
{ | ||
id: 3, | ||
name: "George Fisher", | ||
email: "george.fisher@example.com", | ||
age: 53, | ||
role: "Vocalist", | ||
band: "Cannibal Corpse", | ||
status: "Active" | ||
}, | ||
{ | ||
id: 4, | ||
name: "Corey Taylor", | ||
email: "corey.taylor@example.com", | ||
age: 50, | ||
role: "Vocalist", | ||
band: "Slipknot", | ||
status: "Active" | ||
}, | ||
{ | ||
id: 5, | ||
name: "Trevor Strnad", | ||
email: "trevor.strnad@example.com", | ||
age: 41, | ||
role: "Vocalist", | ||
band: "The Black Dahlia Murder", | ||
status: "Inactive" | ||
}, | ||
{ | ||
id: 6, | ||
name: "Chuck Schuldiner", | ||
email: "chuck.schuldiner@example.com", | ||
age: 34, | ||
role: "Vocalist", | ||
band: "Death", | ||
status: "Deceased" | ||
}, | ||
{ | ||
id: 7, | ||
name: "Mitch Lucker", | ||
email: "mitch.lucker@example.com", | ||
age: 28, | ||
role: "Vocalist", | ||
band: "Suicide Silence", | ||
status: "Deceased" | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters