From 08cbf24964938020785b3c8b1092bf34c3fd0f72 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Thu, 12 Sep 2019 15:31:08 +0200 Subject: [PATCH] Fix stories --- .../ProductTypeListPage.tsx | 2 +- .../collections/CollectionListPage.tsx | 12 +++++- .../stories/customers/CustomerListPage.tsx | 9 ++++- .../stories/discounts/SaleListPage.tsx | 9 ++++- .../stories/discounts/VoucherListPage.tsx | 9 ++++- .../stories/orders/OrderDraftListPage.tsx | 9 ++++- .../productTypes/ProductTypeListPage.tsx | 39 +++++++++++-------- src/storybook/stories/staff/StaffListPage.tsx | 12 ++++-- .../TranslationsEntitiesListPage.tsx | 3 +- 9 files changed, 76 insertions(+), 28 deletions(-) diff --git a/src/productTypes/components/ProductTypeListPage/ProductTypeListPage.tsx b/src/productTypes/components/ProductTypeListPage/ProductTypeListPage.tsx index 4dc25d51d..846a3aaa0 100644 --- a/src/productTypes/components/ProductTypeListPage/ProductTypeListPage.tsx +++ b/src/productTypes/components/ProductTypeListPage/ProductTypeListPage.tsx @@ -17,7 +17,7 @@ import { import { ProductTypeList_productTypes_edges_node } from "../../types/ProductTypeList"; import ProductTypeList from "../ProductTypeList"; -interface ProductTypeListPageProps +export interface ProductTypeListPageProps extends PageListProps, ListActions, SearchPageProps, diff --git a/src/storybook/stories/collections/CollectionListPage.tsx b/src/storybook/stories/collections/CollectionListPage.tsx index cc0e44a4d..c3847a220 100644 --- a/src/storybook/stories/collections/CollectionListPage.tsx +++ b/src/storybook/stories/collections/CollectionListPage.tsx @@ -5,12 +5,19 @@ import CollectionListPage, { CollectionListPageProps } from "../../../collections/components/CollectionListPage"; import { collections } from "../../../collections/fixtures"; -import { listActionsProps, pageListProps } from "../../../fixtures"; +import { + listActionsProps, + pageListProps, + searchPageProps, + tabPageProps +} from "../../../fixtures"; import Decorator from "../../Decorator"; const props: CollectionListPageProps = { ...listActionsProps, ...pageListProps.default, + ...searchPageProps, + ...tabPageProps, collections }; @@ -19,4 +26,5 @@ storiesOf("Views / Collections / Collection list", module) .add("default", () => ) .add("loading", () => ( - )); + )) + .add("no data", () => ); diff --git a/src/storybook/stories/customers/CustomerListPage.tsx b/src/storybook/stories/customers/CustomerListPage.tsx index cfa8e462e..ec00a8bc9 100644 --- a/src/storybook/stories/customers/CustomerListPage.tsx +++ b/src/storybook/stories/customers/CustomerListPage.tsx @@ -5,12 +5,19 @@ import CustomerListPage, { CustomerListPageProps } from "../../../customers/components/CustomerListPage"; import { customerList } from "../../../customers/fixtures"; -import { listActionsProps, pageListProps } from "../../../fixtures"; +import { + listActionsProps, + pageListProps, + searchPageProps, + tabPageProps +} from "../../../fixtures"; import Decorator from "../../Decorator"; const props: CustomerListPageProps = { ...listActionsProps, ...pageListProps.default, + ...searchPageProps, + ...tabPageProps, customers: customerList }; diff --git a/src/storybook/stories/discounts/SaleListPage.tsx b/src/storybook/stories/discounts/SaleListPage.tsx index d8b88b81a..3494bb9ef 100644 --- a/src/storybook/stories/discounts/SaleListPage.tsx +++ b/src/storybook/stories/discounts/SaleListPage.tsx @@ -5,12 +5,19 @@ import SaleListPage, { SaleListPageProps } from "../../../discounts/components/SaleListPage"; import { saleList } from "../../../discounts/fixtures"; -import { listActionsProps, pageListProps } from "../../../fixtures"; +import { + listActionsProps, + pageListProps, + searchPageProps, + tabPageProps +} from "../../../fixtures"; import Decorator from "../../Decorator"; const props: SaleListPageProps = { ...listActionsProps, ...pageListProps.default, + ...searchPageProps, + ...tabPageProps, defaultCurrency: "USD", sales: saleList }; diff --git a/src/storybook/stories/discounts/VoucherListPage.tsx b/src/storybook/stories/discounts/VoucherListPage.tsx index fa10118b0..7e53c7211 100644 --- a/src/storybook/stories/discounts/VoucherListPage.tsx +++ b/src/storybook/stories/discounts/VoucherListPage.tsx @@ -5,12 +5,19 @@ import VoucherListPage, { VoucherListPageProps } from "../../../discounts/components/VoucherListPage"; import { voucherList } from "../../../discounts/fixtures"; -import { listActionsProps, pageListProps } from "../../../fixtures"; +import { + listActionsProps, + pageListProps, + searchPageProps, + tabPageProps +} from "../../../fixtures"; import Decorator from "../../Decorator"; const props: VoucherListPageProps = { ...listActionsProps, ...pageListProps.default, + ...searchPageProps, + ...tabPageProps, defaultCurrency: "USD", vouchers: voucherList }; diff --git a/src/storybook/stories/orders/OrderDraftListPage.tsx b/src/storybook/stories/orders/OrderDraftListPage.tsx index 7cc1d4596..5837e1f34 100644 --- a/src/storybook/stories/orders/OrderDraftListPage.tsx +++ b/src/storybook/stories/orders/OrderDraftListPage.tsx @@ -1,7 +1,12 @@ import { storiesOf } from "@storybook/react"; import React from "react"; -import { listActionsProps, pageListProps } from "../../../fixtures"; +import { + listActionsProps, + pageListProps, + searchPageProps, + tabPageProps +} from "../../../fixtures"; import OrderDraftListPage, { OrderDraftListPageProps } from "../../../orders/components/OrderDraftListPage"; @@ -11,6 +16,8 @@ import Decorator from "../../Decorator"; const props: OrderDraftListPageProps = { ...listActionsProps, ...pageListProps.default, + ...searchPageProps, + ...tabPageProps, onAdd: () => undefined, orders }; diff --git a/src/storybook/stories/productTypes/ProductTypeListPage.tsx b/src/storybook/stories/productTypes/ProductTypeListPage.tsx index 8d97d165f..5f1387a3a 100644 --- a/src/storybook/stories/productTypes/ProductTypeListPage.tsx +++ b/src/storybook/stories/productTypes/ProductTypeListPage.tsx @@ -1,26 +1,31 @@ import { storiesOf } from "@storybook/react"; import React from "react"; -import { listActionsProps, pageListProps } from "../../../fixtures"; -import ProductTypeListPage from "../../../productTypes/components/ProductTypeListPage"; +import { + listActionsProps, + pageListProps, + searchPageProps, + tabPageProps +} from "../../../fixtures"; +import ProductTypeListPage, { + ProductTypeListPageProps +} from "../../../productTypes/components/ProductTypeListPage"; import { productTypes } from "../../../productTypes/fixtures"; import Decorator from "../../Decorator"; +const props: ProductTypeListPageProps = { + ...listActionsProps, + ...pageListProps.default, + ...searchPageProps, + ...tabPageProps, + onBack: () => undefined, + productTypes +}; + storiesOf("Views / Product types / Product types list", module) .addDecorator(Decorator) - .add("default", () => ( - undefined} - productTypes={productTypes} - {...listActionsProps} - {...pageListProps.default} - /> - )) + .add("default", () => ) .add("loading", () => ( - undefined} - productTypes={undefined} - {...listActionsProps} - {...pageListProps.loading} - /> - )); + + )) + .add("no data", () => ); diff --git a/src/storybook/stories/staff/StaffListPage.tsx b/src/storybook/stories/staff/StaffListPage.tsx index 95edeb46f..e18bb96f6 100644 --- a/src/storybook/stories/staff/StaffListPage.tsx +++ b/src/storybook/stories/staff/StaffListPage.tsx @@ -1,7 +1,11 @@ import { storiesOf } from "@storybook/react"; import React from "react"; -import { pageListProps } from "../../../fixtures"; +import { + pageListProps, + searchPageProps, + tabPageProps +} from "../../../fixtures"; import StaffListPage, { StaffListPageProps } from "../../../staff/components/StaffListPage"; @@ -9,10 +13,12 @@ import { staffMembers } from "../../../staff/fixtures"; import Decorator from "../../Decorator"; const props: StaffListPageProps = { + ...pageListProps.default, + ...searchPageProps, + ...tabPageProps, onAdd: undefined, onBack: () => undefined, - staffMembers, - ...pageListProps.default + staffMembers }; storiesOf("Views / Staff / Staff members", module) diff --git a/src/storybook/stories/translations/TranslationsEntitiesListPage.tsx b/src/storybook/stories/translations/TranslationsEntitiesListPage.tsx index 1dd1cba50..e58bca6bc 100644 --- a/src/storybook/stories/translations/TranslationsEntitiesListPage.tsx +++ b/src/storybook/stories/translations/TranslationsEntitiesListPage.tsx @@ -1,7 +1,7 @@ import { storiesOf } from "@storybook/react"; import React from "react"; -import { pageListProps } from "../../../fixtures"; +import { pageListProps, searchPageProps } from "../../../fixtures"; import TranslationsEntitiesList from "../../../translations/components/TranslationsEntitiesList"; import TranslationsEntitiesListPage, { TranslationsEntitiesListPageProps @@ -11,6 +11,7 @@ import Decorator from "../../Decorator"; const props: TranslationsEntitiesListPageProps = { ...pageListProps.default, + ...searchPageProps, children: null, filters: { current: "products",