saleor-dashboard/src/customers/components/CustomerListPage/CustomerListPage.stories.tsx

66 lines
1.7 KiB
TypeScript
Raw Normal View History

2019-09-12 13:31:08 +00:00
import {
filterPageProps,
2019-09-12 13:31:08 +00:00
listActionsProps,
pageListProps,
searchPageProps,
2020-01-02 12:22:12 +00:00
sortPageProps,
tabPageProps,
} 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,
selectedCustomerIds: ["123"],
2020-01-02 12:22:12 +00:00
filterOpts: {
joined: {
active: false,
value: {
max: undefined,
min: undefined,
},
2020-01-02 12:22:12 +00:00
},
numberOfOrders: {
active: false,
value: {
max: undefined,
min: undefined,
},
},
2020-01-02 12:22:12 +00:00
},
2019-12-17 17:13:56 +00:00
sort: {
...sortPageProps.sort,
sort: CustomerListUrlSortField.name,
},
2019-06-19 14:40:52 +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)
Enhancements to pagination navigation (#2063) * Update macaw to include Paginator changes * Add link support to TablePagination component * Rewrite usePaginator to use context and links instead of onClick * Refactor ProductList to use new usePaginator hook * Add decorator for PaginatorContext in ProductList stories * Refactor AppList to use new usePaginator hook * Refactor AttributeList to use new usePaginator hook * Add missing pagination props for local pagination to AttributeValues * Refactor CategoryList to use new usePaginator hook * Refactor CategoryDetails to use useLocalPaginator and context * Refactor CollectionList to use new usePaginator hook * Refactor CollectionProducts to use new usePaginator hook * Refactor CustomerList to use new usePaginator hook * Refactor VoucherDetailsPage to use PaginationContext * Refactor SaleDetails to use PaginatorContext * Refactor SaleList to use new usePaginator hook * Refactor VoucherList to use new usePaginator hook * Fix type error in paginatorContextValues fixture * Refactor GitfCardList to use new usePaginator hook * Remove unused imports * Refactor MenuList to use new usePaginator hook * Refactor OrderDraftList to use new usePaginator hook * Refactor OrderListPage to use new usePaginator hook * Refactor PageList to use new usePaginator hook * Refactor PageTypeList to use new usePaginator hook * Refactor PermissionGroupList to use new usePaginator hook * Refactor PluginsList to use new usePaginator hook * Refactor ProductTypeList to use new usePaginator hook * Refactor ShippingMethodProducts to use PaginationContext * Refactor ShippingZonesList to use new usePaginator hook * Refactor StaffList to use new usePaginator hook * Fix TS errors * Update TranslationEntities and TranslationFields to use new usePaginator * Refactor WarehouseList to use new usePaginator hook * Fix errors in stories that didn't use PaginationContextDecorator * Mention changes in changelog * Update to latest macaw version, update snapshots
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={[]} />);