saleor-dashboard/src/shipping/components/OrderWeight/OrderWeight.stories.tsx
Magdalena Markusik 314b043afa
Saleor 4626/fix shipping zone rate UI (#1511)
* Fix shipping zone rates ui

* Update tests and messages
2021-10-18 10:57:53 +02:00

31 lines
943 B
TypeScript

import Decorator from "@saleor/storybook//Decorator";
import { ShippingErrorCode } from "@saleor/types/globalTypes";
import { storiesOf } from "@storybook/react";
import React from "react";
import OrderWeight, { OrderWeightProps } from "./OrderWeight";
const props: OrderWeightProps = {
disabled: false,
errors: [],
maxValue: "2",
minValue: "1",
orderValueRestricted: true,
onChange: () => undefined
};
storiesOf("Shipping / Order weight rates", module)
.addDecorator(Decorator)
.add("default", () => <OrderWeight {...props} />)
.add("loading", () => <OrderWeight {...props} disabled={true} />)
.add("new", () => <OrderWeight {...props} maxValue="" minValue="" />)
.add("form errors", () => (
<OrderWeight
{...props}
errors={["minimumOrderWeight", "maximumOrderWeight"].map(field => ({
__typename: "ShippingError",
code: ShippingErrorCode.INVALID,
field
}))}
/>
));