saleor-dashboard/src/storybook/stories/collections/CollectionDetailsPage.tsx

53 lines
1.6 KiB
TypeScript
Raw Normal View History

2019-06-19 14:40:52 +00:00
import { Omit } from "@material-ui/core";
import { storiesOf } from "@storybook/react";
2019-08-09 10:26:22 +00:00
import React from "react";
2019-06-19 14:40:52 +00:00
2019-08-09 11:14:35 +00:00
import placeholderCollectionImage from "../@assets/images/block1.jpg";
import placeholderProductImage from "../@assets/images/placeholder60x60.png";
2019-06-19 14:40:52 +00:00
import CollectionDetailsPage, {
CollectionDetailsPageProps
} from "../../../collections/components/CollectionDetailsPage";
import { collection as collectionFixture } from "../../../collections/fixtures";
import { listActionsProps, pageListProps } from "../../../fixtures";
import Decorator from "../../Decorator";
const collection = collectionFixture(
placeholderCollectionImage,
placeholderProductImage
);
const props: Omit<CollectionDetailsPageProps, "classes"> = {
...listActionsProps,
...pageListProps.default,
collection,
disabled: false,
isFeatured: true,
onBack: () => undefined,
onCollectionRemove: () => undefined,
onImageDelete: () => undefined,
onImageUpload: () => undefined,
onProductUnassign: () => undefined,
onSubmit: () => undefined,
saveButtonBarState: "default"
};
storiesOf("Views / Collections / Collection details", module)
.addDecorator(Decorator)
.add("default", () => <CollectionDetailsPage {...props} />)
.add("loading", () => (
<CollectionDetailsPage {...props} collection={undefined} disabled={true} />
))
.add("no products", () => (
<CollectionDetailsPage
{...props}
collection={{
...collection,
products: {
...collection.products,
edges: []
}
}}
disabled={true}
/>
));