From aa04c35e73ddd1f2d38de68e437c0c3d697d42e2 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 24 Apr 2021 18:43:52 +0300 Subject: feat: add loading indicator stubs --- src/components/ListTable.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/components') diff --git a/src/components/ListTable.tsx b/src/components/ListTable.tsx index 6874387..9b880a3 100644 --- a/src/components/ListTable.tsx +++ b/src/components/ListTable.tsx @@ -10,6 +10,7 @@ export interface Field { interface Props { items?: T[]; fields: Field[]; + isValidating?: boolean; handleRowClick?: (item: T, index?: number) => void; } @@ -24,7 +25,7 @@ const getItemField = (item: any, field: Field) => { }; -const ListTable: React.FC = ({ items = [], fields, handleRowClick = () => {} }) => { +const ListTable: React.FC = ({ items = [], fields, isValidating, handleRowClick = () => {} }) => { const [sortBy, setSortBy] = useState(''); const [sortOrder, setSortOrder] = useState<'asc' | 'desc'>('asc'); @@ -40,7 +41,11 @@ const ListTable: React.FC = ({ items = [], fields, handleRowClick = () => setSortBy(field.key); }, [sortBy, sortOrder]); - if (!items.length) return
Ничего не найдено
; + if (!items.length) return ( +
+ {isValidating ? 'Загрузка...' : 'Ничего не найдено'} +
+ ); return ( -- cgit v1.2.3