@riosst100/pwa-marketplace 1.3.9 → 1.4.1

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.
Files changed (50) hide show
  1. package/package.json +1 -1
  2. package/src/componentOverrideMapping.js +4 -1
  3. package/src/components/AttributesBlock/attributesBlock.js +54 -0
  4. package/src/components/AttributesBlock/attributesBlock.module.css +28 -0
  5. package/src/components/BrandSlider/brandSlider.js +91 -0
  6. package/src/components/BrandSlider/index.js +1 -0
  7. package/src/components/BrandSlider/item.js +43 -0
  8. package/src/components/CollectibleGameSets/collectibleGameSets.js +52 -0
  9. package/src/components/CollectibleGameSets/index.js +1 -0
  10. package/src/components/CollectibleGameSetsPage/collectibleGameSetsPage.js +10 -0
  11. package/src/components/CollectibleGameSetsPage/index.js +1 -0
  12. package/src/components/Divider/index.js +11 -0
  13. package/src/components/SellerDetail/sellerDetail.js +1 -1
  14. package/src/components/SellerReviewItem/sellerReviewItem.js +51 -51
  15. package/src/components/SubCategory/subCategory.js +1 -1
  16. package/src/intercept.js +7 -0
  17. package/src/overwrites/peregrine/lib/talons/MegaMenu/megaMenu.gql.js +24 -0
  18. package/src/overwrites/peregrine/lib/talons/RootComponents/Category/categoryContent.gql.js +8 -0
  19. package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js +10 -1
  20. package/src/overwrites/venia-ui/lib/RootComponents/Category/category.module.css +1 -0
  21. package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +10 -1
  22. package/src/overwrites/venia-ui/lib/components/Button/button.js +100 -0
  23. package/src/overwrites/venia-ui/lib/components/Button/button.module.css +128 -0
  24. package/src/overwrites/venia-ui/lib/components/Button/index.js +1 -0
  25. package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterList.js +2 -2
  26. package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.module.css +2 -1
  27. package/src/overwrites/venia-ui/lib/components/Header/header.js +1 -1
  28. package/src/overwrites/venia-ui/lib/components/MegaMenu/customSubmenuColumn.js +55 -0
  29. package/src/overwrites/venia-ui/lib/components/MegaMenu/customSubmenuColumn.module.css +29 -0
  30. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.js +6 -3
  31. package/src/overwrites/venia-ui/lib/components/MegaMenu/shopByColumn.js +51 -2
  32. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.js +3 -20
  33. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.module.css +2 -1
  34. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.js +62 -11
  35. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.module.css +5 -0
  36. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/components/productReview.js +55 -0
  37. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +238 -46
  38. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.module.css +1 -5
  39. package/src/overwrites/venia-ui/lib/components/QuantityStepper/quantityStepper.js +23 -4
  40. package/src/overwrites/venia-ui/lib/components/QuantityStepper/quantityStepper.module.css +3 -7
  41. package/src/overwrites/venia-ui/lib/components/RadioGroup/radio.js +60 -0
  42. package/src/overwrites/venia-ui/lib/components/RadioGroup/radio.module.css +70 -0
  43. package/src/overwrites/venia-ui/lib/components/RichText/index.js +1 -0
  44. package/src/overwrites/venia-ui/lib/components/RichText/richText.js +21 -0
  45. package/src/overwrites/venia-ui/lib/components/RichText/richText.module.css +19 -0
  46. package/src/talons/AttributesBlock/attributesBlock.gql.js +15 -0
  47. package/src/talons/AttributesBlock/useAttributesBlock.js +37 -0
  48. package/src/talons/CollectibleGameSets/collectibleGameSets.gql.js +27 -0
  49. package/src/talons/CollectibleGameSets/useCollectibleGameSets.js +65 -0
  50. package/src/theme/vars.js +2 -0
