saleor-dashboard/src/orders/components/OrderCustomerAddressesEditDialog/OrderCustomerAddressesEditDialog.stories.tsx

65 lines
1.8 KiB
TypeScript
Raw Normal View History

import Decorator from "@saleor/storybook/Decorator";
import { storiesOf } from "@storybook/react";
import React from "react";
import { countries, order as orderFixture } from "../../fixtures";
import OrderCustomerAddressesEditDialog, {
OrderCustomerAddressesEditDialogProps
Refactor changing address in order details directly (#1697) (#1818) * Refactor changing address in order details directly (#1697) * wip change address edit buttons behaviour in order draft * wip modify dialog view when customer is not changed * wip remove old address edit modal * wip rm old address modal storybook * wip async search state change * wip disable edit in draft when no customer is selected * wip fix submitting issues * wip allow single address mutation * wip fix billing change & manual address change * wip fix covered country dropdown * wip add address clone checkbox * wip normal order details & unconfirmed views * wip messages minor fixes * wip clone address checkbox on new address input option * Storybook update * cleanup * billing same as shipping fixes * improve stories titles & move to component folder * improve continueToAddressSearchState readibility * improve dialog title/description message descriptors * change .then() to await * Remove redundant onClick arrow function Co-authored-by: Dominik Żegleń <flesz3@o2.pl> * Improve OrderAddressFields component * move shipping & billing address edit props outside file * Update snapshots * fix mutation output types in order views * Fix confirm button state type * fix skipping query when modal is refreshed * fix cancel button to match designs * update dialog headers * fix customer address choice card styling for blue theme * change hidecard to showcard * export types to local file * improve isAnyAddressEditModalOpen function * fix cut hover effect on inputs * fix submitting modal when modal is closed with x button * fix validation & initial form data * update messages * Update partial mutation return type * Add vertical spacer component * Revert CardSpacer changes * Change some of Form & Card spacers to Vertical Spacers * Fix makeStyles import in VerticalSpacer * Fix border color for AddressCards * Add type to addressFieldsCommonProps object * Change stories subtitles to lowercase * Fix country choices type * Fix setState react type * Improve address change handlers * Update snapshots * Fix default country not showing up in address edit single autocomplete field Co-authored-by: Dominik Żegleń <flesz3@o2.pl> Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com> * Fix linter issue Co-authored-by: Dominik Żegleń <flesz3@o2.pl> Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com>
2022-02-02 11:22:39 +00:00
} from ".";
import { AddressEditDialogVariant } from "./types";
const order = orderFixture("");
const props: OrderCustomerAddressesEditDialogProps = {
confirmButtonState: "default",
Refactor changing address in order details directly (#1697) (#1818) * Refactor changing address in order details directly (#1697) * wip change address edit buttons behaviour in order draft * wip modify dialog view when customer is not changed * wip remove old address edit modal * wip rm old address modal storybook * wip async search state change * wip disable edit in draft when no customer is selected * wip fix submitting issues * wip allow single address mutation * wip fix billing change & manual address change * wip fix covered country dropdown * wip add address clone checkbox * wip normal order details & unconfirmed views * wip messages minor fixes * wip clone address checkbox on new address input option * Storybook update * cleanup * billing same as shipping fixes * improve stories titles & move to component folder * improve continueToAddressSearchState readibility * improve dialog title/description message descriptors * change .then() to await * Remove redundant onClick arrow function Co-authored-by: Dominik Żegleń <flesz3@o2.pl> * Improve OrderAddressFields component * move shipping & billing address edit props outside file * Update snapshots * fix mutation output types in order views * Fix confirm button state type * fix skipping query when modal is refreshed * fix cancel button to match designs * update dialog headers * fix customer address choice card styling for blue theme * change hidecard to showcard * export types to local file * improve isAnyAddressEditModalOpen function * fix cut hover effect on inputs * fix submitting modal when modal is closed with x button * fix validation & initial form data * update messages * Update partial mutation return type * Add vertical spacer component * Revert CardSpacer changes * Change some of Form & Card spacers to Vertical Spacers * Fix makeStyles import in VerticalSpacer * Fix border color for AddressCards * Add type to addressFieldsCommonProps object * Change stories subtitles to lowercase * Fix country choices type * Fix setState react type * Improve address change handlers * Update snapshots * Fix default country not showing up in address edit single autocomplete field Co-authored-by: Dominik Żegleń <flesz3@o2.pl> Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com> * Fix linter issue Co-authored-by: Dominik Żegleń <flesz3@o2.pl> Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com>
2022-02-02 11:22:39 +00:00
variant: AddressEditDialogVariant.CHANGE_CUSTOMER,
loading: false,
onClose: () => undefined,
onConfirm: () => undefined,
open: true,
Refactor changing address in order details directly (#1697) (#1818) * Refactor changing address in order details directly (#1697) * wip change address edit buttons behaviour in order draft * wip modify dialog view when customer is not changed * wip remove old address edit modal * wip rm old address modal storybook * wip async search state change * wip disable edit in draft when no customer is selected * wip fix submitting issues * wip allow single address mutation * wip fix billing change & manual address change * wip fix covered country dropdown * wip add address clone checkbox * wip normal order details & unconfirmed views * wip messages minor fixes * wip clone address checkbox on new address input option * Storybook update * cleanup * billing same as shipping fixes * improve stories titles & move to component folder * improve continueToAddressSearchState readibility * improve dialog title/description message descriptors * change .then() to await * Remove redundant onClick arrow function Co-authored-by: Dominik Żegleń <flesz3@o2.pl> * Improve OrderAddressFields component * move shipping & billing address edit props outside file * Update snapshots * fix mutation output types in order views * Fix confirm button state type * fix skipping query when modal is refreshed * fix cancel button to match designs * update dialog headers * fix customer address choice card styling for blue theme * change hidecard to showcard * export types to local file * improve isAnyAddressEditModalOpen function * fix cut hover effect on inputs * fix submitting modal when modal is closed with x button * fix validation & initial form data * update messages * Update partial mutation return type * Add vertical spacer component * Revert CardSpacer changes * Change some of Form & Card spacers to Vertical Spacers * Fix makeStyles import in VerticalSpacer * Fix border color for AddressCards * Add type to addressFieldsCommonProps object * Change stories subtitles to lowercase * Fix country choices type * Fix setState react type * Improve address change handlers * Update snapshots * Fix default country not showing up in address edit single autocomplete field Co-authored-by: Dominik Żegleń <flesz3@o2.pl> Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com> * Fix linter issue Co-authored-by: Dominik Żegleń <flesz3@o2.pl> Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com>
2022-02-02 11:22:39 +00:00
errors: undefined,
countries
};
Refactor changing address in order details directly (#1697) (#1818) * Refactor changing address in order details directly (#1697) * wip change address edit buttons behaviour in order draft * wip modify dialog view when customer is not changed * wip remove old address edit modal * wip rm old address modal storybook * wip async search state change * wip disable edit in draft when no customer is selected * wip fix submitting issues * wip allow single address mutation * wip fix billing change & manual address change * wip fix covered country dropdown * wip add address clone checkbox * wip normal order details & unconfirmed views * wip messages minor fixes * wip clone address checkbox on new address input option * Storybook update * cleanup * billing same as shipping fixes * improve stories titles & move to component folder * improve continueToAddressSearchState readibility * improve dialog title/description message descriptors * change .then() to await * Remove redundant onClick arrow function Co-authored-by: Dominik Żegleń <flesz3@o2.pl> * Improve OrderAddressFields component * move shipping & billing address edit props outside file * Update snapshots * fix mutation output types in order views * Fix confirm button state type * fix skipping query when modal is refreshed * fix cancel button to match designs * update dialog headers * fix customer address choice card styling for blue theme * change hidecard to showcard * export types to local file * improve isAnyAddressEditModalOpen function * fix cut hover effect on inputs * fix submitting modal when modal is closed with x button * fix validation & initial form data * update messages * Update partial mutation return type * Add vertical spacer component * Revert CardSpacer changes * Change some of Form & Card spacers to Vertical Spacers * Fix makeStyles import in VerticalSpacer * Fix border color for AddressCards * Add type to addressFieldsCommonProps object * Change stories subtitles to lowercase * Fix country choices type * Fix setState react type * Improve address change handlers * Update snapshots * Fix default country not showing up in address edit single autocomplete field Co-authored-by: Dominik Żegleń <flesz3@o2.pl> Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com> * Fix linter issue Co-authored-by: Dominik Żegleń <flesz3@o2.pl> Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com>
2022-02-02 11:22:39 +00:00
storiesOf("Orders / Changing address in order", module)
.addDecorator(Decorator)
Refactor changing address in order details directly (#1697) (#1818) * Refactor changing address in order details directly (#1697) * wip change address edit buttons behaviour in order draft * wip modify dialog view when customer is not changed * wip remove old address edit modal * wip rm old address modal storybook * wip async search state change * wip disable edit in draft when no customer is selected * wip fix submitting issues * wip allow single address mutation * wip fix billing change & manual address change * wip fix covered country dropdown * wip add address clone checkbox * wip normal order details & unconfirmed views * wip messages minor fixes * wip clone address checkbox on new address input option * Storybook update * cleanup * billing same as shipping fixes * improve stories titles & move to component folder * improve continueToAddressSearchState readibility * improve dialog title/description message descriptors * change .then() to await * Remove redundant onClick arrow function Co-authored-by: Dominik Żegleń <flesz3@o2.pl> * Improve OrderAddressFields component * move shipping & billing address edit props outside file * Update snapshots * fix mutation output types in order views * Fix confirm button state type * fix skipping query when modal is refreshed * fix cancel button to match designs * update dialog headers * fix customer address choice card styling for blue theme * change hidecard to showcard * export types to local file * improve isAnyAddressEditModalOpen function * fix cut hover effect on inputs * fix submitting modal when modal is closed with x button * fix validation & initial form data * update messages * Update partial mutation return type * Add vertical spacer component * Revert CardSpacer changes * Change some of Form & Card spacers to Vertical Spacers * Fix makeStyles import in VerticalSpacer * Fix border color for AddressCards * Add type to addressFieldsCommonProps object * Change stories subtitles to lowercase * Fix country choices type * Fix setState react type * Improve address change handlers * Update snapshots * Fix default country not showing up in address edit single autocomplete field Co-authored-by: Dominik Żegleń <flesz3@o2.pl> Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com> * Fix linter issue Co-authored-by: Dominik Żegleń <flesz3@o2.pl> Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com>
2022-02-02 11:22:39 +00:00
.add("address change when customer is changed", () => (
<OrderCustomerAddressesEditDialog
{...props}
customerAddresses={[
order.shippingAddress,
{ ...order.billingAddress, id: "asdfghjfuunie" }
]}
/>
))
Refactor changing address in order details directly (#1697) (#1818) * Refactor changing address in order details directly (#1697) * wip change address edit buttons behaviour in order draft * wip modify dialog view when customer is not changed * wip remove old address edit modal * wip rm old address modal storybook * wip async search state change * wip disable edit in draft when no customer is selected * wip fix submitting issues * wip allow single address mutation * wip fix billing change & manual address change * wip fix covered country dropdown * wip add address clone checkbox * wip normal order details & unconfirmed views * wip messages minor fixes * wip clone address checkbox on new address input option * Storybook update * cleanup * billing same as shipping fixes * improve stories titles & move to component folder * improve continueToAddressSearchState readibility * improve dialog title/description message descriptors * change .then() to await * Remove redundant onClick arrow function Co-authored-by: Dominik Żegleń <flesz3@o2.pl> * Improve OrderAddressFields component * move shipping & billing address edit props outside file * Update snapshots * fix mutation output types in order views * Fix confirm button state type * fix skipping query when modal is refreshed * fix cancel button to match designs * update dialog headers * fix customer address choice card styling for blue theme * change hidecard to showcard * export types to local file * improve isAnyAddressEditModalOpen function * fix cut hover effect on inputs * fix submitting modal when modal is closed with x button * fix validation & initial form data * update messages * Update partial mutation return type * Add vertical spacer component * Revert CardSpacer changes * Change some of Form & Card spacers to Vertical Spacers * Fix makeStyles import in VerticalSpacer * Fix border color for AddressCards * Add type to addressFieldsCommonProps object * Change stories subtitles to lowercase * Fix country choices type * Fix setState react type * Improve address change handlers * Update snapshots * Fix default country not showing up in address edit single autocomplete field Co-authored-by: Dominik Żegleń <flesz3@o2.pl> Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com> * Fix linter issue Co-authored-by: Dominik Żegleń <flesz3@o2.pl> Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com>
2022-02-02 11:22:39 +00:00
.add("shipping address change", () => (
<OrderCustomerAddressesEditDialog
{...props}
Refactor changing address in order details directly (#1697) (#1818) * Refactor changing address in order details directly (#1697) * wip change address edit buttons behaviour in order draft * wip modify dialog view when customer is not changed * wip remove old address edit modal * wip rm old address modal storybook * wip async search state change * wip disable edit in draft when no customer is selected * wip fix submitting issues * wip allow single address mutation * wip fix billing change & manual address change * wip fix covered country dropdown * wip add address clone checkbox * wip normal order details & unconfirmed views * wip messages minor fixes * wip clone address checkbox on new address input option * Storybook update * cleanup * billing same as shipping fixes * improve stories titles & move to component folder * improve continueToAddressSearchState readibility * improve dialog title/description message descriptors * change .then() to await * Remove redundant onClick arrow function Co-authored-by: Dominik Żegleń <flesz3@o2.pl> * Improve OrderAddressFields component * move shipping & billing address edit props outside file * Update snapshots * fix mutation output types in order views * Fix confirm button state type * fix skipping query when modal is refreshed * fix cancel button to match designs * update dialog headers * fix customer address choice card styling for blue theme * change hidecard to showcard * export types to local file * improve isAnyAddressEditModalOpen function * fix cut hover effect on inputs * fix submitting modal when modal is closed with x button * fix validation & initial form data * update messages * Update partial mutation return type * Add vertical spacer component * Revert CardSpacer changes * Change some of Form & Card spacers to Vertical Spacers * Fix makeStyles import in VerticalSpacer * Fix border color for AddressCards * Add type to addressFieldsCommonProps object * Change stories subtitles to lowercase * Fix country choices type * Fix setState react type * Improve address change handlers * Update snapshots * Fix default country not showing up in address edit single autocomplete field Co-authored-by: Dominik Żegleń <flesz3@o2.pl> Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com> * Fix linter issue Co-authored-by: Dominik Żegleń <flesz3@o2.pl> Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com>
2022-02-02 11:22:39 +00:00
variant={AddressEditDialogVariant.CHANGE_SHIPPING_ADDRESS}
customerAddresses={[
order.shippingAddress,
{ ...order.billingAddress, id: "asdfghjfuunie" }
]}
/>
))
Refactor changing address in order details directly (#1697) (#1818) * Refactor changing address in order details directly (#1697) * wip change address edit buttons behaviour in order draft * wip modify dialog view when customer is not changed * wip remove old address edit modal * wip rm old address modal storybook * wip async search state change * wip disable edit in draft when no customer is selected * wip fix submitting issues * wip allow single address mutation * wip fix billing change & manual address change * wip fix covered country dropdown * wip add address clone checkbox * wip normal order details & unconfirmed views * wip messages minor fixes * wip clone address checkbox on new address input option * Storybook update * cleanup * billing same as shipping fixes * improve stories titles & move to component folder * improve continueToAddressSearchState readibility * improve dialog title/description message descriptors * change .then() to await * Remove redundant onClick arrow function Co-authored-by: Dominik Żegleń <flesz3@o2.pl> * Improve OrderAddressFields component * move shipping & billing address edit props outside file * Update snapshots * fix mutation output types in order views * Fix confirm button state type * fix skipping query when modal is refreshed * fix cancel button to match designs * update dialog headers * fix customer address choice card styling for blue theme * change hidecard to showcard * export types to local file * improve isAnyAddressEditModalOpen function * fix cut hover effect on inputs * fix submitting modal when modal is closed with x button * fix validation & initial form data * update messages * Update partial mutation return type * Add vertical spacer component * Revert CardSpacer changes * Change some of Form & Card spacers to Vertical Spacers * Fix makeStyles import in VerticalSpacer * Fix border color for AddressCards * Add type to addressFieldsCommonProps object * Change stories subtitles to lowercase * Fix country choices type * Fix setState react type * Improve address change handlers * Update snapshots * Fix default country not showing up in address edit single autocomplete field Co-authored-by: Dominik Żegleń <flesz3@o2.pl> Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com> * Fix linter issue Co-authored-by: Dominik Żegleń <flesz3@o2.pl> Co-authored-by: Magdalena Markusik <magdalena.markusik@mirumee.com>
2022-02-02 11:22:39 +00:00
.add("billing address change", () => (
<OrderCustomerAddressesEditDialog
{...props}
variant={AddressEditDialogVariant.CHANGE_BILLING_ADDRESS}
customerAddresses={[
order.shippingAddress,
{ ...order.billingAddress, id: "asdfghjfuunie" }
]}
/>
))
.add("no customer addresses", () => (
<OrderCustomerAddressesEditDialog {...props} customerAddresses={[]} />
))
.add("loading", () => (
<OrderCustomerAddressesEditDialog
{...props}
loading={true}
confirmButtonState="loading"
/>
));