@riosst100/pwa-marketplace 1.2.3 → 1.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.
Files changed (74) hide show
  1. package/package.json +1 -1
  2. package/src/componentOverrideMapping.js +2 -1
  3. package/src/components/Filter/index.js +7 -7
  4. package/src/components/OperatingHours/index.js +1 -0
  5. package/src/components/OperatingHours/operatingHours.js +32 -0
  6. package/src/components/Pagination/index.js +26 -17
  7. package/src/components/Search/index.js +1 -1
  8. package/src/components/Seller/index.js +1 -0
  9. package/src/components/Seller/seller.js +250 -0
  10. package/src/components/Seller/sellerAddressCard.js +48 -0
  11. package/src/components/SellerDetail/index.js +1 -0
  12. package/src/components/SellerDetail/sellerDetail.js +158 -0
  13. package/src/components/SellerInformation/sellerInformation.js +54 -44
  14. package/src/components/SellerLocation/sellerLocation.js +6 -2
  15. package/src/components/SellerLocation/sellerLocationItem.js +6 -8
  16. package/src/components/SellerPage/sellerPage.js +2 -112
  17. package/src/components/SellerProducts/sellerProducts.js +33 -12
  18. package/src/components/SellerReview/sellerReview.js +29 -29
  19. package/src/components/SellerReviewItem/sellerReviewItem.js +8 -8
  20. package/src/components/SortBy/index.js +13 -5
  21. package/src/components/commons/Slider/index.js +2 -2
  22. package/src/components/commons/Tabs/index.js +11 -9
  23. package/src/overwrites/venia-ui/lib/components/Header/header.js +46 -34
  24. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/MegaMenu.spec.js +91 -0
  25. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/MegaMenuItem.spec.js +123 -0
  26. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/Submenu.spec.js +61 -0
  27. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/SubmenuColumn.spec.js +50 -0
  28. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/__snapshots__/MegaMenu.spec.js.snap +114 -0
  29. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/__snapshots__/MegaMenuItem.spec.js.snap +71 -0
  30. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/__snapshots__/Submenu.spec.js.snap +59 -0
  31. package/src/overwrites/venia-ui/lib/components/MegaMenu/__tests__/__snapshots__/SubmenuColumn.spec.js.snap +34 -0
  32. package/src/overwrites/venia-ui/lib/components/MegaMenu/index.js +1 -0
  33. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenu.js +90 -0
  34. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenu.module.css +12 -0
  35. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.js +156 -0
  36. package/src/overwrites/venia-ui/lib/components/MegaMenu/megaMenuItem.module.css +31 -0
  37. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.js +89 -0
  38. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenu.module.css +43 -0
  39. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.js +99 -0
  40. package/src/overwrites/venia-ui/lib/components/MegaMenu/submenuColumn.module.css +28 -0
  41. package/src/overwrites/venia-ui/lib/components/SearchBar/__stories__/searchBar.js +11 -0
  42. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/searchField.spec.js.snap +72 -0
  43. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/suggestedCategories.spec.js.snap +30 -0
  44. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/suggestedProduct.spec.js.snap +69 -0
  45. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/suggestedProducts.spec.js.snap +7 -0
  46. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/__snapshots__/suggestions.spec.js.snap +12 -0
  47. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/autocomplete.spec.js +52 -0
  48. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/searchBar.spec.js +82 -0
  49. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/searchField.spec.js +87 -0
  50. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/suggestedCategories.spec.js +45 -0
  51. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/suggestedProduct.spec.js +43 -0
  52. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/suggestedProducts.spec.js +45 -0
  53. package/src/overwrites/venia-ui/lib/components/SearchBar/__tests__/suggestions.spec.js +110 -0
  54. package/src/overwrites/venia-ui/lib/components/SearchBar/autocomplete.js +172 -0
  55. package/src/overwrites/venia-ui/lib/components/SearchBar/autocomplete.module.css +62 -0
  56. package/src/overwrites/venia-ui/lib/components/SearchBar/index.js +1 -0
  57. package/src/overwrites/venia-ui/lib/components/SearchBar/searchBar.js +74 -0
  58. package/src/overwrites/venia-ui/lib/components/SearchBar/searchBar.module.css +50 -0
  59. package/src/overwrites/venia-ui/lib/components/SearchBar/searchField.js +40 -0
  60. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedCategories.js +48 -0
  61. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedCategories.module.css +13 -0
  62. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedCategory.js +49 -0
  63. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedCategory.module.css +0 -0
  64. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedProduct.js +97 -0
  65. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedProduct.module.css +24 -0
  66. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedProducts.js +43 -0
  67. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestedProducts.module.css +13 -0
  68. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestions.js +75 -0
  69. package/src/overwrites/venia-ui/lib/components/SearchBar/suggestions.module.css +6 -0
  70. package/src/talons/Seller/seller.gql.js +204 -0
  71. package/src/talons/Seller/useSeller.js +71 -0
  72. package/src/talons/SellerProducts/useSellerProducts.js +129 -0
  73. package/src/theme/vars.js +7 -0
  74. package/src/util/mapSeller.js +7 -0
