@riosst100/pwa-marketplace 1.3.8 → 1.4.0

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 (62) hide show
  1. package/package.json +1 -1
  2. package/src/componentOverrideMapping.js +1 -0
  3. package/src/components/AttributesBlock/attributesBlock.js +54 -0
  4. package/src/components/AttributesBlock/attributesBlock.module.css +28 -0
  5. package/src/components/BecomeSeller/becomeSeller.module.css +1 -1
  6. package/src/components/BecomeSellerLink/becomeSellerLink.js +1 -1
  7. package/src/components/CurrencySwitcher/index.js +1 -1
  8. package/src/components/Filter/index.js +2 -2
  9. package/src/components/Pagination/index.js +4 -4
  10. package/src/components/ProductItem/index.js +1 -1
  11. package/src/components/ProductListTab/productListTab.module.css +1 -1
  12. package/src/components/SellerDetail/sellerDetail.js +2 -2
  13. package/src/components/SellerInformation/sellerInformation.js +9 -9
  14. package/src/components/SellerLocation/sellerLocationItem.js +3 -3
  15. package/src/components/SellerProducts/sellerProducts.js +2 -2
  16. package/src/components/SellerReview/sellerReview.js +11 -11
  17. package/src/components/SellerReviewItem/sellerReviewItem.js +6 -6
  18. package/src/components/SellerVerification/sellerVerification.module.css +1 -1
  19. package/src/components/ShopByCategory/shopByCategory.module.css +1 -1
  20. package/src/components/SortBy/index.js +2 -2
  21. package/src/components/SubCategory/subCategory.js +1 -1
  22. package/src/components/SubCategory/subCategory.module.css +1 -1
  23. package/src/components/WebsiteSwitcher/websiteSwitcher.js +5 -5
  24. package/src/components/commons/Tabs/index.js +2 -2
  25. package/src/overwrites/peregrine/lib/talons/MegaMenu/megaMenu.gql.js +2 -0
  26. package/src/overwrites/peregrine/lib/talons/RootComponents/Category/categoryContent.gql.js +8 -0
  27. package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js +10 -1
  28. package/src/overwrites/venia-ui/lib/RootComponents/Category/category.module.css +2 -1
  29. package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +5 -1
  30. package/src/overwrites/venia-ui/lib/components/Breadcrumbs/breadcrumbs.module.css +4 -4
  31. package/src/overwrites/venia-ui/lib/components/Checkbox/checkbox.module.css +1 -1
  32. package/src/overwrites/venia-ui/lib/components/FilterModal/CurrentFilters/currentFilter.module.css +1 -1
  33. package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterList.js +2 -2
  34. package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterList.module.css +1 -1
  35. package/src/overwrites/venia-ui/lib/components/FilterModal/filterBlock.module.css +1 -1
  36. package/src/overwrites/venia-ui/lib/components/FilterModal/filterModal.module.css +1 -1
  37. package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.module.css +4 -3
  38. package/src/overwrites/venia-ui/lib/components/Gallery/item.module.css +3 -3
  39. package/src/overwrites/venia-ui/lib/components/Gallery/star.js +1 -1
  40. package/src/overwrites/venia-ui/lib/components/Header/accountTrigger.js +2 -2
  41. package/src/overwrites/venia-ui/lib/components/Header/cartTrigger.js +3 -3
  42. package/src/overwrites/venia-ui/lib/components/Header/cartTrigger.module.css +47 -0
  43. package/src/overwrites/venia-ui/lib/components/Header/header.js +2 -2
  44. package/src/overwrites/venia-ui/lib/components/Header/storeSwitcher.js +5 -5
  45. package/src/overwrites/venia-ui/lib/components/Header/wishlistTrigger.js +1 -1
  46. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.js +1 -0
  47. package/src/overwrites/venia-ui/lib/components/MegaMenu/shopByColumn.js +70 -25
  48. package/src/overwrites/venia-ui/lib/components/MegaMenu/shopByColumn.module.css +2 -4
  49. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.js +10 -7
  50. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.module.css +14 -7
  51. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.js +4 -1
  52. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.module.css +3 -3
  53. package/src/overwrites/venia-ui/lib/components/ProductFullDetail/productFullDetail.js +2 -2
  54. package/src/overwrites/venia-ui/lib/components/ProductSort/productSort.module.css +1 -1
  55. package/src/overwrites/venia-ui/lib/components/ProductSort/sortItem.module.css +1 -1
  56. package/src/overwrites/venia-ui/lib/components/RadioGroup/radio.js +60 -0
  57. package/src/overwrites/venia-ui/lib/components/RadioGroup/radio.module.css +70 -0
  58. package/src/overwrites/venia-ui/lib/components/SearchBar/autocomplete.module.css +1 -1
  59. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestions.module.css +1 -1
  60. package/src/overwrites/venia-ui/lib/components/TextInput/field.module.css +1 -1
  61. package/src/talons/AttributesBlock/attributesBlock.gql.js +15 -0
  62. package/src/talons/AttributesBlock/useAttributesBlock.js +37 -0
