nextui/apps/docs/content/components/table/paginated.raw.jsx
Junior Garcia b8e7b94586
🚀 (#4570)
* docs: optimize route higtlight (#4520)

* docs: optimize home display (#4519)

* docs: optimize home display and route highlight

* docs: optimize home display

* fix(alert): propagate className (#4535)

* fix(alert): propagate className

* chore(alert): remove className from alert theme

* fix(avatar): title type in Avatar (#4529)

* fix(avatar): title type in Avatar

* fix(alert): apply isEmpty check on title

* fix(alert): alert interface props type

* refactor: remove unnecessary props types (#4530)

* refactor(docs): remove string type as it is included in ReactNode

* refactor: remove unnecessary types

* feat(changeset): add changeset

* chore: remove changeset

* refactor: remove null since ReactNode unions it already

* fix(input): use onPress for wrapper click focus (#4483)

* fix(input): use onPress for wrapper click focus

* test(input): wrapper click focus test

* chore(changeset): input onPress for wrapper click focus

* chore(changeset): minor wording

* Refactor/rebrand (#4532)

* chore: rebrand in progress

* chore: update docs to use heroui

* chore: components renbranded

* chore: figma moved to the docs files

* fix: posthog config

* fix(docs): extra classname in form example (#4465)

* chore: clean git

* chore: make heroui private

* chore: new logo

* chore: node env var renamed

* chore: public robots txt deleted

* chore: wrangler installed

* chore: wrangler renamed

* chore: cloudlfare workers removed

* chore: force vercel deploy

* refactor: first migration and provider

* refactor: rename nextui plugin

* refactor: rename github site

* refactor: rename CONTRIBUTING

* refactor: rename package name

* refactor: nextjs image hostname

* refactor: mdx repo nextui-org rename frontio-ai

* refactor: nextui.org rename heroui.com

* refactor: add heroui to missing places

* fix: heroui plugin name

* fix: update docs

* docs: nextui to heroui add npmrc pnpm migratation

* chore: rename all packages with new org name

* chore: replace frontio-ai by frontioai

* chore: revert previous changes

* chore: small adjustment

* chore: doc updated

* feat: blog

* chore: avatar updated

* fix: url

* chore: add new ogimage

* fix: ogimage command

* fix: heroui name and storybook welcome page

* fix: og image url

* feat: favicon and icon changed

---------

Co-authored-by: աӄա <wingkwong.code@gmail.com>
Co-authored-by: winches <329487092@qq.com>

* fix: postbuild script

* chore: core package updates

* ci(changesets): version packages (#4569)

Co-authored-by: Junior Garcia <jrgarciadev@gmail.com>

* feat: contributors added to the blog

---------

Co-authored-by: winches <329487092@qq.com>
Co-authored-by: աӄա <wingkwong.code@gmail.com>
Co-authored-by: Peterl561 <76144929+Peterl561@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-01-16 16:24:32 -03:00

213 lines
3.9 KiB
JavaScript

import {
Table,
TableHeader,
TableColumn,
TableBody,
TableRow,
TableCell,
Pagination,
getKeyValue,
} from "@heroui/react";
export const users = [
{
key: "1",
name: "Tony Reichert",
role: "CEO",
status: "Active",
},
{
key: "2",
name: "Zoey Lang",
role: "Technical Lead",
status: "Paused",
},
{
key: "3",
name: "Jane Fisher",
role: "Senior Developer",
status: "Active",
},
{
key: "4",
name: "William Howard",
role: "Community Manager",
status: "Vacation",
},
{
key: "5",
name: "Emily Collins",
role: "Marketing Manager",
status: "Active",
},
{
key: "6",
name: "Brian Kim",
role: "Product Manager",
status: "Active",
},
{
key: "7",
name: "Laura Thompson",
role: "UX Designer",
status: "Active",
},
{
key: "8",
name: "Michael Stevens",
role: "Data Analyst",
status: "Paused",
},
{
key: "9",
name: "Sophia Nguyen",
role: "Quality Assurance",
status: "Active",
},
{
key: "10",
name: "James Wilson",
role: "Front-end Developer",
status: "Vacation",
},
{
key: "11",
name: "Ava Johnson",
role: "Back-end Developer",
status: "Active",
},
{
key: "12",
name: "Isabella Smith",
role: "Graphic Designer",
status: "Active",
},
{
key: "13",
name: "Oliver Brown",
role: "Content Writer",
status: "Paused",
},
{
key: "14",
name: "Lucas Jones",
role: "Project Manager",
status: "Active",
},
{
key: "15",
name: "Grace Davis",
role: "HR Manager",
status: "Active",
},
{
key: "16",
name: "Elijah Garcia",
role: "Network Administrator",
status: "Active",
},
{
key: "17",
name: "Emma Martinez",
role: "Accountant",
status: "Vacation",
},
{
key: "18",
name: "Benjamin Lee",
role: "Operations Manager",
status: "Active",
},
{
key: "19",
name: "Mia Hernandez",
role: "Sales Manager",
status: "Paused",
},
{
key: "20",
name: "Daniel Lewis",
role: "DevOps Engineer",
status: "Active",
},
{
key: "21",
name: "Amelia Clark",
role: "Social Media Specialist",
status: "Active",
},
{
key: "22",
name: "Jackson Walker",
role: "Customer Support",
status: "Active",
},
{
key: "23",
name: "Henry Hall",
role: "Security Analyst",
status: "Active",
},
{
key: "24",
name: "Charlotte Young",
role: "PR Specialist",
status: "Paused",
},
{
key: "25",
name: "Liam King",
role: "Mobile App Developer",
status: "Active",
},
];
export default function App() {
const [page, setPage] = React.useState(1);
const rowsPerPage = 4;
const pages = Math.ceil(users.length / rowsPerPage);
const items = React.useMemo(() => {
const start = (page - 1) * rowsPerPage;
const end = start + rowsPerPage;
return users.slice(start, end);
}, [page, users]);
return (
<Table
aria-label="Example table with client side pagination"
bottomContent={
<div className="flex w-full justify-center">
<Pagination
isCompact
showControls
showShadow
color="secondary"
page={page}
total={pages}
onChange={(page) => setPage(page)}
/>
</div>
}
classNames={{
wrapper: "min-h-[222px]",
}}
>
<TableHeader>
<TableColumn key="name">NAME</TableColumn>
<TableColumn key="role">ROLE</TableColumn>
<TableColumn key="status">STATUS</TableColumn>
</TableHeader>
<TableBody items={items}>
{(item) => (
<TableRow key={item.name}>
{(columnKey) => <TableCell>{getKeyValue(item, columnKey)}</TableCell>}
</TableRow>
)}
</TableBody>
</Table>
);
}