import * as React from 'react'; import { Route } from 'react-router'; import { Link } from 'react-router-dom'; import fakeDataProvider from 'ra-data-fakerest'; import { CoreAdminContext, CoreAdminUI, CustomRoutes, Resource, } from '../../core'; import { localStorageStore } from '../../store'; import { FakeBrowserDecorator } from '../../storybook/FakeBrowser'; import { CoreLayoutProps, SortPayload } from '../../types'; import { useListController } from './useListController'; export default { title: 'ra-core/controller/list/useListController', decorators: [FakeBrowserDecorator], parameters: { initialEntries: ['/top'], }, }; const styles = { mainContainer: { margin: '20px 10px', }, ul: { marginTop: '20px', padding: '10px', }, }; const dataProvider = fakeDataProvider({ posts: [ { id: 1, title: 'Post #1', votes: 90 }, { id: 2, title: 'Post #2', votes: 20 }, { id: 3, title: 'Post #3', votes: 30 }, { id: 4, title: 'Post #4', votes: 40 }, { id: 5, title: 'Post #5', votes: 50 }, { id: 6, title: 'Post #6', votes: 60 }, { id: 7, title: 'Post #7', votes: 70 }, ], }); const OrderedPostList = ({ storeKey, sort, }: { storeKey: string; sort?: SortPayload; }) => { const params = useListController({ resource: 'posts', debounce: 200, perPage: 3, sort, storeKey, }); return (