@@ -91,6 +91,9 @@ export const useCategoryContent = props => {
91
91
  categoryData && categoryData.categories.items.length
92
92
  ? categoryData.categories.items[0].children
93
93
  : null;
94
+ const attributesBlock = categoryData && categoryData.categories.items.length
95
+ ? categoryData.categories.items[0].attributes_block
96
+ : null;
94
97
  const parent =
95
98
  categoryData && categoryData.categories.items.length
96
99
  ? categoryData.categories.items[0].parent
@@ -99,6 +102,10 @@ export const useCategoryContent = props => {
99
102
  ? data.products.page_info.total_pages
100
103
  : null;
101
104
  const totalCount = data ? data.products.total_count : null;
105
+ const category =
106
+ categoryData && categoryData.categories.items.length
107
+ ? categoryData.categories.items[0]
108
+ : null;
102
109
  const categoryName =
103
110
  categoryData && categoryData.categories.items.length
104
111
  ? categoryData.categories.items[0].name
@@ -134,6 +141,8 @@ export const useCategoryContent = props => {
134
141
  totalCount,
135
142
  totalPagesFromData,
136
143
  children,
137
- parent
144
+ parent,
145
+ attributesBlock,
146
+ category
138
147
  };
139
148
  };
@@ -20,6 +20,7 @@
20
20
 
21
21
  .categoryTitle {
22
22
  composes: font-semibold from global;
23
+ composes: text-[20px] from global;
23
24
  }
24
25
 
25
26
  .heading {
@@ -46,7 +47,7 @@
46
47
  composes: mx-0 from global;
47
48
  composes: my-xs from global;
48
49
  composes: text-center from global;
49
- composes: text-[14px] from global;
50
+ composes: text-base from global;
50
51
  composes: lg_m-0 from global;
51
52
  composes: lg_text-left from global;
52
53
  composes: py-4 from global;
@@ -25,6 +25,7 @@ import NoProductsFound from './NoProductsFound';
25
25
  import cn from 'classnames';
26
26
  import ProductListTab, { ProductListTabShimmer } from '@riosst100/pwa-marketplace/src/components/ProductListTab';
27
27
  import SubCategory from '@riosst100/pwa-marketplace/src/components/SubCategory/subCategory';
28
+ import AttributesBlock from '@riosst100/pwa-marketplace/src/components/AttributesBlock/attributesBlock';
28
29
 
29
30
  const FilterModal = React.lazy(() => import('@magento/venia-ui/lib/components/FilterModal'));
30
31
  const FilterSidebar = React.lazy(() =>
@@ -56,7 +57,9 @@ const CategoryContent = props => {
56
57
  items,
57
58
  children,
58
59
  totalCount,
59
- totalPagesFromData
60
+ totalPagesFromData,
61
+ attributesBlock,
62
+ category
60
63
  } = talonProps;
61
64
 
62
65
  const sidebarRef = useRef(null);
@@ -179,6 +182,7 @@ const CategoryContent = props => {
179
182
  {categoryDescriptionElement}
180
183
  </div>
181
184
  <SubCategory children={children} />
185
+ <AttributesBlock category={category} attributesBlock={attributesBlock} />
182
186
  <div className={classes.contentWrapper}>
183
187
  <div ref={sidebarRef} className={classes.sidebar}>
184
188
  <Suspense fallback={<FilterSidebarShimmer />}>
@@ -9,24 +9,24 @@
9
9
  }
10
10
 
11
11
  .text {
12
- composes: text-[13px] from global;
12
+ composes: text-base from global;
13
13
  composes: leading-[13px] from global;
14
14
  composes: text-blue-700 from global;
15
15
  composes: font-medium from global;
16
16
  }
17
17
 
18
18
  .divider {
19
- composes: text-[13px] from global;
19
+ composes: text-base from global;
20
20
  composes: leading-[13px] from global;
21
21
  }
22
22
 
23
23
  .link {
24
- composes: text-[13px] from global;
24
+ composes: text-base from global;
25
25
  composes: leading-[13px] from global;
26
26
  composes: text-gray-200 from global;
27
27
  }
28
28
 
29
29
  .currentCategory {
30
- composes: text-[13px] from global;
30
+ composes: text-base from global;
31
31
  composes: leading-[13px] from global;
32
32
  }
@@ -44,7 +44,7 @@
44
44
  composes: justify-self-start from global;
45
45
  composes: text-colorDefault from global;
46
46
  grid-area: label;
47
- composes: text-[13px] from global;
47
+ composes: text-base from global;
48
48
  }
49
49
 
50
50
  /* When the input is disabled, update the cursor on the sibling label element. */
@@ -11,7 +11,7 @@
11
11
  composes: py-2 from global;
12
12
  composes: rounded-md from global;
13
13
  /* composes: text-white from global; */
14
- composes: text-[13px] from global;
14
+ composes: text-base from global;
15
15
  }
16
16
 
17
17
  /* TODO @TW: cannot compose */
@@ -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;
@@ -13,7 +13,7 @@
13
13
  }
