Skip to content

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

Fix stories

dominik-zeglencadf1bfb72f1
diff --git a/saleor/static/dashboard-next/fixtures.ts b/saleor/static/dashboard-next/fixtures.ts
index e935638285..03d1accc61 100644
--- a/saleor/static/dashboard-next/fixtures.ts
+++ b/saleor/static/dashboard-next/fixtures.ts
@@ -1,4 +1,4 @@
-import { PageListProps } from "./types";
+import { ListActions, PageListProps } from "./types";
const pageInfo = {
hasNextPage: true,
@@ -22,6 +22,12 @@ export const pageListProps: { [key: string]: PageListProps } = {
pageInfo
}
};
+export const listActionsProps: ListActions = {
+ isChecked: () => undefined,
+ selected: 0,
+ toggle: () => undefined,
+ toolbar: null
+};
export const countries = [
{ code: "AF", label: "Afghanistan" },
diff --git a/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap b/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap
index 11c691ea41..46887dd7f6 100644
--- a/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap
+++ b/saleor/static/dashboard-next/storybook/__snapshots__/Stories.test.ts.snap
@@ -5007,6 +5007,12 @@ exports[`Storyshots Orders / OrderAddressEditDialog shipping address 1`] = `
/>
`;
+exports[`Storyshots Orders / OrderBulkCancelDialog default 1`] = `
+<div
+ style="padding:24px"
+/>
+`;
+
exports[`Storyshots Orders / OrderCancelDialog default 1`] = `
<div
style="padding:24px"
diff --git a/saleor/static/dashboard-next/storybook/stories/categories/CategoryListPage.tsx b/saleor/static/dashboard-next/storybook/stories/categories/CategoryListPage.tsx
index 11b1bda8e4..2e87c7d726 100644
--- a/saleor/static/dashboard-next/storybook/stories/categories/CategoryListPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/categories/CategoryListPage.tsx
@@ -3,13 +3,14 @@ import * as React from "react";
import CategoryListPage from "../../../categories/components/CategoryListPage";
import { categories } from "../../../categories/fixtures";
-import { pageListProps } from "../../../fixtures";
+import { listActionsProps, pageListProps } from "../../../fixtures";
import Decorator from "../../Decorator";
const categoryTableProps = {
categories,
onAddCategory: undefined,
onCategoryClick: () => undefined,
+ ...listActionsProps,
...pageListProps.default
};
diff --git a/saleor/static/dashboard-next/storybook/stories/categories/CategoryUpdatePage.tsx b/saleor/static/dashboard-next/storybook/stories/categories/CategoryUpdatePage.tsx
index 9151af124a..2b797457a7 100644
--- a/saleor/static/dashboard-next/storybook/stories/categories/CategoryUpdatePage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/categories/CategoryUpdatePage.tsx
@@ -9,6 +9,7 @@ import CategoryUpdatePage, {
CategoryPageTab,
CategoryUpdatePageProps
} from "../../../categories/components/CategoryUpdatePage";
+import { listActionsProps } from "../../../fixtures";
import Decorator from "../../Decorator";
const category = categoryFixture(placeholderImage);
@@ -34,9 +35,12 @@ const updateProps: Omit<CategoryUpdatePageProps, "classes"> = {
hasNextPage: true,
hasPreviousPage: true
},
+ productListToolbar: null,
products: category.products.edges.map(edge => edge.node),
saveButtonBarState: "default",
- subcategories: category.children.edges.map(edge => edge.node)
+ subcategories: category.children.edges.map(edge => edge.node),
+ subcategoryListToolbar: null,
+ ...listActionsProps
};
storiesOf("Views / Categories / Update category", module)
diff --git a/saleor/static/dashboard-next/storybook/stories/collections/CollectionDetailsPage.tsx b/saleor/static/dashboard-next/storybook/stories/collections/CollectionDetailsPage.tsx
index 249b64cd36..b802dcdafb 100644
--- a/saleor/static/dashboard-next/storybook/stories/collections/CollectionDetailsPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/collections/CollectionDetailsPage.tsx
@@ -8,7 +8,7 @@ import CollectionDetailsPage, {
CollectionDetailsPageProps
} from "../../../collections/components/CollectionDetailsPage";
import { collection as collectionFixture } from "../../../collections/fixtures";
-import { pageListProps } from "../../../fixtures";
+import { listActionsProps, pageListProps } from "../../../fixtures";
import Decorator from "../../Decorator";
const collection = collectionFixture(
@@ -17,6 +17,7 @@ const collection = collectionFixture(
);
const props: Omit<CollectionDetailsPageProps, "classes"> = {
+ ...listActionsProps,
...pageListProps.default,
collection,
disabled: false,
diff --git a/saleor/static/dashboard-next/storybook/stories/collections/CollectionListPage.tsx b/saleor/static/dashboard-next/storybook/stories/collections/CollectionListPage.tsx
index bd645d8a2e..ee5d874332 100644
--- a/saleor/static/dashboard-next/storybook/stories/collections/CollectionListPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/collections/CollectionListPage.tsx
@@ -5,10 +5,11 @@ import CollectionListPage, {
CollectionListPageProps
} from "../../../collections/components/CollectionListPage";
import { collections } from "../../../collections/fixtures";
-import { pageListProps } from "../../../fixtures";
+import { listActionsProps, pageListProps } from "../../../fixtures";
import Decorator from "../../Decorator";
const props: CollectionListPageProps = {
+ ...listActionsProps,
...pageListProps.default,
collections
};
diff --git a/saleor/static/dashboard-next/storybook/stories/customers/CustomerListPage.tsx b/saleor/static/dashboard-next/storybook/stories/customers/CustomerListPage.tsx
index 65db6132fa..d96c22d439 100644
--- a/saleor/static/dashboard-next/storybook/stories/customers/CustomerListPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/customers/CustomerListPage.tsx
@@ -5,10 +5,11 @@ import CustomerListPage, {
CustomerListPageProps
} from "../../../customers/components/CustomerListPage";
import { customerList } from "../../../customers/fixtures";
-import { pageListProps } from "../../../fixtures";
+import { listActionsProps, pageListProps } from "../../../fixtures";
import Decorator from "../../Decorator";
const props: CustomerListPageProps = {
+ ...listActionsProps,
...pageListProps.default,
customers: customerList
};
diff --git a/saleor/static/dashboard-next/storybook/stories/discounts/SaleDetailsPage.tsx b/saleor/static/dashboard-next/storybook/stories/discounts/SaleDetailsPage.tsx
index e493a79eb4..4d8a0003d0 100644
--- a/saleor/static/dashboard-next/storybook/stories/discounts/SaleDetailsPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/discounts/SaleDetailsPage.tsx
@@ -6,11 +6,14 @@ import SaleDetailsPage, {
SaleDetailsPageTab
} from "../../../discounts/components/SaleDetailsPage";
import { sale } from "../../../discounts/fixtures";
+import { listActionsProps } from "../../../fixtures";
import Decorator from "../../Decorator";
import { formError } from "../../misc";
const props: SaleDetailsPageProps = {
activeTab: SaleDetailsPageTab.categories,
+ categoryListToolbar: null,
+ collectionListToolbar: null,
defaultCurrency: "USD",
disabled: false,
errors: [],
@@ -33,8 +36,10 @@ const props: SaleDetailsPageProps = {
hasNextPage: true,
hasPreviousPage: false
},
+ productListToolbar: null,
sale,
- saveButtonBarState: "default"
+ saveButtonBarState: "default",
+ ...listActionsProps
};
storiesOf("Views / Discounts / Sale details", module)
diff --git a/saleor/static/dashboard-next/storybook/stories/discounts/SaleListPage.tsx b/saleor/static/dashboard-next/storybook/stories/discounts/SaleListPage.tsx
index 573ff4ce4a..f73b004068 100644
--- a/saleor/static/dashboard-next/storybook/stories/discounts/SaleListPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/discounts/SaleListPage.tsx
@@ -5,10 +5,11 @@ import SaleListPage, {
SaleListPageProps
} from "../../../discounts/components/SaleListPage";
import { saleList } from "../../../discounts/fixtures";
-import { pageListProps } from "../../../fixtures";
+import { listActionsProps, pageListProps } from "../../../fixtures";
import Decorator from "../../Decorator";
const props: SaleListPageProps = {
+ ...listActionsProps,
...pageListProps.default,
defaultCurrency: "USD",
sales: saleList
diff --git a/saleor/static/dashboard-next/storybook/stories/discounts/VoucherDetailsPage.tsx b/saleor/static/dashboard-next/storybook/stories/discounts/VoucherDetailsPage.tsx
index afb7ce3cdd..c3deee89e8 100644
--- a/saleor/static/dashboard-next/storybook/stories/discounts/VoucherDetailsPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/discounts/VoucherDetailsPage.tsx
@@ -7,13 +7,16 @@ import VoucherDetailsPage, {
VoucherDetailsPageTab
} from "../../../discounts/components/VoucherDetailsPage";
import { voucherDetails } from "../../../discounts/fixtures";
-import { pageListProps } from "../../../fixtures";
+import { listActionsProps, pageListProps } from "../../../fixtures";
import Decorator from "../../Decorator";
import { formError } from "../../misc";
const props: VoucherDetailsPageProps = {
+ ...listActionsProps,
...pageListProps.default,
activeTab: VoucherDetailsPageTab.products,
+ categoryListToolbar: null,
+ collectionListToolbar: null,
defaultCurrency: "USD",
errors: [],
onBack: () => undefined,
@@ -31,6 +34,7 @@ const props: VoucherDetailsPageProps = {
onRemove: () => undefined,
onSubmit: () => undefined,
onTabClick: () => undefined,
+ productListToolbar: null,
saveButtonBarState: "default",
voucher: voucherDetails
};
diff --git a/saleor/static/dashboard-next/storybook/stories/discounts/VoucherListPage.tsx b/saleor/static/dashboard-next/storybook/stories/discounts/VoucherListPage.tsx
index 93db73a0ff..2e01610631 100644
--- a/saleor/static/dashboard-next/storybook/stories/discounts/VoucherListPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/discounts/VoucherListPage.tsx
@@ -5,10 +5,11 @@ import VoucherListPage, {
VoucherListPageProps
} from "../../../discounts/components/VoucherListPage";
import { voucherList } from "../../../discounts/fixtures";
-import { pageListProps } from "../../../fixtures";
+import { listActionsProps, pageListProps } from "../../../fixtures";
import Decorator from "../../Decorator";
const props: VoucherListPageProps = {
+ ...listActionsProps,
...pageListProps.default,
defaultCurrency: "USD",
vouchers: voucherList
diff --git a/saleor/static/dashboard-next/storybook/stories/orders/OrderBulkCancelDialog.tsx b/saleor/static/dashboard-next/storybook/stories/orders/OrderBulkCancelDialog.tsx
index 39de061937..a07a450447 100644
--- a/saleor/static/dashboard-next/storybook/stories/orders/OrderBulkCancelDialog.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/orders/OrderBulkCancelDialog.tsx
@@ -7,7 +7,11 @@ import OrderBulkCancelDialog, {
import Decorator from "../../Decorator";
const props: OrderBulkCancelDialogProps = {
-
+ confirmButtonState: "default",
+ numberOfOrders: "10",
+ onClose: () => undefined,
+ onConfirm: () => undefined,
+ open: true
};
storiesOf("Orders / OrderBulkCancelDialog", module)
diff --git a/saleor/static/dashboard-next/storybook/stories/orders/OrderDraftListPage.tsx b/saleor/static/dashboard-next/storybook/stories/orders/OrderDraftListPage.tsx
index 99f2a5b6eb..4e7630abe9 100644
--- a/saleor/static/dashboard-next/storybook/stories/orders/OrderDraftListPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/orders/OrderDraftListPage.tsx
@@ -1,7 +1,7 @@
import { storiesOf } from "@storybook/react";
import * as React from "react";
-import { pageListProps } from "../../../fixtures";
+import { listActionsProps, pageListProps } from "../../../fixtures";
import OrderDraftListPage, {
OrderDraftListPageProps
} from "../../../orders/components/OrderDraftListPage";
@@ -9,6 +9,7 @@ import { orders } from "../../../orders/fixtures";
import Decorator from "../../Decorator";
const props: OrderDraftListPageProps = {
+ ...listActionsProps,
...pageListProps.default,
onAdd: () => undefined,
orders
diff --git a/saleor/static/dashboard-next/storybook/stories/orders/OrderListPage.tsx b/saleor/static/dashboard-next/storybook/stories/orders/OrderListPage.tsx
index 61397105b6..fd6aea192f 100644
--- a/saleor/static/dashboard-next/storybook/stories/orders/OrderListPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/orders/OrderListPage.tsx
@@ -2,7 +2,7 @@ import { storiesOf } from "@storybook/react";
import * as React from "react";
import { Filter } from "../../../components/TableFilter/";
-import { pageListProps } from "../../../fixtures";
+import { listActionsProps, pageListProps } from "../../../fixtures";
import OrderListPage from "../../../orders/components/OrderListPage";
import { orders } from "../../../orders/fixtures";
import Decorator from "../../Decorator";
@@ -27,6 +27,7 @@ storiesOf("Views / Orders / Order list", module)
.add("default", () => (
<OrderListPage
orders={orders}
+ {...listActionsProps}
{...pageListProps.default}
filtersList={[]}
onAllProducts={() => undefined}
@@ -39,6 +40,7 @@ storiesOf("Views / Orders / Order list", module)
.add("with custom filters", () => (
<OrderListPage
orders={orders}
+ {...listActionsProps}
{...pageListProps.loading}
filtersList={filtersList}
currentTab="custom"
@@ -51,6 +53,7 @@ storiesOf("Views / Orders / Order list", module)
.add("loading", () => (
<OrderListPage
orders={undefined}
+ {...listActionsProps}
{...pageListProps.loading}
filtersList={undefined}
currentTab={undefined}
@@ -63,6 +66,7 @@ storiesOf("Views / Orders / Order list", module)
.add("when no data", () => (
<OrderListPage
orders={[]}
+ {...listActionsProps}
{...pageListProps.default}
filtersList={[]}
currentTab="all"
diff --git a/saleor/static/dashboard-next/storybook/stories/pages/PageListPage.tsx b/saleor/static/dashboard-next/storybook/stories/pages/PageListPage.tsx
index b6dc87147a..b5c1510609 100644
--- a/saleor/static/dashboard-next/storybook/stories/pages/PageListPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/pages/PageListPage.tsx
@@ -1,7 +1,7 @@
import { storiesOf } from "@storybook/react";
import * as React from "react";
-import { pageListProps } from "../../../fixtures";
+import { listActionsProps, pageListProps } from "../../../fixtures";
import PageListPage, {
PageListPageProps
} from "../../../pages/components/PageListPage";
@@ -9,6 +9,7 @@ import { pageList } from "../../../pages/fixtures";
import Decorator from "../../Decorator";
const props: PageListPageProps = {
+ ...listActionsProps,
...pageListProps.default,
onBack: () => undefined,
pages: pageList
diff --git a/saleor/static/dashboard-next/storybook/stories/productTypes/ProductTypeListPage.tsx b/saleor/static/dashboard-next/storybook/stories/productTypes/ProductTypeListPage.tsx
index 63f5c1e7e5..c458e97a79 100644
--- a/saleor/static/dashboard-next/storybook/stories/productTypes/ProductTypeListPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/productTypes/ProductTypeListPage.tsx
@@ -1,7 +1,7 @@
import { storiesOf } from "@storybook/react";
import * as React from "react";
-import { pageListProps } from "../../../fixtures";
+import { listActionsProps, pageListProps } from "../../../fixtures";
import ProductTypeListPage from "../../../productTypes/components/ProductTypeListPage";
import { productTypes } from "../../../productTypes/fixtures";
import Decorator from "../../Decorator";
@@ -12,6 +12,7 @@ storiesOf("Views / Product types / Product types list", module)
<ProductTypeListPage
onBack={() => undefined}
productTypes={productTypes}
+ {...listActionsProps}
{...pageListProps.default}
/>
))
@@ -19,6 +20,7 @@ storiesOf("Views / Product types / Product types list", module)
<ProductTypeListPage
onBack={() => undefined}
productTypes={undefined}
+ {...listActionsProps}
{...pageListProps.loading}
/>
));
diff --git a/saleor/static/dashboard-next/storybook/stories/products/ProductListCard.tsx b/saleor/static/dashboard-next/storybook/stories/products/ProductListCard.tsx
index 1e715a8a93..6c8e354ec6 100644
--- a/saleor/static/dashboard-next/storybook/stories/products/ProductListCard.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/products/ProductListCard.tsx
@@ -4,7 +4,7 @@ import * as React from "react";
import * as placeholderImage from "../../../../images/placeholder255x255.png";
import { category as categoryFixture } from "../../../categories/fixtures";
import { Filter } from "../../../components/TableFilter";
-import { pageListProps } from "../../../fixtures";
+import { listActionsProps, pageListProps } from "../../../fixtures";
import ProductListCard from "../../../products/components/ProductListCard";
import Decorator from "../../Decorator";
@@ -34,6 +34,7 @@ storiesOf("Views / Products / Product list", module)
filtersList={[]}
currentTab="all"
products={products}
+ {...listActionsProps}
{...pageListProps.default}
onAllProducts={() => undefined}
onAvailable={() => undefined}
@@ -44,6 +45,7 @@ storiesOf("Views / Products / Product list", module)
.add("with custom filters", () => (
<ProductListCard
products={products}
+ {...listActionsProps}
{...pageListProps.default}
filtersList={filtersList}
currentTab="custom"
@@ -55,6 +57,7 @@ storiesOf("Views / Products / Product list", module)
))
.add("loading", () => (
<ProductListCard
+ {...listActionsProps}
{...pageListProps.loading}
products={undefined}
filtersList={undefined}
@@ -68,6 +71,7 @@ storiesOf("Views / Products / Product list", module)
.add("no data", () => (
<ProductListCard
products={[]}
+ {...listActionsProps}
{...pageListProps.default}
filtersList={[]}
currentTab="all"
diff --git a/saleor/static/dashboard-next/storybook/stories/products/ProductUpdatePage.tsx b/saleor/static/dashboard-next/storybook/stories/products/ProductUpdatePage.tsx
index 84f3c3515d..e0497657da 100644
--- a/saleor/static/dashboard-next/storybook/stories/products/ProductUpdatePage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/products/ProductUpdatePage.tsx
@@ -2,6 +2,7 @@ import { storiesOf } from "@storybook/react";
import * as React from "react";
import * as placeholderImage from "../../../../images/placeholder255x255.png";
+import { listActionsProps } from "../../../fixtures";
import ProductUpdatePage from "../../../products/components/ProductUpdatePage";
import { product as productFixture } from "../../../products/fixtures";
import Decorator from "../../Decorator";
@@ -33,6 +34,7 @@ storiesOf("Views / Products / Product edit", module)
onImageDelete={() => undefined}
onImageUpload={() => undefined}
saveButtonBarState="default"
+ {...listActionsProps}
/>
))
.add("when product has no images", () => (
@@ -58,6 +60,7 @@ storiesOf("Views / Products / Product edit", module)
onVariantShow={() => undefined}
onImageUpload={() => undefined}
saveButtonBarState="default"
+ {...listActionsProps}
/>
))
.add("when product has no variants", () => (
@@ -88,6 +91,7 @@ storiesOf("Views / Products / Product edit", module)
onVariantShow={() => undefined}
onImageUpload={() => undefined}
saveButtonBarState="default"
+ {...listActionsProps}
/>
))
.add("when loading data", () => (
@@ -108,5 +112,6 @@ storiesOf("Views / Products / Product edit", module)
onImageUpload={() => undefined}
saveButtonBarState="default"
variants={undefined}
+ {...listActionsProps}
/>
));
diff --git a/saleor/static/dashboard-next/storybook/stories/shipping/ShippingZonesListPage.tsx b/saleor/static/dashboard-next/storybook/stories/shipping/ShippingZonesListPage.tsx
index 29e000d8a7..beb1af5211 100644
--- a/saleor/static/dashboard-next/storybook/stories/shipping/ShippingZonesListPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/shipping/ShippingZonesListPage.tsx
@@ -1,7 +1,7 @@
import { storiesOf } from "@storybook/react";
import * as React from "react";
-import { pageListProps } from "../../../fixtures";
+import { listActionsProps, pageListProps } from "../../../fixtures";
import ShippingZonesListPage, {
ShippingZonesListPageProps
} from "../../../shipping/components/ShippingZonesListPage";
@@ -10,6 +10,7 @@ import { WeightUnitsEnum } from "../../../types/globalTypes";
import Decorator from "../../Decorator";
const props: ShippingZonesListPageProps = {
+ ...listActionsProps,
...pageListProps.default,
defaultWeightUnit: WeightUnitsEnum.KG,
onAdd: () => undefined,
diff --git a/saleor/static/dashboard-next/storybook/stories/staff/StaffListPage.tsx b/saleor/static/dashboard-next/storybook/stories/staff/StaffListPage.tsx
index d6c9aa1190..ed10f6a677 100644
--- a/saleor/static/dashboard-next/storybook/stories/staff/StaffListPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/staff/StaffListPage.tsx
@@ -1,7 +1,7 @@
import { storiesOf } from "@storybook/react";
import * as React from "react";
-import { pageListProps } from "../../../fixtures";
+import { listActionsProps, pageListProps } from "../../../fixtures";
import StaffListPage, {
StaffListPageProps
} from "../../../staff/components/StaffListPage";
@@ -12,6 +12,7 @@ const props: StaffListPageProps = {
onAdd: undefined,
onBack: () => undefined,
staffMembers,
+ ...listActionsProps,
...pageListProps.default
};