saleor-dashboard/src/webhooks/components/WebhookCreatePage/WebhooksCreatePage.stories.tsx

31 lines
961 B
TypeScript
Raw Normal View History

2019-10-10 12:48:19 +00:00
import { storiesOf } from "@storybook/react";
import React from "react";
import Decorator from "@saleor/storybook/Decorator";
2019-10-18 12:01:26 +00:00
import { WebhookErrorCode } from "@saleor/types/globalTypes";
2019-10-10 12:48:19 +00:00
import WebhookCreatePage, { WebhookCreatePageProps } from "./WebhookCreatePage";
const props: WebhookCreatePageProps = {
disabled: false,
errors: [],
2019-10-17 11:59:18 +00:00
fetchServiceAccounts: () => undefined,
2019-10-10 12:48:19 +00:00
onBack: () => undefined,
onSubmit: () => undefined,
saveButtonBarState: "default",
services: []
};
2019-10-17 13:52:30 +00:00
storiesOf("Views / Webhooks / Create webhook", module)
2019-10-10 12:48:19 +00:00
.addDecorator(Decorator)
.add("default", () => <WebhookCreatePage {...props} />)
.add("loading", () => <WebhookCreatePage {...props} disabled={true} />)
.add("form errors", () => (
<WebhookCreatePage
{...props}
2020-03-18 11:03:20 +00:00
errors={["name", "targetUrl", "secretKey", null].map(field => ({
2019-10-18 12:01:26 +00:00
__typename: "WebhookError",
2020-03-18 11:03:20 +00:00
code: WebhookErrorCode.INVALID,
field
2019-10-18 12:01:26 +00:00
}))}
2019-10-10 12:48:19 +00:00
/>
));