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-17 18:01:38 +00:00
|
|
|
import { ShippingErrorCode } from "@saleor/types/globalTypes";
|
2020-02-11 15:32:47 +00:00
|
|
|
import { warehouseList } from "@saleor/warehouses/fixtures";
|
|
|
|
import { fetchMoreProps, searchPageProps } from "@saleor/fixtures";
|
2019-06-19 14:40:52 +00:00
|
|
|
import ShippingZoneDetailsPage, {
|
|
|
|
ShippingZoneDetailsPageProps
|
|
|
|
} from "../../../shipping/components/ShippingZoneDetailsPage";
|
|
|
|
import { shippingZone } from "../../../shipping/fixtures";
|
|
|
|
import Decorator from "../../Decorator";
|
|
|
|
|
|
|
|
const props: ShippingZoneDetailsPageProps = {
|
2020-02-11 15:32:47 +00:00
|
|
|
...fetchMoreProps,
|
|
|
|
...searchPageProps,
|
2019-06-19 14:40:52 +00:00
|
|
|
disabled: false,
|
|
|
|
errors: [],
|
|
|
|
onBack: () => undefined,
|
|
|
|
onCountryAdd: () => undefined,
|
|
|
|
onCountryRemove: () => undefined,
|
|
|
|
onDelete: () => undefined,
|
|
|
|
onPriceRateAdd: () => undefined,
|
|
|
|
onPriceRateEdit: () => undefined,
|
|
|
|
onRateRemove: () => undefined,
|
|
|
|
onSubmit: () => undefined,
|
2020-02-11 15:32:47 +00:00
|
|
|
onWarehouseAdd: () => undefined,
|
2019-06-19 14:40:52 +00:00
|
|
|
onWeightRateAdd: () => undefined,
|
|
|
|
onWeightRateEdit: () => undefined,
|
|
|
|
saveButtonBarState: "default",
|
2020-02-11 15:32:47 +00:00
|
|
|
shippingZone,
|
|
|
|
warehouses: warehouseList
|
2019-06-19 14:40:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
storiesOf("Views / Shipping / Shipping zone details", module)
|
|
|
|
.addDecorator(Decorator)
|
|
|
|
.add("default", () => <ShippingZoneDetailsPage {...props} />)
|
|
|
|
.add("loading", () => (
|
|
|
|
<ShippingZoneDetailsPage
|
|
|
|
{...props}
|
|
|
|
disabled={true}
|
|
|
|
shippingZone={undefined}
|
|
|
|
/>
|
|
|
|
))
|
|
|
|
.add("form errors", () => (
|
2020-03-17 18:01:38 +00:00
|
|
|
<ShippingZoneDetailsPage
|
|
|
|
{...props}
|
|
|
|
errors={["name"].map(field => ({
|
|
|
|
__typename: "ShippingError",
|
|
|
|
code: ShippingErrorCode.INVALID,
|
|
|
|
field
|
|
|
|
}))}
|
|
|
|
/>
|
2019-06-19 14:40:52 +00:00
|
|
|
));
|