saleor-dashboard/src/webhooks/components/WebhookCreatePage/WebhooksCreatePage.stories.tsx
2020-03-24 13:54:30 +01:00

30 lines
961 B
TypeScript

import { storiesOf } from "@storybook/react";
import React from "react";
import Decorator from "@saleor/storybook/Decorator";
import { WebhookErrorCode } from "@saleor/types/globalTypes";
import WebhookCreatePage, { WebhookCreatePageProps } from "./WebhookCreatePage";
const props: WebhookCreatePageProps = {
disabled: false,
errors: [],
fetchServiceAccounts: () => undefined,
onBack: () => undefined,
onSubmit: () => undefined,
saveButtonBarState: "default",
services: []
};
storiesOf("Views / Webhooks / Create webhook", module)
.addDecorator(Decorator)
.add("default", () => <WebhookCreatePage {...props} />)
.add("loading", () => <WebhookCreatePage {...props} disabled={true} />)
.add("form errors", () => (
<WebhookCreatePage
{...props}
errors={["name", "targetUrl", "secretKey", null].map(field => ({
__typename: "WebhookError",
code: WebhookErrorCode.INVALID,
field
}))}
/>
));