2019-09-12 13:31:08 +00:00
|
|
|
import {
|
2020-05-14 09:30:32 +00:00
|
|
|
filterPageProps,
|
2019-09-12 13:31:08 +00:00
|
|
|
listActionsProps,
|
|
|
|
pageListProps,
|
|
|
|
searchPageProps,
|
2020-01-02 12:22:12 +00:00
|
|
|
sortPageProps,
|
2022-06-21 09:36:55 +00:00
|
|
|
tabPageProps,
|
2023-01-16 09:45:12 +00:00
|
|
|
} from "@dashboard/fixtures";
|
|
|
|
import Decorator from "@dashboard/storybook/Decorator";
|
|
|
|
import { MockedUserProvider } from "@dashboard/storybook/MockedUserProvider";
|
|
|
|
import { PaginatorContextDecorator } from "@dashboard/storybook/PaginatorContextDecorator";
|
2023-01-05 12:34:34 +00:00
|
|
|
import { storiesOf } from "@storybook/react";
|
|
|
|
import React from "react";
|
|
|
|
|
|
|
|
import { customerList } from "../../fixtures";
|
|
|
|
import { CustomerListUrlSortField } from "../../urls";
|
|
|
|
import CustomerListPageComponent, {
|
|
|
|
CustomerListPageProps,
|
|
|
|
} from "./CustomerListPage";
|
2019-06-19 14:40:52 +00:00
|
|
|
|
|
|
|
const props: CustomerListPageProps = {
|
2020-01-02 12:22:12 +00:00
|
|
|
...filterPageProps,
|
2019-06-19 14:40:52 +00:00
|
|
|
...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,
|
2019-12-17 17:13:56 +00:00
|
|
|
customers: customerList,
|
2022-10-26 11:19:20 +00:00
|
|
|
selectedCustomerIds: ["123"],
|
2020-01-02 12:22:12 +00:00
|
|
|
filterOpts: {
|
|
|
|
joined: {
|
|
|
|
active: false,
|
|
|
|
value: {
|
|
|
|
max: undefined,
|
2022-06-21 09:36:55 +00:00
|
|
|
min: undefined,
|
|
|
|
},
|
2020-01-02 12:22:12 +00:00
|
|
|
},
|
|
|
|
numberOfOrders: {
|
|
|
|
active: false,
|
|
|
|
value: {
|
|
|
|
max: undefined,
|
2022-06-21 09:36:55 +00:00
|
|
|
min: undefined,
|
|
|
|
},
|
|
|
|
},
|
2020-01-02 12:22:12 +00:00
|
|
|
},
|
2019-12-17 17:13:56 +00:00
|
|
|
sort: {
|
|
|
|
...sortPageProps.sort,
|
2022-06-21 09:36:55 +00:00
|
|
|
sort: CustomerListUrlSortField.name,
|
|
|
|
},
|
2019-06-19 14:40:52 +00:00
|
|
|
};
|
|
|
|
|
2022-03-01 08:38:23 +00:00
|
|
|
const CustomerListPage = props => (
|
|
|
|
<MockedUserProvider>
|
|
|
|
<CustomerListPageComponent {...props} />
|
|
|
|
</MockedUserProvider>
|
|
|
|
);
|
|
|
|
|
2023-01-05 12:34:34 +00:00
|
|
|
storiesOf("Customers / Customer list", module)
|
2019-06-19 14:40:52 +00:00
|
|
|
.addDecorator(Decorator)
|
2022-05-31 12:53:16 +00:00
|
|
|
.addDecorator(PaginatorContextDecorator)
|
2019-06-19 14:40:52 +00:00
|
|
|
.add("default", () => <CustomerListPage {...props} />)
|
|
|
|
.add("loading", () => (
|
|
|
|
<CustomerListPage {...props} disabled={true} customers={undefined} />
|
|
|
|
))
|
|
|
|
.add("no data", () => <CustomerListPage {...props} customers={[]} />);
|