Fix stories

This commit is contained in:
dominik-zeglen 2019-09-12 15:31:08 +02:00
parent 490c3b7543
commit 08cbf24964
9 changed files with 76 additions and 28 deletions

View file

@ -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,

View file

@ -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", () => <CollectionListPage {...props} />)
.add("loading", () => (
<CollectionListPage {...props} collections={undefined} disabled={true} />
));
))
.add("no data", () => <CollectionListPage {...props} collections={[]} />);

View file

@ -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
};

View file

@ -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
};

View file

@ -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
};

View file

@ -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
};

View file

@ -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", () => (
<ProductTypeListPage
onBack={() => undefined}
productTypes={productTypes}
{...listActionsProps}
{...pageListProps.default}
/>
))
.add("default", () => <ProductTypeListPage {...props} />)
.add("loading", () => (
<ProductTypeListPage
onBack={() => undefined}
productTypes={undefined}
{...listActionsProps}
{...pageListProps.loading}
/>
));
<ProductTypeListPage {...props} disabled={true} productTypes={undefined} />
))
.add("no data", () => <ProductTypeListPage {...props} productTypes={[]} />);

View file

@ -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)

View file

@ -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",