saleor-dashboard/src/storybook/stories/discounts/VoucherCreatePage.tsx

40 lines
966 B
TypeScript
Raw Normal View History

2019-06-19 14:40:52 +00:00
import { storiesOf } from "@storybook/react";
2019-08-09 10:26:22 +00:00
import React from "react";
2019-06-19 14:40:52 +00:00
import VoucherCreatePage, {
FormData,
VoucherCreatePageProps
} from "../../../discounts/components/VoucherCreatePage";
import Decorator from "../../Decorator";
import { formError } from "../../misc";
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",
"minAmountSpent",
"name",
"startDate",
"type",
"usageLimit",
"value"
] as Array<keyof FormData>).map(formError)}
/>
));