|
1 |
| -import { action } from "@storybook/addon-actions"; |
2 |
| -import { Story } from "@storybook/react"; |
3 |
| -import { SetupPageView, SetupPageViewProps } from "./SetupPageView"; |
| 1 | +import { SetupPageView } from "./SetupPageView"; |
4 | 2 | import { mockApiError } from "testHelpers/entities";
|
| 3 | +import type { Meta, StoryObj } from "@storybook/react"; |
5 | 4 |
|
6 |
| -export default { |
| 5 | +const meta: Meta<typeof SetupPageView> = { |
7 | 6 | title: "pages/SetupPageView",
|
8 | 7 | component: SetupPageView,
|
9 | 8 | };
|
10 | 9 |
|
11 |
| -const Template: Story<SetupPageViewProps> = (args: SetupPageViewProps) => ( |
12 |
| - <SetupPageView {...args} /> |
13 |
| -); |
| 10 | +export default meta; |
| 11 | +type Story = StoryObj<typeof SetupPageView>; |
14 | 12 |
|
15 |
| -export const Ready = Template.bind({}); |
16 |
| -Ready.args = { |
17 |
| - onSubmit: action("submit"), |
18 |
| -}; |
| 13 | +export const Ready: Story = {}; |
19 | 14 |
|
20 |
| -export const FormError = Template.bind({}); |
21 |
| -FormError.args = { |
22 |
| - onSubmit: action("submit"), |
23 |
| - error: mockApiError({ |
24 |
| - validations: [{ field: "username", detail: "Username taken" }], |
25 |
| - }), |
| 15 | +export const FormError: Story = { |
| 16 | + args: { |
| 17 | + error: mockApiError({ |
| 18 | + validations: [{ field: "username", detail: "Username taken" }], |
| 19 | + }), |
| 20 | + }, |
26 | 21 | };
|
27 | 22 |
|
28 |
| -export const Loading = Template.bind({}); |
29 |
| -Loading.args = { |
30 |
| - onSubmit: action("submit"), |
31 |
| - isLoading: true, |
| 23 | +export const Loading: Story = { |
| 24 | + args: { |
| 25 | + isLoading: true, |
| 26 | + }, |
32 | 27 | };
|
0 commit comments