saleor-dashboard/src/storybook/stories/discounts/VoucherCreatePage.tsx
Krzysztof Wolski a82de30309
Add circleci config and enhance our linters (#519)
* Add circleci config

* Season linting config

* Apply code style
2020-05-14 11:30:32 +02:00

43 lines
1.1 KiB
TypeScript

import { DiscountErrorCode } from "@saleor/types/globalTypes";
import { storiesOf } from "@storybook/react";
import React from "react";
import VoucherCreatePage, {
FormData,
VoucherCreatePageProps
} from "../../../discounts/components/VoucherCreatePage";
import Decorator from "../../Decorator";
const props: VoucherCreatePageProps = {
defaultCurrency: "USD",
disabled: false,
errors: [],
onBack: () => undefined,
onSubmit: () => undefined,
saveButtonBarState: "default"
};
storiesOf("Views / Discounts / Voucher create", module)
.addDecorator(Decorator)
.add("default", () => <VoucherCreatePage {...props} />)
.add("form errors", () => (
<VoucherCreatePage
{...props}
errors={([
"applyOncePerOrder",
"code",
"discountType",
"endDate",
"minSpent",
"name",
"startDate",
"type",
"usageLimit",
"value"
] as Array<keyof FormData>).map(field => ({
__typename: "DiscountError",
code: DiscountErrorCode.INVALID,
field
}))}
/>
));