-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
housekeeping: Updating Storybook to v8 (#3125)
- Loading branch information
Showing
13 changed files
with
988 additions
and
4,072 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import { addons } from "@storybook/addons"; | ||
import { addons } from "@storybook/manager-api"; | ||
import storybookTheme from "./theme"; | ||
|
||
addons.setConfig({ | ||
theme: storybookTheme, | ||
}); | ||
}); |
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
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
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
116 changes: 62 additions & 54 deletions
116
frontend/packages/core/src/AppLayout/stories/header.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 |
---|---|---|
@@ -1,62 +1,70 @@ | ||
import * as React from "react"; | ||
import { MemoryRouter } from "react-router"; | ||
import type { Meta } from "@storybook/react"; | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
|
||
import { ApplicationContext } from "../../Contexts/app-context"; | ||
import HeaderComponent from "../header"; | ||
import { ApplicationContext, UserPreferencesProvider } from "../../Contexts"; | ||
import { Header } from "../header"; | ||
|
||
export default { | ||
title: "Core/AppLayout/Header", | ||
component: HeaderComponent, | ||
const workflows = [ | ||
{ | ||
developer: { name: "Lyft", contactUrl: "mailto:hello@clutch.sh" }, | ||
displayName: "EC2", | ||
group: "AWS", | ||
icon: { path: "" }, | ||
path: "ec2", | ||
routes: [ | ||
{ | ||
component: () => <div>Terminate Instance</div>, | ||
componentProps: { resolverType: "clutch.aws.ec2.v1.Instance" }, | ||
description: "Terminate an EC2 instance.", | ||
displayName: "Terminate Instance", | ||
path: "instance/terminate", | ||
requiredConfigProps: ["resolverType"], | ||
trending: true, | ||
}, | ||
{ | ||
component: () => <div>Resize ASG</div>, | ||
componentProps: { resolverType: "clutch.aws.ec2.v1.AutoscalingGroup" }, | ||
description: "Resize an autoscaling group.", | ||
displayName: "Resize Autoscaling Group", | ||
path: "asg/resize", | ||
requiredConfigProps: ["resolverType"], | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
const meta: Meta<typeof Header> = { | ||
title: "Core/Layout/Header", | ||
component: Header, | ||
argTypes: { | ||
logo: { | ||
control: "text", | ||
}, | ||
}, | ||
decorators: [ | ||
() => ( | ||
<MemoryRouter> | ||
<HeaderComponent /> | ||
</MemoryRouter> | ||
), | ||
StoryFn => { | ||
return ( | ||
<ApplicationContext.Provider | ||
// eslint-disable-next-line react/jsx-no-constructed-context-values | ||
value={{ | ||
workflows: [ | ||
{ | ||
developer: { name: "Lyft", contactUrl: "mailto:hello@clutch.sh" }, | ||
displayName: "EC2", | ||
group: "AWS", | ||
icon: { path: "" }, | ||
path: "ec2", | ||
routes: [ | ||
{ | ||
component: () => <div>Terminate Instance</div>, | ||
componentProps: { resolverType: "clutch.aws.ec2.v1.Instance" }, | ||
description: "Terminate an EC2 instance.", | ||
displayName: "Terminate Instance", | ||
path: "instance/terminate", | ||
requiredConfigProps: ["resolverType"], | ||
trending: true, | ||
}, | ||
{ | ||
component: () => <div>Resize ASG</div>, | ||
componentProps: { resolverType: "clutch.aws.ec2.v1.AutoscalingGroup" }, | ||
description: "Resize an autoscaling group.", | ||
displayName: "Resize Autoscaling Group", | ||
path: "asg/resize", | ||
requiredConfigProps: ["resolverType"], | ||
}, | ||
], | ||
}, | ||
], | ||
}} | ||
> | ||
StoryFn => ( | ||
<ApplicationContext.Provider | ||
// eslint-disable-next-line react/jsx-no-constructed-context-values | ||
value={{ | ||
workflows, | ||
}} | ||
> | ||
<UserPreferencesProvider> | ||
<StoryFn /> | ||
</ApplicationContext.Provider> | ||
); | ||
}, | ||
</UserPreferencesProvider> | ||
</ApplicationContext.Provider> | ||
), | ||
], | ||
parameters: { | ||
layout: "fullscreen", | ||
}, | ||
} as Meta; | ||
}; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof Header>; | ||
|
||
export const Header: React.FC<{}> = () => <HeaderComponent />; | ||
export const Basic: Story = { | ||
render: args => ( | ||
<MemoryRouter> | ||
<Header {...args} /> | ||
</MemoryRouter> | ||
), | ||
}; |
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
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
Oops, something went wrong.