Browse Source

add fade in on product sort

master
azri 6 days ago
parent
commit
cc5bead316
1 changed files with 10 additions and 3 deletions
  1. 10
    3
      src/components/ProductList/ProductList.jsx

+ 10
- 3
src/components/ProductList/ProductList.jsx View File

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

Loading…
Cancel
Save