@@ -6,8 +6,8 @@ import { Star1 } from 'iconsax-react';
6
6
  const SellerReview = () => {
7
7
  return (
8
8
  <>
9
- <div className='w-full flex items-start gap-[30px] '>
10
- <div className="w-full max-w-[300px] px-[25px] py-10 rounded-md border border-gray-200 flex-col justify-start items-start gap-[25px] inline-flex">
9
+ <div className='w-full flex items-start xs_flex-col lg_flex-row gap-[30px] '>
10
+ <div className="w-full xs_max-w-full lg_max-w-[300px] px-[25px] py-10 rounded-md border border-gray-200 flex-col justify-start items-start gap-[25px] inline-flex">
11
11
  <div className="justify-start items-end gap-[15px] inline-flex">
12
12
  <div className="text-center text-zinc-900 text-[40px] font-semibold leading-10">4.7</div>
13
13
  <div className="flex-col justify-start items-start gap-[9px] inline-flex">
@@ -31,94 +31,94 @@ const SellerReview = () => {
31
31
  <div className="text-center text-zinc-900 text-sm font-normal leading-[18px]">(26 Reviews)</div>
32
32
  </div>
33
33
  </div>
34
- <div className="flex-col items-start gap-2 flex">
35
- <div className="flex gap-3 items-center">
36
- <div className="gap-2.5 flex items-center">
34
+ <div className="w-full flex-col items-start gap-2 flex">
35
+ <div className="flex xs_w-full lg_w-fit gap-3 items-center">
36
+ <div className="gap-2.5 flex items-center xs_w-full lg_w-fit">
37
37
  <div className="gap-[5px] flex items-center">
38
38
  <div className="w-3.5 h-3.5 relative">
39
39
  <Star1 color='#F7C317' size={14} className='fill-[#F7C317]' />
40
40
  </div>
41
41
  <div className="gap-2.5 flex">
42
- <div className="text-center text-zinc-900 text-sm font-normal font-['Noto Sans'] leading-[18px]">5</div>
42
+ <div className="text-center text-zinc-900 text-sm font-normal leading-[18px]">5</div>
43
43
  </div>
44
44
  </div>
45
- <div className="w-40 h-[6px] relative">
45
+ <div className="xs_w-full lg_w-40 h-[6px] relative">
46
46
  <div className="w-full h-[6px] absolute bg-[#E4EBF5] rounded" />
47
47
  <div className="w-full h-[6px] absolute bg-[#4E31DB] rounded" />
48
48
  </div>
49
49
  </div>
50
- <div className="w-10 text-zinc-900 text-sm font-normal font-['Noto Sans'] leading-[18px]">12</div>
50
+ <div className="w-10 text-zinc-900 text-sm font-normal leading-[18px]">12</div>
51
51
  </div>
52
- <div className="flex gap-3 items-center">
53
- <div className="gap-2.5 flex items-center">
52
+ <div className="flex xs_w-full lg_w-fit gap-3 items-center">
53
+ <div className="gap-2.5 flex items-center xs_w-full lg_w-fit">
54
54
  <div className="gap-[5px] flex items-center">
55
55
  <div className="w-3.5 h-3.5 relative">
56
56
  <Star1 color='#F7C317' size={14} className='fill-[#F7C317]' />
57
57
  </div>
58
58
  <div className="gap-2.5 flex">
59
- <div className="text-center text-zinc-900 text-sm font-normal font-['Noto Sans'] leading-[18px]">4</div>
59
+ <div className="text-center text-zinc-900 text-sm font-normal leading-[18px]">4</div>
60
60
  </div>
61
61
  </div>
62
- <div className="w-40 h-[6px] relative">
62
+ <div className="xs_w-full lg_w-40 h-[6px] relative">
63
63
  <div className="w-full h-[6px] absolute bg-[#E4EBF5] rounded" />
64
64
  <div className="w-[80%] h-[6px] absolute bg-[#4E31DB] rounded" />
65
65
  </div>
66
66
  </div>
67
- <div className="w-10 text-zinc-900 text-sm font-normal font-['Noto Sans'] leading-[18px]">8</div>
67
+ <div className="w-10 text-zinc-900 text-sm font-normal leading-[18px]">8</div>
68
68
  </div>
69
- <div className="flex gap-3 items-center">
70
- <div className="gap-2.5 flex items-center">
69
+ <div className="flex xs_w-full lg_w-fit gap-3 items-center">
70
+ <div className="gap-2.5 flex items-center xs_w-full lg_w-fit">
71
71
  <div className="gap-[5px] flex items-center">
72
72
  <div className="w-3.5 h-3.5 relative">
73
73
  <Star1 color='#F7C317' size={14} className='fill-[#F7C317]' />
74
74
  </div>
75
75
  <div className="gap-2.5 flex">
76
- <div className="text-center text-zinc-900 text-sm font-normal font-['Noto Sans'] leading-[18px]">3</div>
76
+ <div className="text-center text-zinc-900 text-sm font-normal leading-[18px]">3</div>
77
77
  </div>
78
78
  </div>
79
- <div className="w-40 h-[6px] relative">
79
+ <div className="xs_w-full lg_w-40 h-[6px] relative">
80
80
  <div className="w-full h-[6px] absolute bg-[#E4EBF5] rounded" />
81
81
  <div className="w-[45%] h-[6px] absolute bg-[#4E31DB] rounded" />
82
82
  </div>
83
83
  </div>
84
- <div className="w-10 text-zinc-900 text-sm font-normal font-['Noto Sans'] leading-[18px]">5</div>
84
+ <div className="w-10 text-zinc-900 text-sm font-normal leading-[18px]">5</div>
85
85
  </div>
86
- <div className="flex gap-3 items-center">
87
- <div className="gap-2.5 flex items-center">
86
+ <div className="flex xs_w-full lg_w-fit gap-3 items-center">
87
+ <div className="gap-2.5 flex items-center xs_w-full lg_w-fit">
88
88
  <div className="gap-[5px] flex items-center">
89
89
  <div className="w-3.5 h-3.5 relative">
90
90
  <Star1 color='#F7C317' size={14} className='fill-[#F7C317]' />
91
91
  </div>
92
92
  <div className="gap-2.5 flex">
93
- <div className="text-center text-zinc-900 text-sm font-normal font-['Noto Sans'] leading-[18px]">2</div>
93
+ <div className="text-center text-zinc-900 text-sm font-normal leading-[18px]">2</div>
94
94
  </div>
95
95
  </div>
96
- <div className="w-40 h-[6px] relative">
96
+ <div className="xs_w-full lg_w-40 h-[6px] relative">
97
97
  <div className="w-full h-[6px] absolute bg-[#E4EBF5] rounded" />
98
98
  <div className="w-[1%] h-[6px] absolute bg-[#4E31DB] rounded" />
99
99
  </div>
100
100
  </div>
101
- <div className="w-10 text-zinc-900 text-sm font-normal font-['Noto Sans'] leading-[18px]">1</div>
101
+ <div className="w-10 text-zinc-900 text-sm font-normal leading-[18px]">1</div>
102
102
  </div>
103
- <div className="flex gap-3 items-center">
104
- <div className="gap-2.5 flex items-center">
103
+ <div className="flex xs_w-full lg_w-fit gap-3 items-center">
104
+ <div className="gap-2.5 flex items-center xs_w-full lg_w-fit">
105
105
  <div className="gap-[5px] flex items-center">
106
106
  <div className="w-3.5 h-3.5 relative">
107
107
  <Star1 color='#F7C317' size={14} className='fill-[#F7C317]' />
108
108
  </div>
109
109
  <div className="gap-2.5 flex">
110
- <div className="text-center text-zinc-900 text-sm font-normal font-['Noto Sans'] leading-[18px]">1</div>
110
+ <div className="text-center text-zinc-900 text-sm font-normal leading-[18px]">1</div>
111
111
  </div>
112
112
  </div>
113
- <div className="w-40 h-[6px] relative">
113
+ <div className="xs_w-full lg_w-40 h-[6px] relative">
114
114
  <div className="w-full h-[6px] absolute bg-[#E4EBF5] rounded" />
115
115
  <div className="w-[0%] h-[6px] absolute bg-[#4E31DB] rounded" />
116
116
  </div>
117
117
  </div>
118
- <div className="w-10 text-zinc-900 text-sm font-normal font-['Noto Sans'] leading-[18px]">0</div>
118
+ <div className="w-10 text-zinc-900 text-sm font-normal leading-[18px]">0</div>
119
119
  </div>
120
120
  </div>
121
- <div className="self-stretch px-[30px] py-2.5 bg-white rounded-[30px] border border-indigo-600 justify-center items-center gap-2.5 inline-flex">
121
+ <div className="xs_self-end lg_self-stretch px-[30px] py-2.5 bg-white rounded-[30px] border border-indigo-600 justify-center items-center gap-2.5 inline-flex">
122
122
  <div className="text-indigo-600 text-base font-medium leading-tight">Write a review</div>
123
123
  </div>
124
124
  </div>
@@ -9,16 +9,16 @@ const SellerReviewItem = () => {
9
9
  <div class="inline-flex flex-col items-start gap-[10px] relative flex-[0_0_auto]">
10
10
  <div class="inline-flex items-center gap-[15px] relative flex-[0_0_auto]">
11
11
  <div class="flex w-[40px] h-[40px] items-center justify-around gap-[10px] p-[10px] relative bg-[#4e31db] rounded-[30px]">
12
- <div class="relative w-fit [font-family:'Noto_Sans',Helvetica] font-semibold text-white text-[16px] text-center tracking-[0] leading-[18px] whitespace-nowrap">JD</div>
12
+ <div class="relative w-fit font-semibold text-white text-[16px] text-center tracking-[0] leading-[18px] whitespace-nowrap">JD</div>
13
13
  </div>
14
14
  <div class="inline-flex flex-col items-start gap-[10px] relative flex-[0_0_auto]">
15
- <div class="relative w-fit mt-[-1.00px] [font-family:'Noto_Sans',Helvetica] font-medium text-[14px] text-center tracking-[0] leading-[18px] whitespace-nowrap">John Doe</div>
16
- <div class="relative w-fit [font-family:'Noto_Sans',Helvetica] font-medium text-[#999999] text-[12px] text-center tracking-[0] leading-[18px] whitespace-nowrap">18 January 2024</div>
15
+ <div class="relative w-fit mt-[-1.00px] font-medium text-[14px] text-center tracking-[0] leading-[18px] whitespace-nowrap">John Doe</div>
16
+ <div class="relative w-fit font-medium text-[#999999] text-[12px] text-center tracking-[0] leading-[18px] whitespace-nowrap">18 January 2024</div>
17
17
  </div>
18
18
  </div>
19
- <div class="inline-flex items-start gap-[20px] relative flex-[0_0_auto]">
19
+ <div class="flex xs_flex-col sm_flex-row items-start xs_gap-1 sm_gap-[20px] relative flex-[0_0_auto]">
20
20
  <div class="inline-flex items-center gap-[10px] relative flex-[0_0_auto]">
21
- <div class="relative w-fit [font-family:'Noto_Sans',Helvetica] font-normal text-[14px] tracking-[0] leading-[18px] whitespace-nowrap">Price</div>
21
+ <div class="relative w-fit font-normal text-[14px] tracking-[0] leading-[18px] whitespace-nowrap">Price</div>
22
22
  <div class="inline-flex items-start gap-[6px] relative flex-[0_0_auto]">
23
23
  <Star1 color='#F7C317' size={14} className='fill-[#F7C317]' />
24
24
  <Star1 color='#F7C317' size={14} className='fill-[#F7C317]' />
@@ -28,7 +28,7 @@ const SellerReviewItem = () => {
28
28
  </div>
29
29
  </div>
30
30
  <div class="inline-flex items-center gap-[10px] relative flex-[0_0_auto]">
31
- <div class="relative w-[37px] [font-family:'Noto_Sans',Helvetica] font-normal text-[14px] tracking-[0] leading-[18px]">Value</div>
31
+ <div class="relative w-[37px] font-normal text-[14px] tracking-[0] leading-[18px]">Value</div>
32
32
  <div class="inline-flex items-start gap-[6px] relative flex-[0_0_auto]">
33
33
  <Star1 color='#F7C317' size={14} className='fill-[#F7C317]' />
34
34
  <Star1 color='#F7C317' size={14} className='fill-[#F7C317]' />
@@ -38,7 +38,7 @@ const SellerReviewItem = () => {
38
38
  </div>
39
39
  </div>
40
40
  <div class="inline-flex items-center gap-[10px] relative flex-[0_0_auto]">
41
- <div class="relative w-fit [font-family:'Noto_Sans',Helvetica] font-normal text-[14px] tracking-[0] leading-[18px] whitespace-nowrap">Quality</div>
41
+ <div class="relative w-fit font-normal text-[14px] tracking-[0] leading-[18px] whitespace-nowrap">Quality</div>
42
42
  <div class="inline-flex items-start gap-[6px] relative flex-[0_0_auto]">
43
43
  <Star1 color='#F7C317' size={14} className='fill-[#F7C317]' />
44
44
  <Star1 color='#F7C317' size={14} className='fill-[#F7C317]' />
@@ -49,7 +49,7 @@ const SellerReviewItem = () => {
49
49
  </div>
50
50
  </div>
51
51
  </div>
52
- <p class="relative self-stretch [font-family:'Noto_Sans',Helvetica] font-normal text-[14px] tracking-[0] leading-[18px]">
52
+ <p class="relative self-stretch font-normal text-[14px] tracking-[0] leading-[18px]">
53
53
  Got item at a great price. Arrived way quicker than expected, extremely well packaged and exactly as described. Highly recommend the seller.
54
54
  </p>
55
55
  </div>
@@ -1,13 +1,21 @@
1
1
  import React from 'react';
2
- import { ArrowDown2 } from 'iconsax-react';
2
+ import { ArrowDown2, Filter } from 'iconsax-react';
3
3
 
4
4
  const Sort = () => {
5
5
  return (
6
6
  <>
7
- <div class="inline-flex flex-col items-start gap-[10px] px-[15px] py-[10px] relative flex-[0_0_auto] bg-white rounded-[30px] border border-solid border-[#e6e9ea]">
8
- <div class="inline-flex items-center gap-[20px] relative flex-[0_0_auto]">
9
- <div class="relative w-fit [font-family:'Frederik-Regular',Helvetica] font-normal text-[#1b1b1b] text-[14px] tracking-[0] leading-[normal] whitespace-nowrap">Most relevant</div>
10
- <ArrowDown2 color="#292D32" size={14} variant="Outline" className='stroke-[#292D32]' />
7
+ <div className='x-container xs_flex xs_justify-between xs_w-full xl_w-fit'>
8
+ <div class="xs_flex xl_hidden flex-col items-start gap-[10px] px-[15px] py-[10px] relative flex-[0_0_auto] bg-white rounded-[30px] border border-solid border-gray-100">
9
+ <div class="inline-flex items-center gap-[20px] relative flex-[0_0_auto]">
10
+ <Filter color="#292D32" size={14} variant="Outline" className='stroke-[#292D32]' />
11
+ <div class="relative w-fit text-[14px] tracking-[0] leading-[normal] whitespace-nowrap">Filter</div>
12
+ </div>
13
+ </div>
14
+ <div class="inline-flex flex-col items-start gap-[10px] px-[15px] py-[10px] relative flex-[0_0_auto] bg-white rounded-[30px] border border-solid border-gray-100">
15
+ <div class="inline-flex items-center gap-[20px] relative flex-[0_0_auto]">
16
+ <div class="relative w-fit text-[14px] tracking-[0] leading-[normal] whitespace-nowrap">Most relevant</div>
17
+ <ArrowDown2 color="#292D32" size={14} variant="Outline" className='stroke-[#292D32]' />
18
+ </div>
11
19
  </div>
12
20
  </div>
13
21
  </>
@@ -2,11 +2,11 @@ import React from 'react';
2
2
  import cx from 'classnames';
3
3
 
4
4
  const Slider = (props) => {
5
- const { rootClassname = '' } = props
5
+ const { rootClassname = '', seller } = props
6
6
  const rootClass = cx('slider-container', rootClassname)
7
7
  return (
8
8
  <div className={rootClass}>
9
- <img src="https://cdn.animaapp.com/projects/65c70e0e1dd7109c524e43af/releases/65c70e2bc3e635b310da0a17/img/rectangle-87.png" />
9
+ <img src={seller ? seller.image : ''} />
10
10
  </div>
11
11
  )
12
12
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import cx from 'classnames';
2
+ import cn from 'classnames';
3
3
 
4
4
  const Tabs = (props) => {
5
5
  const {
@@ -11,14 +11,16 @@ const Tabs = (props) => {
11
11
  tabContentContainerClassName = '',
12
12
  tabContentWrapperClassName = '',
13
13
  tabActiveClassName = '',
14
+ tabWrapperClassName = '',
14
15
  } = props
15
16
 
16
17
  const [activeTabs, setActiveTabs] = React.useState(0);
17
- const rootClass = cx('mb-4 border-b border-gray-200 dark:border-gray-700', rootClassName);
18
- const tabTitleClass = cx('inline-block p-4 rounded-t-lg', tabTitleClassName);
19
- const tabContainerClass = cx('tab-content-container', tabContentContainerClassName);
20
- const tabContentWrapperClass = cx('tab-content-wrapper', tabContentWrapperClassName);
21
- const tabActiveClass = cx('border-solid border-b-2', tabActiveClassName)
18
+ const rootClass = cn('mb-4 border-b border-gray-100', rootClassName);
19
+ const tabTitleClass = cn('inline-block p-[10px] rounded-t-lg text-[16px] font-semibold', tabTitleClassName);
20
+ const tabContainerClass = cn('tab-content-container', tabContentContainerClassName);
21
+ const tabContentWrapperClass = cn('tab-content-wrapper', tabContentWrapperClassName);
22
+ const tabActiveClass = cn('border-solid border-b-2', tabActiveClassName);
23
+ const tabWrapperClass = cn('flex flex-wrap -mb-px text-sm font-medium text-center gap-4', tabWrapperClassName);
22
24
 
23
25
  const handleSwicthTab = (index) => {
24
26
  setActiveTabs(index);
@@ -27,11 +29,11 @@ const Tabs = (props) => {
27
29
  return (
28
30
  <>
29
31
  <div className={rootClass}>
30
- <ul className='flex flex-wrap -mb-px text-sm font-medium text-center' role='tablist'>
32
+ <ul className={tabWrapperClass} role='tablist'>
31
33
  {data.map((item, index) => (
32
34
  <li className='me-2' role='presentation'>
33
35
  <button
34
- className={cx(tabTitleClass, index === activeTabs ? tabActiveClass : '')}
36
+ className={cn(tabTitleClass, index === activeTabs ? tabActiveClass : '')}
35
37
  id={item.id}
36
38
  role='tab'
37
39
  aria-controls={`${item.id}-tab`}
@@ -50,7 +52,7 @@ const Tabs = (props) => {
50
52
  {hasContent ? (
51
53
  <div className={tabContainerClass}>
52
54
  {data.map((item, index) => (
53
- <div className={cx(index !== activeTabs ? 'hidden' : '', tabContentWrapperClass)} role='tabpanel' aria-labelledby={`${item.id}-tab`}>
55
+ <div className={cn(index !== activeTabs ? 'hidden' : '', tabContentWrapperClass)} role='tabpanel' aria-labelledby={`${item.id}-tab`}>
54
56
  {item.content}
55
57
  </div>
56
58
  ))}
@@ -19,8 +19,9 @@ import BecomeSellerLink from '@riosst100/pwa-marketplace/src/components/BecomeSe
19
19
  import MegaMenu from '@magento/venia-ui/lib/components/MegaMenu';
20
20
  import PageLoadingIndicator from '@magento/venia-ui/lib/components/PageLoadingIndicator';
21
21
  import { useIntl } from 'react-intl';
22
-
23
- const SearchBar = React.lazy(() => import('@magento/venia-ui/lib/components/SearchBar'));
22
+ import cn from 'classnames';
23
+ // const SearchBar = React.lazy(() => import('@magento/venia-ui/lib/components/SearchBar'));
24
+ const SearchBar = React.lazy(() => import('@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/components/SearchBar'));
24
25
 
25
26
  const Header = props => {
26
27
  const {
@@ -45,19 +46,20 @@ const Header = props => {
45
46
  </div>
46
47
  </div>
47
48
  );
48
- const searchBar = isSearchOpen ? (
49
- <Suspense fallback={searchBarFallback}>
50
- <Route>
51
- <SearchBar isOpen={isSearchOpen} ref={searchRef} />
52
- </Route>
53
- </Suspense>
54
- ) : null;
49
+ // const searchBar = isSearchOpen ? (
50
+ // <Suspense fallback={searchBarFallback}>
51
+ // <Route>
52
+ // <SearchBar isOpen={true} ref={searchRef} />
53
+ // </Route>
54
+ // </Suspense>
55
+ // ) : null;
55
56
 
56
57
  const { formatMessage } = useIntl();
57
58
  const title = formatMessage({ id: 'logo.title', defaultMessage: 'Venia' });
58
59
 
59
60
  return (
60
61
  <Fragment>
62
+ <PageLoadingIndicator absolute />
61
63
  <div className={classes.switchersContainer}>
62
64
  <div className={classes.switchers} data-cy="Header-switchers">
63
65
  <BecomeSellerLink />
@@ -66,33 +68,43 @@ const Header = props => {
66
68
  <CurrencySwitcher />
67
69
  </div>
68
70
  </div>
69
- <header className={rootClass} data-cy="Header-root">
70
- <div className={classes.toolbar}>
71
- <div className={classes.primaryActions}>
72
- <NavTrigger />
73
- </div>
74
-
75
- <Link
76
- aria-label={title}
77
- to={resourceUrl('/')}
78
- className={classes.logoContainer}
79
- data-cy="Header-logoContainer"
80
- >
81
- <div><b>TCG Collective</b></div>
82
- <small>Toys | Card | Games</small>
83
- </Link>
84
- <MegaMenu />
85
- <div className={classes.secondaryActions}>
86
- <SearchTrigger
87
- onClick={handleSearchTriggerClick}
88
- ref={searchTriggerRef}
89
- />
90
- <AccountTrigger />
91
- <CartTrigger />
71
+ <header className={cn(rootClass, '!flex flex-col !px-0 border-gray-100 ')} data-cy="Header-root">
72
+ <div className={cn('middle-header border-b border-gray-100')}>
73
+ <div className={cn('w-full max-w-[1210px] px-[15px] py-[20px] mx-[auto] flex justify-between items-center')}>
74
+ <div className='flex'>
75
+ <NavTrigger />
76
+ <Link
77
+ aria-label={title}
78
+ to={resourceUrl('/')}
79
+ className={''}
80
+ data-cy="Header-logoContainer"
81
+ >
82
+ <div><b>TCG Collective</b></div>
83
+ <small>Toys | Card | Games</small>
84
+ </Link>
85
+ </div>
86
+ <div className='flex'>
87
+ <Suspense fallback={searchBarFallback}>
88
+ <Route>
89
+ <SearchBar isOpen={true} ref={searchRef} />
90
+ </Route>
91
+ </Suspense>
92
+ </div>
93
+ <div className={classes.secondaryActions}>
94
+ {/* <SearchTrigger
95
+ onClick={handleSearchTriggerClick}
96
+ ref={searchTriggerRef}
97
+ /> */}
98
+ <AccountTrigger />
99
+ <CartTrigger />
100
+ </div>
92
101
  </div>
93
102
  </div>
94
- {searchBar}
95
- <PageLoadingIndicator absolute />
103
+ <MegaMenu
104
+ rootClassName={cn('nav-menu w-full max-w-[1210px] px-[15px] mx-[auto] flex-row gap-x-[40px]')}
105
+ megaMenuItemClassname={cn('px-0 py-[15px] leading-[20px]')}
106
+ titleClassName={cn('font-medium leading-[20px]')}
107
+ />
96
108
  </header>
97
109
  <OnlineIndicator
98
110
  hasBeenOffline={hasBeenOffline}
@@ -0,0 +1,91 @@
1
+ import React from 'react';
2
+ import { MemoryRouter } from 'react-router-dom';
3
+
4
+ import { createTestInstance } from '@magento/peregrine';
5
+ import { useIsInViewport } from '@magento/peregrine/lib/hooks/useIsInViewport';
6
+
7
+ import MegaMenu from '../megaMenu';
8
+
9
+ jest.mock('@magento/venia-ui/lib/classify');
10
+ jest.mock('@magento/peregrine/lib/hooks/useIsInViewport');
11
+ jest.mock('@magento/peregrine/lib/talons/MegaMenu/useMegaMenu', () => ({
12
+ useMegaMenu: jest.fn().mockReturnValue({
13
+ megaMenuData: {
14
+ id: 1,
15
+ name: 'Clothing',
16
+ children: [
17
+ {
18
+ id: 2,
19
+ name: 'Women',
20
+ url_path: 'women',
21
+ children: [
22
+ {
23
+ id: 5,
24
+ name: 'Bottoms',
25
+ url_path: 'bottoms',
26
+ isActive: true,
27
+ children: []
28
+ }
29
+ ]
30
+ },
31
+ {
32
+ id: 3,
33
+ name: 'Men',
34
+ url_path: 'men',
35
+ children: []
36
+ },
37
+ {
38
+ id: 4,
39
+ name: 'Gear',
40
+ url_path: 'gear',
41
+ children: []
42
+ }
43
+ ]
44
+ },
45
+ activeCategoryId: 5,
46
+ categoryUrlSuffix: '.html',
47
+ useOutsideAlerter: () => {}
48
+ })
49
+ }));
50
+
51
+ describe('#MegaMenu', () => {
52
+ test('useEffect', () => {
53
+ const useEffect = jest.spyOn(React, 'useEffect');
54
+
55
+ const mockUseEffect = () => {
56
+ useEffect.mockImplementationOnce(mockFunction => mockFunction());
57
+ };
58
+
59
+ mockUseEffect();
60
+ });
61
+
62
+ test('not resetting the menu', () => {
63
+ const handleClickOutside = jest.fn();
64
+
65
+ expect(handleClickOutside).toHaveBeenCalledTimes(0);
66
+ });
67
+
68
+ it('renders empty div if not in viewport', () => {
69
+ useIsInViewport.mockReturnValue(false);
70
+
71
+ const instance = createTestInstance(
72
+ <MemoryRouter>
73
+ <MegaMenu />
74
+ </MemoryRouter>
75
+ );
76
+
77
+ expect(instance.toJSON()).toMatchSnapshot();
78
+ });
79
+
80
+ it('renders menu if in viewport', () => {
81
+ useIsInViewport.mockReturnValue(true);
82
+
83
+ const instance = createTestInstance(
84
+ <MemoryRouter>
85
+ <MegaMenu />
86
+ </MemoryRouter>
87
+ );
88
+
89
+ expect(instance.toJSON()).toMatchSnapshot();
90
+ });
91
+ });
@@ -0,0 +1,123 @@
1
+ import React from 'react';
2
+ import { Link } from 'react-router-dom';
3
+ import { act } from 'react-test-renderer';
4
+
5
+ import { createTestInstance } from '@magento/peregrine';
6
+
7
+ import MegaMenuItem from '../megaMenuItem';
8
+
9
+ jest.mock('../../../classify');
10
+ jest.mock('../../Icon', () => props => <mock-Icon {...props} />);
11
+ jest.mock('../submenu', () => props => <mock-Submenu {...props} />);
12
+ jest.mock('react', () => {
13
+ const React = jest.requireActual('react');
14
+ const memoSpy = jest.spyOn(React, 'useMemo');
15
+
16
+ return Object.assign(React, {
17
+ useMemo: memoSpy
18
+ });
19
+ });
20
+
21
+ const mockHandleKeyDown = jest.fn();
22
+
23
+ jest.mock('react-router-dom', () => ({
24
+ Link: jest.fn(() => props => <mock-Link {...props} />)
25
+ }));
26
+
27
+ jest.mock('@magento/peregrine/lib/talons/MegaMenu/useMegaMenuItem', () => ({
28
+ useMegaMenuItem: jest.fn(() => {
29
+ return {
30
+ isFocused: false,
31
+ isActive: false,
32
+ handleMenuItemFocus: jest.fn(),
33
+ handleCloseSubMenu: jest.fn(),
34
+ isMenuActive: false,
35
+ handleKeyDown: mockHandleKeyDown
36
+ };
37
+ })
38
+ }));
39
+
40
+ let inputProps = {};
41
+
42
+ const Component = () => {
43
+ return <MegaMenuItem {...inputProps} />;
44
+ };
45
+
46
+ const givenDefaultValues = () => {
47
+ inputProps = {
48
+ activeCategoryId: 1,
49
+ category: {
50
+ id: 1,
51
+ name: 'Women',
52
+ url_path: 'women',
53
+ isActive: true,
54
+ children: [
55
+ {
56
+ id: 2,
57
+ name: 'Bottoms',
58
+ url_path: 'bottoms',
59
+ children: []
60
+ },
61
+ {
62
+ id: 3,
63
+ name: 'Tops',
64
+ url_path: 'tops',
65
+ isActive: false,
66
+ children: []
67
+ }
68
+ ]
69
+ },
70
+ rootCategoryName: 'Clothing',
71
+ categoryUrlSuffix: '.html',
72
+ mainNavWidth: 200,
73
+ subMenuState: 'test',
74
+ disableFocus: false
75
+ };
76
+ };
77
+
78
+ describe('Mega menu item renders correctly', () => {
79
+ beforeEach(() => {
80
+ givenDefaultValues();
81
+ });
82
+
83
+ test('it renders correctly', () => {
84
+ const instance = createTestInstance(<Component />);
85
+
86
+ expect(instance.toJSON()).toMatchSnapshot();
87
+ });
88
+
89
+ test('it marks the active category', () => {
90
+ const { root } = createTestInstance(<Component />);
91
+
92
+ expect(root.findByType(Link).props.className).toEqual('megaMenuLink');
93
+ expect(root.findByType(Link).props.to).toEqual('/women.html');
94
+ expect(root.findByType(Link).props.children[0]).toEqual('Women');
95
+ });
96
+
97
+ it('should call a11yClick', () => {
98
+ const { root } = createTestInstance(<Component />);
99
+
100
+ act(() => {
101
+ root.findByType(Link).props.onKeyDown();
102
+ });
103
+
104
+ expect(mockHandleKeyDown).toHaveBeenCalled();
105
+ });
106
+
107
+ test('it does not render submenu when item does not have children', () => {
108
+ const categoryWithoutChildren = {
109
+ id: 3,
110
+ name: 'Tops',
111
+ url_path: 'tops',
112
+ isActive: false,
113
+ children: []
114
+ };
115
+
116
+ const instance = createTestInstance(
117
+ <Component category={categoryWithoutChildren} />
118
+ );
119
+
120
+ expect(instance.toJSON().children.length).toEqual(1);
121
+ expect(instance.toJSON()).toMatchSnapshot();
122
+ });
123
+ });