Kaynağa Gözat

feat module 1,2,4 : change to dynamic navigation menu based on shopify collection - mobile view

master
nadia 1 ay önce
ebeveyn
işleme
3537112fd2

+ 5
- 1
src/components/Navbar/components/MobileNav/MobileNav.jsx Dosyayı Görüntüle

30
 
30
 
31
   const findCollectionForMenuItem = (productType, item) => {
31
   const findCollectionForMenuItem = (productType, item) => {
32
     const targetTitles = (item?.titles || []).map(normalizeTitle);
32
     const targetTitles = (item?.titles || []).map(normalizeTitle);
33
+    const targetHandles = (item?.handles || []).map(normalizeTitle);
33
 
34
 
34
     return products
35
     return products
35
       .filter((product) => product.productType === productType)
36
       .filter((product) => product.productType === productType)
36
       .flatMap((product) => product.collections || [])
37
       .flatMap((product) => product.collections || [])
37
-      .find((collection) => targetTitles.includes(normalizeTitle(collection?.title || "")));
38
+      .find((collection) =>
39
+        targetTitles.includes(normalizeTitle(collection?.title || "")) ||
40
+        targetHandles.includes(normalizeTitle(collection?.handle || ""))
41
+      );
38
   }
42
   }
39
 
43
 
40
   const getMenuCollectionTitles = (productType) => {
44
   const getMenuCollectionTitles = (productType) => {

Loading…
İptal
Kaydet