diff options
Diffstat (limited to 'src/components/ListTable.tsx')
-rw-r--r-- | src/components/ListTable.tsx | 9 |
1 files changed, 7 insertions, 2 deletions
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<T = any> { 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<Props> = ({ items = [], fields, handleRowClick = () => {} }) => { +const ListTable: React.FC<Props> = ({ items = [], fields, isValidating, handleRowClick = () => {} }) => { const [sortBy, setSortBy] = useState<string>(''); const [sortOrder, setSortOrder] = useState<'asc' | 'desc'>('asc'); @@ -40,7 +41,11 @@ const ListTable: React.FC<Props> = ({ items = [], fields, handleRowClick = () => setSortBy(field.key); }, [sortBy, sortOrder]); - if (!items.length) return <div className="text-center p-6">Ничего не найдено</div>; + if (!items.length) return ( + <div className="text-center p-6"> + {isValidating ? 'Загрузка...' : 'Ничего не найдено'} + </div> + ); return ( <table className="table-auto w-full"> |