Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add new product error view to storybook

Krzysztof Bialoglowiczfda898e14a49
diff --git a/saleor/static/dashboard-next/storybook/stories/products/ProductCreatePage.tsx b/saleor/static/dashboard-next/storybook/stories/products/ProductCreatePage.tsx
index 66d82435c4..e54847f64d 100644
--- a/saleor/static/dashboard-next/storybook/stories/products/ProductCreatePage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/products/ProductCreatePage.tsx
@@ -1,7 +1,12 @@
import { storiesOf } from "@storybook/react";
import * as React from "react";
-import ProductCreatePage from "../../../products/components/ProductCreatePage";
+import ProductCreatePage, {
+ FormData
+} from "../../../products/components/ProductCreatePage";
+
+import { formError } from "../../misc";
+
import { product as productFixture } from "../../../products/fixtures";
import { productTypes } from "../../../productTypes/fixtures";
import Decorator from "../../Decorator";
@@ -43,4 +48,23 @@ storiesOf("Views / Products / Create product", module)
onSubmit={() => undefined}
saveButtonBarState="default"
/>
+ ))
+ .add("form errors", () => (
+ <ProductCreatePage
+ currency="USD"
+ disabled={false}
+ errors={(["name", "productType", "category", "sku"] as Array<
+ keyof FormData
+ >).map(field => formError(field))}
+ header="Add product"
+ collections={product.collections}
+ fetchCategories={() => undefined}
+ fetchCollections={() => undefined}
+ productTypes={productTypes}
+ categories={[product.category]}
+ onAttributesEdit={undefined}
+ onBack={() => undefined}
+ onSubmit={() => undefined}
+ saveButtonBarState="default"
+ />
));