diff --git a/components/dashboard/src/components/podkit/tables/Table.tsx b/components/dashboard/src/components/podkit/tables/Table.tsx new file mode 100644 index 00000000000000..e9cf888cc4010a --- /dev/null +++ b/components/dashboard/src/components/podkit/tables/Table.tsx @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2023 Gitpod GmbH. All rights reserved. + * Licensed under the GNU Affero General Public License (AGPL). + * See License.AGPL.txt in the project root for license information. + */ + +import { cn } from "@podkit/lib/cn"; +import React from "react"; + +type HideableCellProps = { + hideOnSmallScreen?: boolean; +}; + +export const Table = React.forwardRef>( + ({ className, ...props }, ref) => { + return ( +
+ + + ); + }, +); +Table.displayName = "Table"; + +export const TableHeader = React.forwardRef>( + ({ className, ...props }, ref) => { + return ( + + ); + }, +); +TableHeader.displayName = "TableHeader"; + +export const TableRow = React.forwardRef>( + ({ className, ...props }, ref) => { + return ; + }, +); +TableRow.displayName = "TableRow"; + +export const TableHead = React.forwardRef< + HTMLTableCellElement, + React.ThHTMLAttributes & HideableCellProps +>(({ hideOnSmallScreen, className, ...props }, ref) => { + return + ); + }, +); +TableBody.displayName = "TableBody"; + +export const TableCell = React.forwardRef< + HTMLTableCellElement, + React.TdHTMLAttributes & HideableCellProps +>(({ hideOnSmallScreen, className, ...props }, ref) => { + return - + - + - + {created} - + - - + + ); }; diff --git a/components/dashboard/src/repositories/list/RepositoryList.tsx b/components/dashboard/src/repositories/list/RepositoryList.tsx index 317086270eeb93..578c65c6145097 100644 --- a/components/dashboard/src/repositories/list/RepositoryList.tsx +++ b/components/dashboard/src/repositories/list/RepositoryList.tsx @@ -18,6 +18,7 @@ import { PageHeading } from "@podkit/layout/PageHeading"; import { Button } from "@podkit/buttons/Button"; import { useDocumentTitle } from "../../hooks/use-document-title"; import { PaginationControls, PaginationCountText } from "./PaginationControls"; +import { Table, TableBody, TableHead, TableHeader, TableRow } from "@podkit/tables/Table"; const RepositoryListPage: FC = () => { useDocumentTitle("Imported repositories"); @@ -97,30 +98,38 @@ const RepositoryListPage: FC = () => {
-
; +}); +TableHead.displayName = "TableHead"; + +export const TableBody = React.forwardRef>( + ({ className, ...props }, ref) => { + return ( +
; +}); +TableCell.displayName = "TableCell"; diff --git a/components/dashboard/src/repositories/list/RepoListItem.tsx b/components/dashboard/src/repositories/list/RepoListItem.tsx index 18e231d0e1dd39..1c3b315a6d20aa 100644 --- a/components/dashboard/src/repositories/list/RepoListItem.tsx +++ b/components/dashboard/src/repositories/list/RepoListItem.tsx @@ -12,6 +12,7 @@ import { Configuration } from "@gitpod/public-api/lib/gitpod/v1/configuration_pb import { LinkButton } from "@podkit/buttons/LinkButton"; import { cn } from "@podkit/lib/cn"; import { AlertTriangleIcon, CheckCircle2Icon } from "lucide-react"; +import { TableCell, TableRow } from "@podkit/tables/Table"; type Props = { configuration: Configuration; @@ -25,21 +26,22 @@ export const RepositoryListItem: FC = ({ configuration }) => { .toLocaleDateString("en-US", { year: "numeric", month: "short", day: "numeric" }) ?? ""; return ( -
+ +
{configuration.name} + {/* We show the url on a 2nd line for smaller screens since we hide the column */} {url}
-
+ {url} - {created} +
{prebuildsEnabled ? ( @@ -47,17 +49,17 @@ export const RepositoryListItem: FC = ({ configuration }) => { )} - + {prebuildsEnabled ? "Enabled" : "Disabled"}
-
+ View -
+
{/* TODO: Add sorting controls */} - - - - - - + + + Name + Repository + + Created + + + Prebuilds + {/* Action column, loading status in header */} - - - - + + + + {data?.configurations.map((configuration) => ( ))} - -
NameRepositoryCreatedPrebuilds + {isFetching && isPreviousData && (
- + {/* TODO: Make a LoadingIcon component */} +
)} -
+ + {totalPages > 1 && (