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",
|
2020-01-09 11:27:57 +00:00
|
|
|
"minSpent",
|
2019-06-19 14:40:52 +00:00
|
|
|
"name",
|
|
|
|
"startDate",
|
|
|
|
"type",
|
|
|
|
"usageLimit",
|
|
|
|
"value"
|
|
|
|
] as Array<keyof FormData>).map(formError)}
|
|
|
|
/>
|
|
|
|
));
|