@riosst100/pwa-marketplace 2.2.4 → 2.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@riosst100/pwa-marketplace",
3
3
  "author": "riosst100@gmail.com",
4
- "version": "2.2.4",
4
+ "version": "2.2.5",
5
5
  "main": "src/index.js",
6
6
  "pwa-studio": {
7
7
  "targets": {
@@ -99,7 +99,7 @@ const MegaMenuItem = props => {
99
99
  }
100
100
  : {};
101
101
 
102
- return (
102
+ return category.name != 'Auction' && (
103
103
  <div
104
104
  className={cn(itemClassName, megaMenuItemClassname)}
105
105
  data-cy="MegaMenu-MegaMenuItem-megaMenuItem"
@@ -37,8 +37,10 @@ const SubmenuColumn = props => {
37
37
  // return ;
38
38
  // };
39
39
 
40
+ let childrenItems = '';
41
+
40
42
  if (category.children.length) {
41
- const childrenItems = category.children.map((subCategory, index) => {
43
+ childrenItems = category.children.map((subCategory, index) => {
42
44
  const { url_path, isActive, name } = subCategory;
43
45
  const categoryUrl = resourceUrl(
44
46
  `/${url_path}${categoryUrlSuffix || ''}`
@@ -73,10 +75,22 @@ const SubmenuColumn = props => {
73
75
  />
74
76
  ) : '';
75
77
 
76
- return (
77
- <li key={index} className={cn(classes.submenuChildItem, 'mt-0')}>
78
- {customMenuItems.length ? (
79
- <>
78
+ // if (customMenuItems.length) {
79
+ // console.log(customMenuItems)
80
+ // }
81
+
82
+ // var childLi = '';
83
+ let result = [];
84
+
85
+ if (customMenuItems.length) {
86
+ // console.log('customMenuItems length')
87
+ // console.log(customMenuItems)
88
+
89
+ customMenuItems.map((submenu, index) => {
90
+ const {name, path} = submenu;
91
+
92
+ result.push(
93
+ <li key={index} className={cn(classes.submenuChildItem, 'mt-0')}>
80
94
  <Link
81
95
  {...keyboardProps}
82
96
  className={isActive ? classes.linkActive : classes.link}
@@ -89,8 +103,14 @@ const SubmenuColumn = props => {
89
103
  >
90
104
  {name}
91
105
  </Link>
92
- </>
93
- ) : (
106
+ </li>
107
+ )
108
+ })
109
+
110
+ // console.log(childrenItems)
111
+ } else {
112
+ result.push(
113
+ <li key={index} className={cn(classes.submenuChildItem, 'mt-0')}>
94
114
  <Link
95
115
  {...keyboardProps}
96
116
  className={isActive ? classes.linkActive : classes.link}
@@ -103,11 +123,59 @@ const SubmenuColumn = props => {
103
123
  >
104
124
  {name}
105
125
  </Link>
106
- )}
126
+ </li>
127
+ );
128
+ }
129
+
130
+ // return '';
131
+
132
+ // return childLi;
133
+
134
+
135
+
136
+
137
+ return result;
138
+ });
139
+ }
140
+
141
+ if (category.custom_submenu && category.custom_submenu.length)
142
+ {
143
+ childrenItems = category.custom_submenu.map((subCategory, index) => {
144
+ const { path, isActive, name } = subCategory;
145
+ const categoryUrl = resourceUrl(
146
+ `/${path}`
147
+ );
148
+
149
+ // setting keyboardProps if it is last child of that category
150
+ const keyboardProps =
151
+ index === category.children.length - 1
152
+ ? props.keyboardProps
153
+ : {};
154
+
155
+ let result = [];
156
+
157
+ result.push(
158
+ <li key={index} className={cn(classes.submenuChildItem, 'mt-0')}>
159
+ <Link
160
+ {...keyboardProps}
161
+ className={isActive ? classes.linkActive : classes.link}
162
+ data-cy="MegaMenu-SubmenuColumn-link"
163
+ to={categoryUrl}
164
+ onClick={() => {
165
+ handleCloseSubMenu();
166
+ onNavigate();
167
+ }}
168
+ >
169
+ {name}
170
+ </Link>
107
171
  </li>
108
172
  );
173
+
174
+ return result;
109
175
  });
176
+ }
110
177
 
178
+ if (childrenItems) {
111
179
  children = <ul className={classes.submenuChild}>{childrenItems}</ul>;
112
180
  }
113
181