-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UI v2] feat: Consolidates components for automation(s) routes
- Loading branch information
1 parent
310612b
commit 98932c2
Showing
8 changed files
with
134 additions
and
49 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
ui-v2/src/components/automations/automation-details/automation-details.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { createFakeAutomation } from "@/mocks"; | ||
import { reactQueryDecorator, routerDecorator } from "@/storybook/utils"; | ||
import { AutomationDetails } from "./automation-details"; | ||
|
||
const meta: Meta<typeof AutomationDetails> = { | ||
title: "Components/Automations/AutomationDetails", | ||
decorators: [routerDecorator, reactQueryDecorator], | ||
component: AutomationDetails, | ||
args: { data: createFakeAutomation() }, | ||
}; | ||
export default meta; | ||
|
||
export const Page: StoryObj = { | ||
args: { displayType: "page" }, | ||
}; | ||
|
||
export const Item: StoryObj = { | ||
args: { displayType: "item" }, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export { AutomationDetails } from "./automation-details"; | ||
export type { DisplayType } from "./nav-header"; |
57 changes: 57 additions & 0 deletions
57
ui-v2/src/components/automations/automation-details/nav-header.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import type { Automation } from "@/api/automations"; | ||
import { | ||
Breadcrumb, | ||
BreadcrumbItem, | ||
BreadcrumbLink, | ||
BreadcrumbList, | ||
BreadcrumbPage, | ||
BreadcrumbSeparator, | ||
} from "@/components/ui/breadcrumb"; | ||
|
||
export type DisplayType = "page" | "item"; | ||
|
||
type NavHeaderProps = { | ||
data: Automation; | ||
displayType: DisplayType; | ||
}; | ||
|
||
export const NavHeader = ({ displayType, data }: NavHeaderProps) => { | ||
if (displayType === "page") { | ||
return ( | ||
<div className="flex items-center gap-2"> | ||
<Breadcrumb> | ||
<BreadcrumbList> | ||
<BreadcrumbItem> | ||
<BreadcrumbLink | ||
to="/automations" | ||
className="text-xl font-semibold" | ||
> | ||
Automations | ||
</BreadcrumbLink> | ||
</BreadcrumbItem> | ||
<BreadcrumbSeparator /> | ||
<BreadcrumbItem className="text-xl font-semibold"> | ||
<BreadcrumbPage>{data.name}</BreadcrumbPage> | ||
</BreadcrumbItem> | ||
</BreadcrumbList> | ||
</Breadcrumb> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<Breadcrumb> | ||
<BreadcrumbList> | ||
<BreadcrumbItem className="text-xl"> | ||
<BreadcrumbLink | ||
to="/automations/automation/$id" | ||
params={{ id: data.id }} | ||
className="text-lg" | ||
> | ||
{data.name} | ||
</BreadcrumbLink> | ||
</BreadcrumbItem> | ||
</BreadcrumbList> | ||
</Breadcrumb> | ||
); | ||
}; |
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
ui-v2/src/components/automations/automation-page/nav-header.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters