Quellcode durchsuchen

add fade in on product sort

master
azri vor 6 Tagen
Ursprung
Commit
cc5bead316
1 geänderte Dateien mit 10 neuen und 3 gelöschten Zeilen
  1. 10
    3
      src/components/ProductList/ProductList.jsx

+ 10
- 3
src/components/ProductList/ProductList.jsx Datei anzeigen

@@ -71,11 +71,14 @@ const ProductList = ({ size = 99999 }) => {
71 71
   useEffect(() => {
72 72
 
73 73
     console.log("Products: ", products)
74
-    
74
+
75 75
     if (products.length > 0) {
76 76
 
77 77
       let newFilteredProducts = filterProducts()
78
-      setFilteredProducts(newFilteredProducts)
78
+      setFilteredProducts([])
79
+      setTimeout(() => {
80
+        setFilteredProducts(newFilteredProducts)
81
+      }, 100);
79 82
 
80 83
       const tagList = getAllTags(newFilteredProducts);
81 84
       setTagFilterOption(tagList);
@@ -99,7 +102,11 @@ const ProductList = ({ size = 99999 }) => {
99 102
   useEffect(() => {
100 103
 
101 104
     let newFilteredProducts = filterProducts()
102
-    setFilteredProducts(newFilteredProducts)
105
+    setFilteredProducts([])
106
+    setTimeout(() => {
107
+      setFilteredProducts(newFilteredProducts)
108
+    }, 100);
109
+
103 110
 
104 111
   }, [tags, collection, sort])
105 112
 

Laden…
Abbrechen
Speichern