2021-05-06 11:38:15 +00:00
|
|
|
import Decorator from "@saleor/storybook/Decorator";
|
|
|
|
import { storiesOf } from "@storybook/react";
|
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
import { countries, order as orderFixture } from "../../fixtures";
|
|
|
|
import OrderCustomerAddressesEditDialog, {
|
2022-06-21 09:36:55 +00:00
|
|
|
OrderCustomerAddressesEditDialogProps,
|
2022-02-02 11:22:39 +00:00
|
|
|
} from ".";
|
|
|
|
import { AddressEditDialogVariant } from "./types";
|
2021-05-06 11:38:15 +00:00
|
|
|
|
|
|
|
const order = orderFixture("");
|
|
|
|
|
|
|
|
const props: OrderCustomerAddressesEditDialogProps = {
|
|
|
|
confirmButtonState: "default",
|
2022-02-02 11:22:39 +00:00
|
|
|
variant: AddressEditDialogVariant.CHANGE_CUSTOMER,
|
2021-05-06 11:38:15 +00:00
|
|
|
loading: false,
|
|
|
|
onClose: () => undefined,
|
|
|
|
onConfirm: () => undefined,
|
|
|
|
open: true,
|
2022-02-02 11:22:39 +00:00
|
|
|
errors: undefined,
|
2022-06-21 09:36:55 +00:00
|
|
|
countries,
|
2021-05-06 11:38:15 +00:00
|
|
|
};
|
|
|
|
|
2022-02-02 11:22:39 +00:00
|
|
|
storiesOf("Orders / Changing address in order", module)
|
2021-05-06 11:38:15 +00:00
|
|
|
.addDecorator(Decorator)
|
2022-02-02 11:22:39 +00:00
|
|
|
.add("address change when customer is changed", () => (
|
2021-05-06 11:38:15 +00:00
|
|
|
<OrderCustomerAddressesEditDialog
|
|
|
|
{...props}
|
|
|
|
customerAddresses={[
|
|
|
|
order.shippingAddress,
|
2022-06-21 09:36:55 +00:00
|
|
|
{ ...order.billingAddress, id: "asdfghjfuunie" },
|
2021-05-06 11:38:15 +00:00
|
|
|
]}
|
|
|
|
/>
|
|
|
|
))
|
2022-02-02 11:22:39 +00:00
|
|
|
.add("shipping address change", () => (
|
2021-05-06 11:38:15 +00:00
|
|
|
<OrderCustomerAddressesEditDialog
|
|
|
|
{...props}
|
2022-02-02 11:22:39 +00:00
|
|
|
variant={AddressEditDialogVariant.CHANGE_SHIPPING_ADDRESS}
|
|
|
|
customerAddresses={[
|
|
|
|
order.shippingAddress,
|
2022-06-21 09:36:55 +00:00
|
|
|
{ ...order.billingAddress, id: "asdfghjfuunie" },
|
2022-02-02 11:22:39 +00:00
|
|
|
]}
|
2021-05-06 11:38:15 +00:00
|
|
|
/>
|
|
|
|
))
|
2022-02-02 11:22:39 +00:00
|
|
|
.add("billing address change", () => (
|
|
|
|
<OrderCustomerAddressesEditDialog
|
|
|
|
{...props}
|
|
|
|
variant={AddressEditDialogVariant.CHANGE_BILLING_ADDRESS}
|
|
|
|
customerAddresses={[
|
|
|
|
order.shippingAddress,
|
2022-06-21 09:36:55 +00:00
|
|
|
{ ...order.billingAddress, id: "asdfghjfuunie" },
|
2022-02-02 11:22:39 +00:00
|
|
|
]}
|
|
|
|
/>
|
|
|
|
))
|
|
|
|
.add("no customer addresses", () => (
|
|
|
|
<OrderCustomerAddressesEditDialog {...props} customerAddresses={[]} />
|
|
|
|
))
|
2021-05-06 11:38:15 +00:00
|
|
|
.add("loading", () => (
|
|
|
|
<OrderCustomerAddressesEditDialog
|
|
|
|
{...props}
|
|
|
|
loading={true}
|
|
|
|
confirmButtonState="loading"
|
|
|
|
/>
|
|
|
|
));
|