Add state when no results with search

Signed-off-by: soupette <cyril@strapi.io>
This commit is contained in:
soupette 2021-08-31 19:41:56 +02:00
parent 460ea349e6
commit 8b278955bc
2 changed files with 11 additions and 3 deletions

View File

@ -12,18 +12,27 @@ import {
Row,
} from '@strapi/parts';
import { EditIcon, DeleteIcon } from '@strapi/icons';
import { EmptyBodyTable, Status } from '@strapi/helper-plugin';
import { EmptyBodyTable, Status, useQueryParams } from '@strapi/helper-plugin';
import TableHead from './TableHead';
const Table = ({ canDelete, canUpdate, rows }) => {
const [{ query }] = useQueryParams();
const ROW_COUNT = rows.length + 1;
const COL_COUNT = 7;
const hasFilters = query.filters !== undefined;
const content = hasFilters
? {
id: 'content-manager.components.TableEmpty.withFilters',
defaultMessage: 'There are no {contentType} with the applied filters...',
values: { contentType: 'Users' },
}
: undefined;
return (
<TableCompo colCount={COL_COUNT} rowCount={ROW_COUNT}>
<TableHead />
{!rows.length ? (
<EmptyBodyTable colSpan={COL_COUNT} />
<EmptyBodyTable colSpan={COL_COUNT} content={content} />
) : (
<Tbody>
{rows.map(entry => (

View File

@ -270,7 +270,6 @@ const ListPage = () => {
canDelete={canDelete}
canUpdate={canUpdate}
rows={data?.results}
erows={[]}
/>
)}
</CustomContentLayout>