Files
calendar/packages/ui/components/table/Table.tsx
T
7f6847f7c7 In-app users admin (#8035)
* WIP

* WIP

* Update trpc-router.ts

* Fixes

* Update trpc-router.ts

* Update zod-utils.ts

* Apply suggestions from code review

Co-authored-by: Leo Giovanetti <hello@leog.me>

* Feedback and dark mode fixes

* Feedback

* Fixes

* Update UserForm.tsx

---------

Co-authored-by: Leo Giovanetti <hello@leog.me>
2023-04-14 17:04:48 -07:00

55 lines
1.3 KiB
TypeScript

import { classNames } from "@calcom/lib";
interface TableProps {
children: React.ReactNode;
}
interface DynamicWidth {
widthClassNames?: string;
}
const Header = ({ children }: TableProps) => (
<thead className="rounded-md">
<tr className="bg-default">{children}</tr>
</thead>
);
const ColumnTitle = ({ children, widthClassNames }: TableProps & DynamicWidth) => (
<th
scope="col"
className={classNames(
"text-default p-3 text-left text-xs font-medium uppercase",
!widthClassNames ? "w-auto" : widthClassNames
)}>
{children}
</th>
);
const Body = ({ children }: TableProps) => (
<tbody className="divide-subtle divide-y rounded-md">{children}</tbody>
);
const Row = ({ children }: TableProps) => <tr>{children}</tr>;
const Cell = ({ children, widthClassNames }: TableProps & DynamicWidth) => (
<td
className={classNames(
"text-default relative py-2 px-3 text-sm font-medium",
!widthClassNames ? "w-auto" : widthClassNames
)}>
{children}
</td>
);
export const Table = ({ children }: TableProps) => (
<div className="bg-default border-subtle overflow-x-auto rounded-md border">
<table className="divide-subtle w-full divide-y rounded-md">{children}</table>
</div>
);
Table.Header = Header;
Table.ColumnTitle = ColumnTitle;
Table.Body = Body;
Table.Row = Row;
Table.Cell = Cell;