import React, {SVGProps} from "react"; import { Table, TableHeader, TableColumn, TableBody, TableRow, TableCell, User, Chip, Tooltip, ChipProps, } from "@heroui/react"; export type IconSvgProps = SVGProps & { size?: number; }; export const columns = [ {name: "NAME", uid: "name"}, {name: "ROLE", uid: "role"}, {name: "STATUS", uid: "status"}, {name: "ACTIONS", uid: "actions"}, ]; export const users = [ { id: 1, name: "Tony Reichert", role: "CEO", team: "Management", status: "active", age: "29", avatar: "https://i.pravatar.cc/150?u=a042581f4e29026024d", email: "tony.reichert@example.com", }, { id: 2, name: "Zoey Lang", role: "Technical Lead", team: "Development", status: "paused", age: "25", avatar: "https://i.pravatar.cc/150?u=a042581f4e29026704d", email: "zoey.lang@example.com", }, { id: 3, name: "Jane Fisher", role: "Senior Developer", team: "Development", status: "active", age: "22", avatar: "https://i.pravatar.cc/150?u=a04258114e29026702d", email: "jane.fisher@example.com", }, { id: 4, name: "William Howard", role: "Community Manager", team: "Marketing", status: "vacation", age: "28", avatar: "https://i.pravatar.cc/150?u=a048581f4e29026701d", email: "william.howard@example.com", }, { id: 5, name: "Kristen Copper", role: "Sales Manager", team: "Sales", status: "active", age: "24", avatar: "https://i.pravatar.cc/150?u=a092581d4ef9026700d", email: "kristen.cooper@example.com", }, ]; export const EyeIcon = (props: IconSvgProps) => { return ( ); }; export const DeleteIcon = (props: IconSvgProps) => { return ( ); }; export const EditIcon = (props: IconSvgProps) => { return ( ); }; const statusColorMap: Record = { active: "success", paused: "danger", vacation: "warning", }; type User = (typeof users)[0]; export default function App() { const renderCell = React.useCallback((user: User, columnKey: React.Key) => { const cellValue = user[columnKey as keyof User]; switch (columnKey) { case "name": return ( {user.email} ); case "role": return (

{cellValue}

{user.team}

); case "status": return ( {cellValue} ); case "actions": return (
); default: return cellValue; } }, []); return ( {(column) => ( {column.name} )} {(item) => ( {(columnKey) => {renderCell(item, columnKey)}} )}
); }