saleor-dashboard/src/discounts/components/VoucherListPage/VoucherListPage.stories.tsx

87 lines
1.9 KiB
TypeScript
Raw Normal View History

import { voucherList } from "@dashboard/discounts/fixtures";
import { VoucherListUrlSortField } from "@dashboard/discounts/urls";
2019-09-12 13:31:08 +00:00
import {
filterPageProps,
2019-09-12 13:31:08 +00:00
listActionsProps,
pageListProps,
searchPageProps,
2020-01-03 15:17:51 +00:00
sortPageProps,
tabPageProps,
} from "@dashboard/fixtures";
import { DiscountStatusEnum, VoucherDiscountType } from "@dashboard/graphql";
2023-01-05 12:34:34 +00:00
import React from "react";
import { PaginatorContextDecorator } from "../../../../.storybook/decorators";
2023-01-05 12:34:34 +00:00
import VoucherListPage, { VoucherListPageProps } from "./VoucherListPage";
2019-06-19 14:40:52 +00:00
const props: VoucherListPageProps = {
...listActionsProps,
...pageListProps.default,
2019-09-12 13:31:08 +00:00
...searchPageProps,
2019-12-17 17:13:56 +00:00
...sortPageProps,
2019-09-12 13:31:08 +00:00
...tabPageProps,
2020-01-03 15:17:51 +00:00
...filterPageProps,
filterOpts: {
channel: {
active: false,
value: "default-channel",
choices: [
{
value: "default-channel",
label: "Default channel",
},
],
},
2020-01-03 15:17:51 +00:00
saleType: {
active: false,
value: [VoucherDiscountType.FIXED, VoucherDiscountType.PERCENTAGE],
2020-01-03 15:17:51 +00:00
},
started: {
active: false,
value: {
max: undefined,
min: undefined,
},
2020-01-03 15:17:51 +00:00
},
status: {
active: false,
value: [DiscountStatusEnum.ACTIVE],
2020-01-03 15:17:51 +00:00
},
timesUsed: {
active: false,
value: {
max: undefined,
min: undefined,
},
},
2020-01-03 15:17:51 +00:00
},
selectedChannelId: "123",
2019-12-17 17:13:56 +00:00
sort: {
...sortPageProps.sort,
sort: VoucherListUrlSortField.code,
2019-12-17 17:13:56 +00:00
},
vouchers: voucherList,
2019-06-19 14:40:52 +00:00
};
export default {
title: "Discounts / Voucher list",
decorators: [PaginatorContextDecorator],
};
export const Default = () => <VoucherListPage {...props} />;
export const Loading = () => (
<VoucherListPage {...props} vouchers={undefined} />
);
export const NoChannels = () => (
<VoucherListPage
{...props}
selectedChannelId=""
vouchers={voucherList.map(voucher => ({
...voucher,
channelListings: [],
}))}
/>
);