-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Configuration Detail setup #19021
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configuration Detail setup #19021
Changes from all commits
931fa09
cd927ad
99dc62d
bb15531
7e5cf90
571c570
e6c0a28
277d949
d873f36
e7940c1
96a3ba2
befffa8
174c358
2af5ab5
b6b3de7
5b2ab65
a65b333
98d5053
5989376
248e995
aac77b3
a48f1b8
6094f50
b11b7f6
209e106
b5450c2
ebb1652
6acd1f0
5d6151b
4c921cf
053612c
fd22195
a036a30
dbd30f7
711274c
e8d3b3f
077e0fe
f96c097
fc62dfe
7e91bab
03143d4
163949c
03c2213
d5f267d
9b2c06f
82a2f56
e5b5851
99b8e26
f1c0b73
5a4a5bc
5c7a74e
908ea12
e0c7dcd
1d4a7f1
64c2170
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* 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 classNames from "classnames"; | ||
import { Separator } from "./Separator"; | ||
import { cn } from "@podkit/lib/cn"; | ||
import { SubmenuItem, SubmenuItemProps } from "./PageWithSubMenu"; | ||
|
||
export interface PageWithSubMenuProps { | ||
/** | ||
* The name of the navigation menu, as read by screen readers. | ||
*/ | ||
navTitle?: string; | ||
subMenu: SubmenuItemProps[]; | ||
children: React.ReactNode; | ||
} | ||
|
||
export function WidePageWithSubMenu(p: PageWithSubMenuProps) { | ||
return ( | ||
<div className="w-full"> | ||
<div className={cn("app-container flex flex-col md:flex-row")}> | ||
{/* TODO: extract into SubMenu component and show scrolling indicators */} | ||
<nav aria-label={p.navTitle}> | ||
<ul | ||
className={classNames( | ||
// Handle flipping between row and column layout | ||
"flex flex-row md:flex-col items-center", | ||
"w-full md:w-52 overflow-auto md:overflow-visible", | ||
"pt-4 pb-4 md:pb-0", | ||
"space-x-2 md:space-x-0 md:space-y-2", | ||
"tracking-wide text-gray-500", | ||
)} | ||
> | ||
{p.subMenu.map((e) => { | ||
return <SubmenuItem title={e.title} link={e.link} key={e.title} icon={e.icon} />; | ||
})} | ||
</ul> | ||
</nav> | ||
<div className="md:ml-4 w-full pt-1 mb-40"> | ||
<Separator className="md:hidden" /> | ||
<div className="pt-4 md:pt-0">{p.children}</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/** | ||
* 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 { LinkButton } from "@podkit/buttons/LinkButton"; | ||
import { cn } from "@podkit/lib/cn"; | ||
import { ChevronLeft } from "lucide-react"; | ||
import type { FC } from "react"; | ||
import { MiddleDot } from "../../typography/MiddleDot"; | ||
import { Heading3 } from "@podkit/typography/Headings"; | ||
|
||
interface BreadcrumbPageNavProps { | ||
/** | ||
* The title of the current page. | ||
*/ | ||
pageTitle: string; | ||
/** | ||
* The description of the current page. | ||
*/ | ||
pageDescription?: string; | ||
/** | ||
* The link to the previous page. | ||
*/ | ||
backLink?: string; | ||
className?: string; | ||
} | ||
|
||
export const BreadcrumbNav: FC<BreadcrumbPageNavProps> = ({ pageTitle, pageDescription, backLink, className }) => { | ||
return ( | ||
<section className={cn("flex flex-row items-center justify-start gap-2 w-full py-4 app-container", className)}> | ||
{backLink && ( | ||
<LinkButton | ||
variant={"ghost"} | ||
className="py-1 px-0 hover:bg-gray-200 dark:hover:bg-gray-800 dark:hover:text-gray-200" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We ought to have a more bare-bones There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The fixes to ghosts are actually done in #19039. Nice! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe once we've completed this suite of config UIs we can kind of recap buttons and how we used them. |
||
href={backLink} | ||
> | ||
<ChevronLeft size={24} /> | ||
</LinkButton> | ||
)} | ||
<Heading3 asChild> | ||
<h1>{pageTitle}</h1> | ||
</Heading3> | ||
<MiddleDot /> | ||
<p className="text-gray-900 dark:text-gray-300 text-lg">{pageDescription}</p> | ||
</section> | ||
); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/** | ||
* 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 { FC } from "react"; | ||
import { useParams } from "react-router"; | ||
import { ConfigurationNameForm } from "./general/ConfigurationName"; | ||
import { ConfigurationDetailPage } from "./ConfigurationDetailPage"; | ||
import { useConfiguration } from "../../data/configurations/configuration-queries"; | ||
import { RemoveConfiguration } from "./general/RemoveConfiguration"; | ||
|
||
type PageRouteParams = { | ||
id: string; | ||
}; | ||
const ConfigurationDetailGeneral: FC = () => { | ||
const { id } = useParams<PageRouteParams>(); | ||
const configurationQuery = useConfiguration(id); | ||
const { data } = configurationQuery; | ||
|
||
return ( | ||
<ConfigurationDetailPage configurationQuery={configurationQuery} id={id}> | ||
{data && ( | ||
<> | ||
<ConfigurationNameForm configuration={data} /> | ||
<RemoveConfiguration configuration={data} /> | ||
</> | ||
)} | ||
</ConfigurationDetailPage> | ||
); | ||
}; | ||
|
||
export default ConfigurationDetailGeneral; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not necessarily love that I had to introduce yet another component which is oh so similar to the
PageWithSubmenu
, but I did not want to make invasive changes to the component we use in many other places in the Dashboard, and at the same time, keep up with the current designs. Tried to re-use code when possible here to reduce the footprint.