diff --git a/docs/List.md b/docs/List.md index f699bded81b..b8c03e402cd 100644 --- a/docs/List.md +++ b/docs/List.md @@ -86,25 +86,33 @@ The title can be either a string, or an element of your own. You can replace the list of default actions by your own element using the `actions` prop: ```jsx -import Button from '@material-ui/core/Button'; -import { CreateButton, ExportButton, RefreshButton } from 'react-admin'; -import Toolbar from '@material-ui/core/Toolbar'; +import React, { cloneElement, useMemo } from 'react'; +import PropTypes from 'prop-types'; +import { + TopToolbar, CreateButton, ExportButton, Button, sanitizeListRestProps, +} from 'react-admin'; +import IconEvent from '@material-ui/icons/Event'; -const PostActions = ({ - basePath, +const ListActions = ({ currentSort, - displayedFilters, - exporter, + className, + resource, filters, + displayedFilters, + exporter, // you can hide ExportButton if exporter = (null || false) filterValues, - onUnselectItems, - resource, + permanentFilter, + hasCreate, // you can hide CreateButton if hasCreate = false + basePath, selectedIds, + onUnselectItems, showFilter, - total + maxResults, + total, + ...rest }) => ( - - {filters && React.cloneElement(filters, { + + {filters && cloneElement(filters, { resource, showFilter, displayedFilters, @@ -116,16 +124,27 @@ const PostActions = ({ disabled={total === 0} resource={resource} sort={currentSort} - filter={filterValues} + filter={{ ...filterValues, ...permanentFilter }} exporter={exporter} + maxResults={maxResults} /> {/* Add your custom actions */} - - + + ); +ListActions.defaultProps = { + selectedIds: [], + onUnselectItems: () => null, +}; + export const PostList = (props) => ( - }> + }> ... );