Skip to content

Commit 733108d

Browse files
committed
Add story for partial pagination
1 parent b921443 commit 733108d

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

packages/ra-ui-materialui/src/list/InfiniteList.stories.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,3 +383,36 @@ export const WithSimpleList = () => (
383383
/>
384384
</Admin>
385385
);
386+
387+
export const PartialPagination = () => (
388+
<Admin
389+
dataProvider={{
390+
...dataProvider,
391+
getList: (resource, params) =>
392+
dataProvider
393+
.getList(resource, params)
394+
.then(({ data, total }) => ({
395+
data,
396+
pageInfo: {
397+
hasNextPage:
398+
total! >
399+
params.pagination.page *
400+
params.pagination.perPage,
401+
hasPreviousPage: params.pagination.page > 1,
402+
},
403+
})),
404+
}}
405+
>
406+
<Resource
407+
name="books"
408+
list={() => (
409+
<InfiniteList>
410+
<SimpleList
411+
primaryText="%{title}"
412+
secondaryText="%{author}"
413+
/>
414+
</InfiniteList>
415+
)}
416+
/>
417+
</Admin>
418+
);

0 commit comments

Comments
 (0)