saleor-dashboard/src/staff/components/StaffListPage/StaffListPage.stories.tsx
Jonatan Witoszek 1a19289e43
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 14:53:16 +02:00

51 lines
1.4 KiB
TypeScript

import {
filterPageProps,
limits,
limitsReached,
pageListProps,
searchPageProps,
sortPageProps,
tabPageProps
} from "@saleor/fixtures";
import { StaffMemberStatus } from "@saleor/graphql";
import { staffMembers } from "@saleor/staff/fixtures";
import { StaffListUrlSortField } from "@saleor/staff/urls";
import Decorator from "@saleor/storybook/Decorator";
import { PaginatorContextDecorator } from "@saleor/storybook/PaginatorContextDecorator";
import { storiesOf } from "@storybook/react";
import React from "react";
import StaffListPage, { StaffListPageProps } from ".";
const props: StaffListPageProps = {
...pageListProps.default,
...searchPageProps,
...sortPageProps,
...tabPageProps,
...filterPageProps,
filterOpts: {
status: {
active: false,
value: StaffMemberStatus.ACTIVE
}
},
limits,
onAdd: undefined,
sort: {
...sortPageProps.sort,
sort: StaffListUrlSortField.name
},
staffMembers
};
storiesOf("Views / Staff / Staff members", module)
.addDecorator(Decorator)
.addDecorator(PaginatorContextDecorator)
.add("default", () => <StaffListPage {...props} />)
.add("when loading", () => (
<StaffListPage {...props} disabled={true} staffMembers={undefined} />
))
.add("no limits", () => <StaffListPage {...props} limits={undefined} />)
.add("limits reached", () => (
<StaffListPage {...props} limits={limitsReached} />
));