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
|
|
|
|
2020-03-23 19:31:05 +00:00
|
|
|
import { DiscountErrorCode } from "@saleor/types/globalTypes";
|
2019-06-19 14:40:52 +00:00
|
|
|
import SaleCreatePage, {
|
|
|
|
SaleCreatePageProps
|
|
|
|
} from "../../../discounts/components/SaleCreatePage";
|
|
|
|
import Decorator from "../../Decorator";
|
|
|
|
|
|
|
|
const props: SaleCreatePageProps = {
|
|
|
|
defaultCurrency: "USD",
|
|
|
|
disabled: false,
|
|
|
|
errors: [],
|
|
|
|
onBack: () => undefined,
|
|
|
|
onSubmit: () => undefined,
|
|
|
|
saveButtonBarState: "default"
|
|
|
|
};
|
|
|
|
|
|
|
|
storiesOf("Views / Discounts / Sale create", module)
|
|
|
|
.addDecorator(Decorator)
|
|
|
|
.add("default", () => <SaleCreatePage {...props} />)
|
|
|
|
.add("loading", () => <SaleCreatePage {...props} disabled={true} />)
|
|
|
|
.add("form errors", () => (
|
|
|
|
<SaleCreatePage
|
|
|
|
{...props}
|
2020-03-23 19:31:05 +00:00
|
|
|
errors={["name", "startDate", "endDate", "value"].map(field => ({
|
|
|
|
__typename: "DiscountError",
|
|
|
|
code: DiscountErrorCode.INVALID,
|
|
|
|
field
|
|
|
|
}))}
|
2019-06-19 14:40:52 +00:00
|
|
|
/>
|
|
|
|
));
|