import { voucherList } from "@saleor/discounts/fixtures"; import { VoucherListUrlSortField } from "@saleor/discounts/urls"; import { filterPageProps, listActionsProps, pageListProps, searchPageProps, sortPageProps, tabPageProps, } from "@saleor/fixtures"; import { DiscountStatusEnum, VoucherDiscountType } from "@saleor/graphql"; import Decorator from "@saleor/storybook/Decorator"; import { PaginatorContextDecorator } from "@saleor/storybook/PaginatorContextDecorator"; import { storiesOf } from "@storybook/react"; import React from "react"; import VoucherListPage, { VoucherListPageProps } from "./VoucherListPage"; const props: VoucherListPageProps = { ...listActionsProps, ...pageListProps.default, ...searchPageProps, ...sortPageProps, ...tabPageProps, ...filterPageProps, filterOpts: { channel: { active: false, value: "default-channel", choices: [ { value: "default-channel", label: "Default channel", }, ], }, saleType: { active: false, value: [VoucherDiscountType.FIXED, VoucherDiscountType.PERCENTAGE], }, started: { active: false, value: { max: undefined, min: undefined, }, }, status: { active: false, value: [DiscountStatusEnum.ACTIVE], }, timesUsed: { active: false, value: { max: undefined, min: undefined, }, }, }, selectedChannelId: "123", sort: { ...sortPageProps.sort, sort: VoucherListUrlSortField.code, }, vouchers: voucherList, }; storiesOf("Discounts / Voucher list", module) .addDecorator(Decorator) .addDecorator(PaginatorContextDecorator) .add("default", () => ) .add("loading", () => ) .add("no data", () => ) .add("no channels", () => ( ({ ...voucher, channelListings: [], }))} /> ));