14
14
 
15
15
  .showMoreLessButton {
16
- composes: text-sm from global;
16
+ composes: text-base from global;
17
17
  composes: underline from global;
18
18
 
19
19
  composes: hover_no-underline from global;
@@ -13,7 +13,7 @@
13
13
  .name {
14
14
  composes: leading-[14px] from global;
15
15
  composes: text-left from global;
16
- composes: text-[14px] from global;
16
+ composes: text-base from global;
17
17
  composes: font-semibold from global;
18
18
  }
19
19
 
@@ -67,7 +67,7 @@
67
67
 
68
68
  /* TODO @TW: cannot compose */
69
69
  .action button {
70
- /* composes: text-sm from global; */
70
+ /* composes: text-base from global; */
71
71
  font-size: 0.875rem;
72
72
  /* composes: no-underline from global; */
73
73
  text-decoration: none;
@@ -30,7 +30,7 @@
30
30
  composes: flex from global;
31
31
  composes: items-center from global;
32
32
  composes: leading-normal from global;
33
- composes: text-[16px] from global;
33
+ composes: text-[14px] from global;
34
34
  composes: font-semibold from global;
35
35
  composes: px-2.5 from global;
36
36
  composes: mb-2.5 from global;
@@ -43,8 +43,9 @@
43
43
 
44
44
  /* TODO @TW: cannot compose */
45
45
  .action button {
46
- /* composes: text-sm from global; */
47
- font-size: 13px;
46
+ /* composes: text-base from global; */
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;
@@ -73,7 +73,7 @@
73
73
 
74
74
  .name {
75
75
  composes: font-medium from global;
76
- composes: text-[14px] from global;
76
+ composes: text-base from global;
77
77
  composes: mb-[18px] from global;
78
78
  display: -webkit-box;
79
79
  -webkit-line-clamp: 2;
@@ -85,7 +85,7 @@
85
85
  .name,
86
86
  .price {
87
87
  composes: text-colorDefault from global;
88
- composes: text-[16px] from global;
88
+ composes: text-[14px] from global;
89
89
  composes: font-semibold from global;
90
90
  min-height: 1rem;
91
91
  }
@@ -103,7 +103,7 @@
103
103
  composes: items-center from global;
104
104
  composes: justify-start from global;
105
105
  composes: p-3 from global;
106
- composes: text-sm from global;
106
+ composes: text-base from global;
107
107
  composes: text-subtle from global;
108
108
  composes: w-full from global;
109
109
  }
@@ -3,7 +3,7 @@ import React from 'react'
3
3
  export const star = () => {
4
4
  return (
5
5
  <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
6
- <path d="M8.00887 2.04754L9.03554 4.10087C9.17554 4.38671 9.54887 4.66087 9.86387 4.71337L11.7247 5.02254C12.9147 5.22087 13.1947 6.08421 12.3372 6.93587L10.8905 8.38254C10.6455 8.62754 10.5114 9.10004 10.5872 9.43837L11.0014 11.2292C11.328 12.6467 10.5755 13.195 9.32137 12.4542L7.5772 11.4217C7.2622 11.235 6.74304 11.235 6.4222 11.4217L4.67804 12.4542C3.4297 13.195 2.67137 12.6409 2.99804 11.2292L3.4122 9.43837C3.48804 9.10004 3.35387 8.62754 3.10887 8.38254L1.6622 6.93587C0.810536 6.08421 1.0847 5.22087 2.2747 5.02254L4.13554 4.71337C4.4447 4.66087 4.81804 4.38671 4.95804 4.10087L5.9847 2.04754C6.5447 0.933372 7.4547 0.933372 8.00887 2.04754Z" fill="#F7C317" stroke="#F7C317" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
6
+ <path d="M8.00887 2.04754L9.03554 4.10087C9.17554 4.38671 9.54887 4.66087 9.86387 4.71337L11.7247 5.02254C12.9147 5.22087 13.1947 6.08421 12.3372 6.93587L10.8905 8.38254C10.6455 8.62754 10.5114 9.10004 10.5872 9.43837L11.0014 11.2292C11.328 12.6467 10.5755 13.195 9.32137 12.4542L7.5772 11.4217C7.2622 11.235 6.74304 11.235 6.4222 11.4217L4.67804 12.4542C3.4297 13.195 2.67137 12.6409 2.99804 11.2292L3.4122 9.43837C3.48804 9.10004 3.35387 8.62754 3.10887 8.38254L1.6622 6.93587C0.810536 6.08421 1.0847 5.22087 2.2747 5.02254L4.13554 4.71337C4.4447 4.66087 4.81804 4.38671 4.95804 4.10087L5.9847 2.04754C6.5447 0.933372 7.4547 0.933372 8.00887 2.04754Z" fill="#F7C317" stroke="#F7C317" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
7
7
  </svg>
8
8
 
9
9
  )
@@ -66,8 +66,8 @@ const AccountTrigger = props => {
66
66
  })}
67
67
  shouldIndicateLoading={true}
68
68
  /> */}
69
- <User size="30" color={darkBlue} className={cn('stroke-0')} variant="Outline" />
70
- <span className='text-sm text-darkblue-900 font-semibold'>
69
+ <User size="25" color={darkBlue} className={cn('stroke-0')} variant="Outline" />
70
+ <span className='text-base font-semibold'>
71
71
  {formatMessage({
72
72
  id: 'accountTrigger.buttonFallback',
73
73
  defaultMessage: 'Sign In'
@@ -7,7 +7,7 @@ import { useCartTrigger } from '@magento/peregrine/lib/talons/Header/useCartTrig
7
7
 
8
8
  import { useStyle } from '@magento/venia-ui/lib/classify';
9
9
  import Icon from '@magento/venia-ui/lib/components/Icon';
10
- import defaultClasses from '@magento/venia-ui/lib/components/Header/cartTrigger.module.css';
10
+ import defaultClasses from './cartTrigger.module.css';
11
11
  import { GET_ITEM_COUNT_QUERY } from '@magento/venia-ui/lib/components/Header/cartTrigger.gql';
12
12
  import cn from 'classnames';
13
13
  import { ShoppingCart } from 'iconsax-react';
@@ -50,7 +50,7 @@ const CartTrigger = props => {
50
50
  <span
51
51
  className={cn(
52
52
  classes.counter,
53
- 'bg-yellow-300 min-w-[18px] min-h-[18px] text-[13px] font-regular leading-[18px] text-darkblue-900 top-[-5px]',
53
+ 'bg-yellow-300 min-w-[18px] min-h-[18px] text-base font-regular leading-[18px] top-[-5px]',
54
54
  '!left-auto right-[0px]'
55
55
  )}
56
56
  data-cy="CartTrigger-counter"
@@ -76,7 +76,7 @@ const CartTrigger = props => {
76
76
  data-cy="CartTrigger-trigger"
77
77
  >
78
78
  {/* <Icon src={ShoppingCartIcon} /> */}
79
- <ShoppingCart size="30" color={darkBlue} className={cn('stroke-0')} variant="Outline" />
79
+ <ShoppingCart size="25" color={darkBlue} className={cn('stroke-0')} variant="Outline" />
80
80
  {maybeItemCounter}
81
81
  </button>
82
82
  </div>
@@ -0,0 +1,47 @@
1
+ .counter {
2
+ composes: absolute from global;
3
+ composes: bg-brand-dark from global;
4
+ composes: font-semibold from global;
5
+ composes: leading-tight from global;
6
+ composes: left-sm from global;
7
+ composes: min-w-[1.25rem] from global;
8
+ composes: px-1 from global;
9
+ composes: py-0 from global;
10
+ composes: rounded-full from global;
11
+ composes: text-white from global;
12
+ composes: top-1.5 from global;
13
+ }
14
+
15
+ .trigger {
16
+ composes: root from '@magento/venia-ui/lib/components/clickable.module.css';
17
+
18
+ composes: content-center from global;
19
+ composes: flex from global;
20
+ composes: h-[3rem] from global;
21
+ composes: justify-center from global;
22
+ composes: min-w-[3rem] from global;
23
+ composes: relative from global;
24
+ composes: z-foreground from global;
25
+ }
26
+
27
+ .triggerContainer {
28
+ composes: hidden from global;
29
+ composes: items-center from global;
30
+ composes: h-lg from global;
31
+
32
+ composes: lg_grid from global;
33
+ }
34
+
35
+ .triggerContainer_open {
36
+ composes: triggerContainer;
37
+
38
+ composes: shadow-headerTrigger from global;
39
+ }
40
+
41
+ .link {
42
+ composes: trigger;
43
+
44
+ composes: flex from global;
45
+
46
+ composes: lg_hidden from global;
47
+ }
@@ -81,7 +81,7 @@ const Header = props => {
81
81
  className={''}
82
82
  data-cy="Header-logoContainer"
83
83
  >
84
- <div><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>
@@ -106,7 +106,7 @@ const Header = props => {
106
106
  <MegaMenu
107
107
  rootClassName={cn('nav-menu w-full max-w-[1210px] px-[15px] mx-[auto] flex-row gap-x-[40px]')}
108
108
  megaMenuItemClassname={cn('px-0 py-[15px] leading-[20px]')}
109
- titleClassName={cn('font-medium leading-[20px] text-darkblue-900')}
109
+ titleClassName={cn('font-medium leading-[20px]')}
110
110
  />
111
111
  </header>
112
112
  <OnlineIndicator
@@ -62,7 +62,7 @@ const StoreSwitcher = props => {
62
62
  groups.push(
63
63
  <ul
64
64
  role="listbox"
65
- className={cn(classes.groupList, 'text-[13px]')}
65
+ className={cn(classes.groupList, 'text-base')}
66
66
  key={key}
67
67
  data-cy="StoreSwitcher-group"
68
68
  >
@@ -75,13 +75,13 @@ const StoreSwitcher = props => {
75
75
  <div className={cn(classes.root, 'leading-[16px]')} data-cy="StoreSwitcher-root">
76
76
  <button
77
77
  data-cy="StoreSwitcher-triggerButton"
78
- className={cn(classes.trigger, 'text-[13px]')}
78
+ className={cn(classes.trigger, 'text-base')}
79
79
  aria-label={currentStoreName || ''}
80
80
  onClick={handleTriggerClick}
81
81
  ref={storeMenuTriggerRef}
82
82
  aria-expanded={storeMenuIsOpen}
83
83
  >
84
- <span className='flex flex-row gap-[5px] items-center leading-[16px] text-darkblue-900'>
84
+ <span className='flex flex-row gap-[5px] items-center leading-[16px]'>
85
85
  {currentStoreName || ''}
86
86
  {!hasOnlyOneStore ? (
87
87
  <ArrowUp2 size="12" color={darkBlue} className={cn(storeMenuIsOpen ? 'rotate-0 ' : 'rotate-180', 'transition-all stroke-current')} variant="Outline" />
@@ -93,8 +93,8 @@ const StoreSwitcher = props => {
93
93
  className={menuClassName}
94
94
  data-cy="StoreSwitcher-menu"
95
95
  >
96
- <div className={cn(classes.groups, 'text-darkblue-900')}>
97
- <span className='flex font-medium px-4 py-1 w-full text-[14px]'>
96
+ <div className={classes.groups}>
97
+ <span className='flex font-medium px-4 py-1 w-full text-base'>
98
98
  Language
99
99
  </span>
100
100
  {groups}
@@ -14,7 +14,7 @@ const wishlistTrigger = () => {
14
14
  className={''}
15
15
  data-cy="wishlistLink"
16
16
  >
17
- <Heart size="30" color={darkBlue} className={cn('stroke-0')} variant="Outline" />
17
+ <Heart size="25" color={darkBlue} className={cn('stroke-0')} variant="Outline" />
18
18
  </Link>
19
19
  </div>
20
20
  )
@@ -67,6 +67,7 @@ const MegaMenuItem = props => {
67
67
  isFocused={isFocused}
68
68
  subMenuState={subMenuState}
69
69
  items={category.children}
70
+ parentCategory={category}
70
71
  shopByItems={category.shop_by}
71
72
  mainNavWidth={mainNavWidth}
72
73
  handleCloseSubMenu={handleCloseSubMenu}
@@ -1,28 +1,40 @@
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';
5
5
 
6
6
  import { useStyle } from '@magento/venia-ui/lib/classify';
7
- import defaultClasses from './shopByColumn.module.css';
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
- shopBy
17
+ shopBy,
18
+ category,
19
+ categoryUrlSuffix,
20
+ handleCloseSubMenu,
21
+ onNavigate
15
22
  } = props;
16
23
 
17
- // const categoryUrl = resourceUrl(
18
- // `/${category.url_path}${categoryUrlSuffix || ''}`
19
- // );
24
+ const { url_path } = category;
25
+
20
26
  let items = null;
21
27
 
28
+ const itemCountToShow = 4;
29
+
22
30
  if (shopBy.items.length) {
23
31
  const childrenItems = shopBy.items.map((shopByItem, index) => {
24
- // const { url_path, isActive, name } = shopByItem;
25
- const { name } = shopByItem;
32
+
33
+ if (index >= itemCountToShow) {
34
+ return null;
35
+ }
36
+
37
+ const { name, option_id } = shopByItem;
26
38
  // const categoryUrl = resourceUrl(
27
39
  // `/${url_path}${categoryUrlSuffix || ''}`
28
40
  // );
@@ -33,6 +45,10 @@ const ShopByColumn = props => {
33
45
  ? props.keyboardProps
34
46
  : {};
35
47
 
48
+ const categoryUrl = resourceUrl(
49
+ `/${url_path}${categoryUrlSuffix || ''}?${shopBy.code}[filter]=${name},${option_id}`
50
+ );
51
+
36
52
  return (
37
53
  <li key={index} className={classes.submenuChildItem}>
38
54
  <Link
@@ -40,8 +56,11 @@ const ShopByColumn = props => {
40
56
  // className={isActive ? classes.linkActive : classes.link}
41
57
  className={classes.link}
42
58
  data-cy="MegaMenu-ShopByColumn-link"
43
- // to={categoryUrl}
44
- // onClick={onNavigate}
59
+ to={categoryUrl}
60
+ onClick={() => {
61
+ handleCloseSubMenu();
62
+ onNavigate();
63
+ }}
45
64
  >
46
65
  {name}
47
66
  </Link>
@@ -52,22 +71,48 @@ const ShopByColumn = props => {
52
71
  items = <ul className={classes.submenuChild}>{childrenItems}</ul>;
53
72
  }
54
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
+
55
109
  return (
56
- <div className={classes.ShopByColumn}>
57
- {/* <Link
58
- {...keyboardProps}
59
- className={classes.link}
60
- data-cy="MegaMenu-ShopByColumn-link"
61
- to={categoryUrl}
62
- onClick={() => {
63
- handleCloseSubMenu();
64
- onNavigate();
65
- }}
66
- >
67
- <span className={classes.heading}>{category.name}</span>
68
- </Link> */}
69
- <span className={classes.heading}>{shopBy.name}</span>
70
- {items}
110
+ <div className={classes.submenuItems}>
111
+ <div className={classes.submenuColumn}>
112
+ <span className={classes.heading}>{shopBy.name}</span>
113
+ {items}
114
+ {viewAll}
115
+ </div>
71
116
  </div>
72
117
  );
73
118
  };
@@ -1,4 +1,4 @@
1
- .shopByColumn {
1
+ .submenuColumn {
2
2
  composes: max-w-[235px] from global;
3
3
  composes: p-5 from global;
4
4
  }
@@ -9,9 +9,7 @@
9
9
 
10
10
  .link {
11
11
  composes: whitespace-nowrap from global;
12
-
13
12
  composes: focus_underline from global;
14
-
15
13
  composes: hover_underline from global;
16
14
  }
17
15
 
@@ -20,7 +18,7 @@
20
18
  }
21
19
 
22
20
  .submenuChild {
23
- composes: mt-5 from global;
21
+ composes: mt-0 from global;
24
22
  }
25
23
 
26
24
  .submenuChildItem {
@@ -24,6 +24,7 @@ const Submenu = props => {
24
24
  subMenuState,
25
25
  handleCloseSubMenu,
26
26
  categoryUrlSuffix,
27
+ parentCategory,
27
28
  onNavigate
28
29
  } = props;
29
30
  const PADDING_OFFSET = 20;
@@ -76,9 +77,10 @@ const Submenu = props => {
76
77
  <ShopByColumn
77
78
  index={index}
78
79
  keyboardProps={keyboardProps}
79
- // key={category.uid}
80
+ key={shopBy.code}
81
+ category={parentCategory}
80
82
  shopBy={shopBy}
81
- // categoryUrlSuffix={categoryUrlSuffix}
83
+ categoryUrlSuffix={categoryUrlSuffix}
82
84
  onNavigate={onNavigate}
83
85
  handleCloseSubMenu={handleCloseSubMenu}
84
86
  />
@@ -87,11 +89,12 @@ const Submenu = props => {
87
89
 
88
90
  return (
89
91
  <div className={subMenuClassname}>
90
- <div
91
- className={classes.submenuItems}
92
- style={{ minWidth: mainNavWidth + PADDING_OFFSET }}
93
- >
94
- {subMenus}
92
+ <div className={classes.submenuContainer}>
93
+ <div
94
+ className={classes.submenuItems}
95
+ >
96
+ {subMenus}
97
+ </div>
95
98
  {shopBy}
96
99
  </div>
97
100
  </div>
@@ -1,16 +1,24 @@
1
1
  .submenu {
2
2
  composes: absolute from global;
3
3
  composes: bg-white from global;
4
- composes: flex-wrap from global;
5
- composes: justify-between from global;
6
4
  composes: left-0 from global;
7
5
  composes: px-3 from global;
8
6
  composes: py-5 from global;
9
7
  composes: right-0 from global;
10
- top: 133px;
8
+ top: 130px;
11
9
  box-shadow: 0 3px rgb(var(--venia-global-color-gray-100));
12
10
  }
13
11
 
12
+ .submenuContainer {
13
+ composes: w-full from global;
14
+ composes: max-w-[1210px] from global;
15
+ composes: flex-wrap from global;
16
+ composes: justify-start from global;
17
+ composes: mx-[auto] from global;
18
+ composes: flex from global;
19
+ composes: gap-[15px] from global;
20
+ }
21
+
14
22
  /* TODO @TW: cannot compose */
15
23
  .submenu::before {
16
24
  box-shadow: inset 0 2px rgb(var(--venia-global-color-gray-100));
@@ -30,14 +38,13 @@
30
38
 
31
39
  .submenu_active {
32
40
  composes: submenu;
33
- composes: flex from global;
34
41
  }
35
42
 
36
43
  .submenuItems {
37
44
  composes: flex from global;
38
45
  composes: flex-wrap from global;
39
- composes: justify-between from global;
40
- composes: ml-auto from global;
41
- composes: mr-auto from global;
46
+ /* composes: justify-between from global; */
47
+ /* composes: ml-auto from global; */
48
+ /* composes: mr-auto from global; */
42
49
  composes: flex-col from global;
43
50
  }
@@ -48,7 +48,10 @@ const SubmenuColumn = props => {
48
48
  className={isActive ? classes.linkActive : classes.link}
49
49
  data-cy="MegaMenu-SubmenuColumn-link"
50
50
  to={categoryUrl}
51
- onClick={onNavigate}
51
+ onClick={() => {
52
+ handleCloseSubMenu();
53
+ onNavigate();
54
+ }}
52
55
  >
53
56
  {name}
54
57
  </Link>