@@ -0,0 +1,100 @@
1
+ import React, { useRef } from 'react';
2
+ import { useButton } from 'react-aria';
3
+ import { oneOf, shape, string, bool } from 'prop-types';
4
+
5
+ import { useStyle } from '@magento/venia-ui/lib/classify';
6
+ import defaultClasses from './button.module.css';
7
+ import cn from 'classnames';
8
+
9
+ const getRootClassName = (priority, negative) =>
10
+ `root_${priority}Priority${negative ? 'Negative' : ''}`;
11
+
12
+ /**
13
+ * A component for buttons.
14
+ *
15
+ * @typedef Button
16
+ * @kind functional component
17
+ *
18
+ * @param {props} props React component props
19
+ *
20
+ * @returns {React.Element} A React component that displays a single button.
21
+ */
22
+ const Button = props => {
23
+ const {
24
+ children,
25
+ classes: propClasses,
26
+ priority,
27
+ negative,
28
+ disabled,
29
+ onPress,
30
+ ...restProps
31
+ } = props;
32
+
33
+ const buttonRef = useRef();
34
+
35
+ const { buttonProps } = useButton(
36
+ {
37
+ isDisabled: disabled,
38
+ onPress,
39
+ ...restProps
40
+ },
41
+ buttonRef
42
+ );
43
+
44
+ const classes = useStyle(defaultClasses, propClasses);
45
+ const rootClassName = classes[getRootClassName(priority, negative)];
46
+
47
+ return (
48
+ <button
49
+ ref={buttonRef}
50
+ className={rootClassName}
51
+ {...buttonProps}
52
+ {...restProps}
53
+ >
54
+ <span className={cn(classes.content)}>{children}</span>
55
+ </button>
56
+ );
57
+ };
58
+
59
+ /**
60
+ * Props for {@link Button}
61
+ *
62
+ * @typedef props
63
+ *
64
+ * @property {Object} classes An object containing the class names for the
65
+ * Button component.
66
+ * @property {string} classes.content classes for the button content
67
+ * @property {string} classes.root classes for root container
68
+ * @property {string} classes.root_highPriority classes for Button if
69
+ * high priority.
70
+ * @property {string} classes.root_lowPriority classes for Button if
71
+ * low priority.
72
+ * @property {string} classes.root_normalPriority classes for Button if
73
+ * normal priority.
74
+ * @property {string} priority the priority/importance of the Button
75
+ * @property {string} type the type of the Button
76
+ * @property {bool} negative whether the button should be displayed in red for a negative action
77
+ * @property {bool} disabled is the button disabled
78
+ */
79
+ Button.propTypes = {
80
+ classes: shape({
81
+ content: string,
82
+ root: string,
83
+ root_highPriority: string,
84
+ root_lowPriority: string,
85
+ root_normalPriority: string
86
+ }),
87
+ priority: oneOf(['high', 'low', 'normal']).isRequired,
88
+ type: oneOf(['button', 'reset', 'submit']).isRequired,
89
+ negative: bool,
90
+ disabled: bool
91
+ };
92
+
93
+ Button.defaultProps = {
94
+ priority: 'normal',
95
+ type: 'button',
96
+ negative: false,
97
+ disabled: false
98
+ };
99
+
100
+ export default Button;
@@ -0,0 +1,128 @@
1
+ .root {
2
+ composes: border from global;
3
+ composes: border-solid from global;
4
+ composes: cursor-pointer from global;
5
+ composes: font-bold from global;
6
+ composes: inline-flex from global;
7
+ composes: items-center from global;
8
+ composes: justify-center from global;
9
+ composes: max-w-full from global;
10
+ composes: min-w-[10rem] from global;
11
+ composes: outline-none from global;
12
+ composes: pointer-events-auto from global;
13
+ composes: px-sm from global;
14
+ composes: rounded-full from global;
15
+ composes: text-center from global;
16
+ composes: text-sm from global;
17
+ composes: uppercase from global;
18
+ composes: py-2 from global;
19
+
20
+ transition-duration: 256ms;
21
+ transition-property: background-color, border-color, color;
22
+ transition-timing-function: var(--venia-global-anim-standard);
23
+
24
+ composes: disabled_bg-gray-400 from global;
25
+ composes: disabled_border-gray-400 from global;
26
+ composes: disabled_opacity-50 from global;
27
+ composes: disabled_pointer-events-none from global;
28
+ composes: disabled_text-white from global;
29
+
30
+ composes: focus_shadow-inputFocus from global;
31
+ }
32
+
33
+ .root:active {
34
+ transition-duration: 128ms;
35
+ }
36
+
37
+ /**
38
+ * Some browsers retain the :hover state after a click, this ensures if a button becomes disabled after
39
+ * being clicked it will be visually disabled.
40
+ */
41
+ .root:hover:disabled {
42
+ /* TODO @TW: cannot compose. This may not be possible with two variants. */
43
+ pointer-events: none;
44
+ }
45
+
46
+ .root_lowPriority {
47
+ composes: root;
48
+
49
+ composes: bg-transparent from global;
50
+ composes: border-gray-700 from global;
51
+ composes: text-gray-700 from global;
52
+
53
+ composes: active_border-gray-800 from global;
54
+ composes: active_text-gray-800 from global;
55
+
56
+ composes: hover_border-gray-800 from global;
57
+ composes: hover_text-gray-800 from global;
58
+ }
59
+
60
+ .root_normalPriority {
61
+ composes: root;
62
+
63
+ composes: bg-transparent from global;
64
+ composes: border-brand-dark from global;
65
+ composes: text-brand-dark from global;
66
+
67
+ composes: active_border-brand-darkest from global;
68
+ composes: active_text-brand-darkest from global;
69
+
70
+ composes: hover_border-brand-darkest from global;
71
+ composes: hover_text-brand-darkest from global;
72
+ }
73
+
74
+ .root_highPriority {
75
+ composes: root;
76
+
77
+ composes: bg-brand-dark from global;
78
+ composes: border-brand-dark from global;
79
+ composes: text-white from global;
80
+
81
+ composes: active_bg-brand-darkest from global;
82
+ composes: active_border-brand-darkest from global;
83
+ composes: active_text-white from global;
84
+
85
+ composes: hover_bg-brand-darkest from global;
86
+ composes: hover_border-brand-darkest from global;
87
+ composes: hover_text-white from global;
88
+ }
89
+
90
+ .root_lowPriorityNegative,
91
+ .root_normalPriorityNegative {
92
+ composes: root;
93
+
94
+ composes: bg-transparent from global;
95
+ composes: border-red-600 from global;
96
+ composes: text-red-600 from global;
97
+
98
+ composes: active_border-red-700 from global;
99
+ composes: active_text-red-700 from global;
100
+
101
+ composes: hover_border-red-700 from global;
102
+ composes: hover_text-red-700 from global;
103
+ }
104
+
105
+ .root_highPriorityNegative {
106
+ composes: root;
107
+
108
+ composes: bg-red-600 from global;
109
+ composes: border-red-600 from global;
110
+ composes: text-white from global;
111
+
112
+ composes: active_bg-red-700 from global;
113
+ composes: active_border-red-700 from global;
114
+ composes: active_text-white from global;
115
+
116
+ composes: hover_bg-red-700 from global;
117
+ composes: hover_border-red-700 from global;
118
+ composes: hover_text-white from global;
119
+ }
120
+
121
+ .content {
122
+ composes: gap-1.5 from global;
123
+ composes: grid-flow-col from global;
124
+ composes: inline-grid from global;
125
+ composes: items-center from global;
126
+ composes: justify-center from global;
127
+ composes: justify-items-center from global;
128
+ }
@@ -0,0 +1 @@
1
+ export { default } from './button';
@@ -102,7 +102,7 @@ const FilterList = props => {
102
102
  // memoize item creation
103
103
  // search value is not referenced, so this array is stable
104
104
  const itemElements = useMemo(() => {
105
- if (filterFrontendInput === 'boolean') {
105
+ // if (filterFrontendInput === 'boolean') {
106
106
  const key = `item-${group}`;
107
107
  return (
108
108
  <li
@@ -121,7 +121,7 @@ const FilterList = props => {
121
121
  />
122
122
  </li>
123
123
  );
124
- }
124
+ // }
125
125
 
126
126
  return items.map((item, index) => {
127
127
  const { title, value } = item;
@@ -44,7 +44,8 @@
44
44
  /* TODO @TW: cannot compose */
45
45
  .action button {
46
46
  /* composes: text-base from global; */
47
- font-size: 13px;
47
+ font-size: 12px;
48
+ /* composes: text-[13px] from global; */
48
49
  /* composes: no-underline from global; */
49
50
  font-weight: 500;
50
51
  text-decoration: underline;
@@ -81,7 +81,7 @@ const Header = props => {
81
81
  className={''}
82
82
  data-cy="Header-logoContainer"
83
83
  >
84
- <div className='text-base'><b>TCG Collective</b></div>
84
+ <div className='text-[14px]'><b>TCG Collective</b></div>
85
85
  <small>Bringing Collectors Together</small>
86
86
  </Link>
87
87
  </div>
@@ -0,0 +1,55 @@
1
+ import React from 'react';
2
+ import { Link } from 'react-router-dom';
3
+
4
+ import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
5
+
6
+ import { useStyle } from '@magento/venia-ui/lib/classify';
7
+ import defaultClasses from './customSubmenuColumn.module.css';
8
+
9
+ const CustomSubmenuColumn = props => {
10
+ const {
11
+ category,
12
+ categoryUrlSuffix,
13
+ onNavigate,
14
+ handleCloseSubMenu,
15
+ customMenuItems,
16
+ toggleCustomMenu
17
+ } = props;
18
+
19
+ const classes = useStyle(defaultClasses, props.classes);
20
+
21
+ let children = null;
22
+
23
+ if (customMenuItems.length) {
24
+ const childrenItems = customMenuItems.map((submenu, index) => {
25
+ const { name, path } = submenu;
26
+
27
+ const categoryUrl = resourceUrl(
28
+ `/${path}`
29
+ );
30
+
31
+ return (
32
+ <li key={index} className={classes.submenuChildItem}>
33
+ <Link
34
+ className={classes.link}
35
+ data-cy="MegaMenu-CustomSubmenuColumn-link"
36
+ to={categoryUrl}
37
+ onClick={() => {
38
+ handleCloseSubMenu();
39
+ onNavigate();
40
+ toggleCustomMenu();
41
+ }}
42
+ >
43
+ {name}
44
+ </Link>
45
+ </li>
46
+ );
47
+ });
48
+
49
+ children = <ul className={classes.submenuChild}>{childrenItems}</ul>;
50
+ }
51
+
52
+ return children;
53
+ };
54
+
55
+ export default CustomSubmenuColumn;
@@ -0,0 +1,29 @@
1
+ .customSubmenuColumn {
2
+ composes: max-w-[235px] from global;
3
+ composes: p-2 from global;
4
+ }
5
+
6
+ .heading {
7
+ composes: font-semibold from global;
8
+ }
9
+
10
+ .link {
11
+ composes: whitespace-nowrap from global;
12
+
13
+ composes: focus_underline from global;
14
+
15
+ composes: hover_underline from global;
16
+ }
17
+
18
+ .linkActive {
19
+ composes: underline from global;
20
+ }
21
+
22
+ .submenuChild {
23
+ margin-left: 15px;
24
+ composes: mt-0 from global;
25
+ }
26
+
27
+ .submenuChildItem {
28
+ composes: mb-0 from global;
29
+ }
@@ -61,6 +61,8 @@ const MegaMenuItem = props => {
61
61
  ? classes.megaMenuItem_active
62
62
  : classes.megaMenuItem;
63
63
 
64
+ const arrow = <ArrowDown2 className='ml-2 stroke-current' size="14" color={textPrimary} variant="Outline" />;
65
+
64
66
  const children = useMemo(() => {
65
67
  return category.children.length ? (
66
68
  <Submenu
@@ -73,6 +75,7 @@ const MegaMenuItem = props => {
73
75
  handleCloseSubMenu={handleCloseSubMenu}
74
76
  categoryUrlSuffix={categoryUrlSuffix}
75
77
  onNavigate={onNavigate}
78
+ arrow={arrow}
76
79
  />
77
80
  ) : null;
78
81
  }, [
@@ -86,7 +89,7 @@ const MegaMenuItem = props => {
86
89
  ]);
87
90
 
88
91
  const maybeDownArrowIcon = category.children.length ? (
89
- <ArrowDown2 className='ml-2 stroke-current' size="16" color={textPrimary} variant="Outline" />
92
+ <ArrowDown2 className='ml-2 stroke-current' size="14" color={textPrimary} variant="Outline" />
90
93
  ) : null;
91
94
 
92
95
  const linkAttributes = category.children.length
@@ -113,8 +116,8 @@ const MegaMenuItem = props => {
113
116
  handleMenuItemFocus();
114
117
  }}
115
118
  onMouseLeave={e => {
116
- handleClickOutside(e);
117
- handleCloseSubMenu();
119
+ // handleClickOutside(e);
120
+ // handleCloseSubMenu();
118
121
  }}
119
122
  >
120
123
  <Link
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  import { Link } from 'react-router-dom';
3
3
 
4
4
  import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
@@ -6,10 +6,13 @@ import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
6
6
  import { useStyle } from '@magento/venia-ui/lib/classify';
7
7
  import defaultClasses from './submenuColumn.module.css';
8
8
  import PropTypes from 'prop-types';
9
+ import { useIntl } from 'react-intl';
9
10
 
10
11
  const ShopByColumn = props => {
11
12
  const classes = useStyle(defaultClasses, props.classes);
12
13
 
14
+ const { formatMessage } = useIntl();
15
+
13
16
  const {
14
17
  shopBy,
15
18
  category,
@@ -22,8 +25,15 @@ const ShopByColumn = props => {
22
25
 
23
26
  let items = null;
24
27
 
28
+ const itemCountToShow = 9999;
29
+
25
30
  if (shopBy.items.length) {
26
31
  const childrenItems = shopBy.items.map((shopByItem, index) => {
32
+
33
+ if (index >= itemCountToShow) {
34
+ return null;
35
+ }
36
+
27
37
  const { name, option_id } = shopByItem;
28
38
  // const categoryUrl = resourceUrl(
29
39
  // `/${url_path}${categoryUrlSuffix || ''}`
@@ -47,7 +57,10 @@ const ShopByColumn = props => {
47
57
  className={classes.link}
48
58
  data-cy="MegaMenu-ShopByColumn-link"
49
59
  to={categoryUrl}
50
- onClick={handleCloseSubMenu}
60
+ onClick={() => {
61
+ handleCloseSubMenu();
62
+ onNavigate();
63
+ }}
51
64
  >
52
65
  {name}
53
66
  </Link>
@@ -58,11 +71,47 @@ const ShopByColumn = props => {
58
71
  items = <ul className={classes.submenuChild}>{childrenItems}</ul>;
59
72
  }
60
73
 
74
+ const viewAll = useMemo(() => {
75
+ if (shopBy.items.length <= itemCountToShow) {
76
+ return null;
77
+ }
78
+
79
+ const label = formatMessage({
80
+ id: 'filterList.viewAll',
81
+ defaultMessage: 'View All'
82
+ });
83
+
84
+ const categoryUrl = resourceUrl(
85
+ `/shop/${shopBy.code}`
86
+ );
87
+
88
+ return (
89
+ <li className={classes.submenuChildItem}>
90
+ <Link
91
+ // className={isActive ? classes.linkActive : classes.link}
92
+ className={classes.link}
93
+ data-cy="MegaMenu-ShopByColumn-link"
94
+ to={categoryUrl}
95
+ onClick={handleCloseSubMenu}
96
+ >
97
+ {label}
98
+ </Link>
99
+ </li>
100
+ );
101
+ }, [
102
+ // handleViewAll,
103
+ shopBy,
104
+ itemCountToShow,
105
+ formatMessage,
106
+ // classes
107
+ ]);
108
+
61
109
  return (
62
110
  <div className={classes.submenuItems}>
63
111
  <div className={classes.submenuColumn}>
64
112
  <span className={classes.heading}>{shopBy.name}</span>
65
113
  {items}
114
+ {viewAll}
66
115
  </div>
67
116
  </div>
68
117
  );
@@ -25,7 +25,8 @@ const Submenu = props => {
25
25
  handleCloseSubMenu,
26
26
  categoryUrlSuffix,
27
27
  parentCategory,
28
- onNavigate
28
+ onNavigate,
29
+ arrow
29
30
  } = props;
30
31
  const PADDING_OFFSET = 20;
31
32
  const classes = useStyle(defaultClasses, props.classes);
@@ -53,6 +54,7 @@ const Submenu = props => {
53
54
  category={category}
54
55
  categoryUrlSuffix={categoryUrlSuffix}
55
56
  onNavigate={onNavigate}
57
+ arrow={arrow}
56
58
  handleCloseSubMenu={handleCloseSubMenu}
57
59
  />
58
60
  );
@@ -102,22 +104,3 @@ const Submenu = props => {
102
104
  };
103
105
 
104
106
  export default Submenu;
105
-
106
- Submenu.propTypes = {
107
- items: PropTypes.arrayOf(
108
- PropTypes.shape({
109
- children: PropTypes.array.isRequired,
110
- uid: PropTypes.string.isRequired,
111
- include_in_menu: PropTypes.number.isRequired,
112
- isActive: PropTypes.bool.isRequired,
113
- name: PropTypes.string.isRequired,
114
- path: PropTypes.array.isRequired,
115
- position: PropTypes.number.isRequired,
116
- url_path: PropTypes.string.isRequired
117
- })
118
- ).isRequired,
119
- mainNavWidth: PropTypes.number.isRequired,
120
- categoryUrlSuffix: PropTypes.string,
121
- onNavigate: PropTypes.func.isRequired,
122
- handleCloseSubMenu: PropTypes.func.isRequired
123
- };
@@ -43,8 +43,9 @@
43
43
  .submenuItems {
44
44
  composes: flex from global;
45
45
  composes: flex-wrap from global;
46
+ composes: gap-[30px] from global;
46
47
  /* composes: justify-between from global; */
47
48
  /* composes: ml-auto from global; */
48
49
  /* composes: mr-auto from global; */
49
- composes: flex-col from global;
50
+ /* composes: flex-col from global; */
50
51
  }
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useEffect, useState } from 'react';
2
2
  import { Link } from 'react-router-dom';
3
3
 
4
4
  import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
@@ -6,6 +6,9 @@ import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
6
6
  import { useStyle } from '@magento/venia-ui/lib/classify';
7
7
  import defaultClasses from './submenuColumn.module.css';
8
8
  import PropTypes from 'prop-types';
9
+ import { ArrowDown2 } from 'iconsax-react';
10
+ import { textPrimary } from '@riosst100/pwa-marketplace/src/theme/vars';
11
+ import CustomSubmenuColumn from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/MegaMenu/customSubmenuColumn';
9
12
 
10
13
  /**
11
14
  * The SubmenuColumn component displays columns with categories in submenu
@@ -18,7 +21,8 @@ const SubmenuColumn = props => {
18
21
  category,
19
22
  categoryUrlSuffix,
20
23
  onNavigate,
21
- handleCloseSubMenu
24
+ handleCloseSubMenu,
25
+ arrow
22
26
  } = props;
23
27
 
24
28
  const classes = useStyle(defaultClasses, props.classes);
@@ -28,6 +32,10 @@ const SubmenuColumn = props => {
28
32
  );
29
33
  let children = null;
30
34
 
35
+ // let maybeDownArrowIcon = () => {
36
+ // return ;
37
+ // };
38
+
31
39
  if (category.children.length) {
32
40
  const childrenItems = category.children.map((subCategory, index) => {
33
41
  const { url_path, isActive, name } = subCategory;
@@ -41,17 +49,60 @@ const SubmenuColumn = props => {
41
49
  ? props.keyboardProps
42
50
  : {};
43
51
 
52
+ const customMenuItems = subCategory.custom_submenu;
53
+
54
+ const [showCustomMenu, setShowCustomMenu] = useState(false);
55
+
56
+ const toggleCustomMenu = () => {
57
+ if (!showCustomMenu) {
58
+ setShowCustomMenu(true);
59
+ } else {
60
+ setShowCustomMenu(false);
61
+ }
62
+ }
63
+
64
+ const customSubMenus = customMenuItems.length ? (
65
+ <CustomSubmenuColumn
66
+ categoryUrlSuffix={categoryUrlSuffix}
67
+ onNavigate={onNavigate}
68
+ handleCloseSubMenu={handleCloseSubMenu}
69
+ category={subCategory}
70
+ customMenuItems={customMenuItems}
71
+ toggleCustomMenu={toggleCustomMenu}
72
+ />
73
+ ) : '';
74
+
44
75
  return (
45
76
  <li key={index} className={classes.submenuChildItem}>
46
- <Link
47
- {...keyboardProps}
48
- className={isActive ? classes.linkActive : classes.link}
49
- data-cy="MegaMenu-SubmenuColumn-link"
50
- to={categoryUrl}
51
- onClick={onNavigate}
52
- >
53
- {name}
54
- </Link>
77
+ {customMenuItems.length ? (
78
+ <>
79
+ <div
80
+ // {...keyboardProps}
81
+ className={isActive ? classes.linkActive : classes.link}
82
+ data-cy="MegaMenu-SubmenuColumn-link"
83
+ onClick={() => {
84
+ toggleCustomMenu();
85
+ }}
86
+ >
87
+ {name}
88
+ {arrow}
89
+ </div>
90
+ {showCustomMenu ? customSubMenus : ''}
91
+ </>
92
+ ) : (
93
+ <Link
94
+ {...keyboardProps}
95
+ className={isActive ? classes.linkActive : classes.link}
96
+ data-cy="MegaMenu-SubmenuColumn-link"
97
+ to={categoryUrl}
98
+ onClick={() => {
99
+ handleCloseSubMenu();
100
+ onNavigate();
101
+ }}
102
+ >
103
+ {name}
104
+ </Link>
105
+ )}
55
106
  </li>
56
107
  );
57
108
  });
@@ -13,10 +13,15 @@
13
13
  composes: focus_underline from global;
14
14
 
15
15
  composes: hover_underline from global;
16
+
17
+ align-items: center;
18
+ composes: flex from global;
16
19
  }
17
20
 
18
21
  .linkActive {
19
22
  composes: underline from global;
23
+ align-items: center;
24
+ composes: flex from global;
20
25
  }
21
26
 
22
27
  .submenuChild {