Skip to content

Commit 266abdc

Browse files
committed
shift import button to search row
1 parent 56c86e8 commit 266abdc

File tree

4 files changed

+14
-23
lines changed

4 files changed

+14
-23
lines changed

components/dashboard/src/components/Header.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ import { useLocation } from "react-router";
88
import { useDocumentTitle } from "../hooks/use-document-title";
99
import { Separator } from "./Separator";
1010
import TabMenuItem from "./TabMenuItem";
11-
import { Heading1, Subheading } from "@podkit/typography/Headings";
11+
import { PageHeading } from "@podkit/layout/PageHeading";
1212

1313
export interface HeaderProps {
1414
title: string;
15-
complexTitle?: React.ReactElement;
1615
subtitle: string | React.ReactElement;
1716
tabs?: TabEntry[];
1817
}
@@ -28,16 +27,8 @@ export default function Header(p: HeaderProps) {
2827
useDocumentTitle(`${p.title}`);
2928
return (
3029
<div className="app-container border-gray-200 dark:border-gray-800">
31-
<div className="flex pb-8 pt-6">
32-
<div className="w-full">
33-
{p.complexTitle ? p.complexTitle : <Heading1 tracking="tight">{p.title}</Heading1>}
34-
{typeof p.subtitle === "string" ? (
35-
<Subheading tracking="wide">{p.subtitle}</Subheading>
36-
) : (
37-
p.subtitle
38-
)}
39-
</div>
40-
</div>
30+
<PageHeading title={p.title} subtitle={p.subtitle} />
31+
4132
<nav className="flex">
4233
{p.tabs?.map((entry) => (
4334
<TabMenuItem

components/dashboard/src/components/podkit/layout/PageHeading.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,16 @@ import { Heading1, Subheading } from "@podkit/typography/Headings";
88
import { FC, ReactNode } from "react";
99

1010
type PageHeadingProps = {
11-
title: string;
12-
subtitle?: string;
13-
action?: ReactNode;
11+
title: ReactNode;
12+
subtitle?: ReactNode;
1413
};
15-
export const PageHeading: FC<PageHeadingProps> = ({ title, subtitle, action }) => {
14+
export const PageHeading: FC<PageHeadingProps> = ({ title, subtitle }) => {
1615
return (
1716
<div className="flex flex-row flex-wrap justify-between py-8 gap-2">
1817
<div>
1918
<Heading1>{title}</Heading1>
2019
{subtitle && <Subheading>{subtitle}</Subheading>}
2120
</div>
22-
{action && action}
2321
</div>
2422
);
2523
};

components/dashboard/src/repositories/list/RepositoryList.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { FC, useCallback, useEffect, useMemo, useState } from "react";
88
import { useHistory } from "react-router-dom";
99
import { useListConfigurations } from "../../data/configurations/configuration-queries";
1010
import { PageHeading } from "@podkit/layout/PageHeading";
11-
import { Button } from "@podkit/buttons/Button";
1211
import { useDocumentTitle } from "../../hooks/use-document-title";
1312
import { ImportRepositoryModal } from "../create/ImportRepositoryModal";
1413
import type { Configuration } from "@gitpod/public-api/lib/gitpod/v1/configuration_pb";
@@ -88,9 +87,6 @@ const RepositoryListPage: FC = () => {
8887
<PageHeading
8988
title="Imported repositories"
9089
subtitle="Configure and refine the experience of working with a repository in Gitpod"
91-
action={
92-
showTable && <Button onClick={() => setShowCreateProjectModal(true)}>Import Repository</Button>
93-
}
9490
/>
9591

9692
{isLoading && <LoadingState />}
@@ -106,6 +102,7 @@ const RepositoryListPage: FC = () => {
106102
isFetchingNextPage={isFetchingNextPage}
107103
hasNextPage={!!hasNextPage}
108104
hasMoreThanOnePage={hasMoreThanOnePage}
105+
onImport={() => setShowCreateProjectModal(true)}
109106
onLoadNextPage={() => fetchNextPage()}
110107
onSearchTermChange={setSearchTerm}
111108
onSort={handleSort}

components/dashboard/src/repositories/list/RepositoryTable.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { Subheading } from "@podkit/typography/Headings";
1515
import { cn } from "@podkit/lib/cn";
1616
import { SortableTableHead, TableSortOrder } from "@podkit/tables/SortableTable";
1717
import { LoadingState } from "@podkit/loading/LoadingState";
18+
import { Button } from "@podkit/buttons/Button";
1819

1920
type Props = {
2021
configurations: Configuration[];
@@ -25,6 +26,7 @@ type Props = {
2526
hasMoreThanOnePage: boolean;
2627
isSearching: boolean;
2728
isFetchingNextPage: boolean;
29+
onImport: () => void;
2830
onSearchTermChange: (val: string) => void;
2931
onLoadNextPage: () => void;
3032
onSort: (columnName: string, direction: TableSortOrder) => void;
@@ -39,6 +41,7 @@ export const RepositoryTable: FC<Props> = ({
3941
hasMoreThanOnePage,
4042
isSearching,
4143
isFetchingNextPage,
44+
onImport,
4245
onSearchTermChange,
4346
onLoadNextPage,
4447
onSort,
@@ -47,7 +50,7 @@ export const RepositoryTable: FC<Props> = ({
4750
<>
4851
{/* Search/Filter bar */}
4952
<div className="flex flex-row flex-wrap justify-between items-center">
50-
<div className="flex flex-row flex-wrap gap-2 items-center">
53+
<div className="flex flex-row flex-wrap items-center">
5154
{/* TODO: Add search icon on left and decide on pulling Inputs into podkit */}
5255
<TextInput
5356
className="w-80"
@@ -57,8 +60,10 @@ export const RepositoryTable: FC<Props> = ({
5760
/>
5861
{/* TODO: Add prebuild status filter dropdown */}
5962
</div>
63+
64+
<Button onClick={onImport}>Import Repository</Button>
6065
</div>
61-
<div className="relative w-full overflow-auto mt-2">
66+
<div className="relative w-full overflow-auto mt-4">
6267
{configurations.length > 0 ? (
6368
<Table>
6469
<TableHeader>

0 commit comments

Comments
 (0)