From aa04c35e73ddd1f2d38de68e437c0c3d697d42e2 Mon Sep 17 00:00:00 2001
From: eug-vs <eug-vs@keemail.me>
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/ListTable.tsx')

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">
-- 
cgit v1.2.3

