@riosst100/pwa-marketplace 1.6.7 → 1.6.9
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 +1 -1
- package/src/components/ShopBy/shopBy.js +23 -2
- package/src/components/ShopBy/shopBy.module.css +12 -4
- package/src/components/ShopBySets/shopBySets.js +24 -2
- package/src/components/ShopBySets/shopBySets.module.css +12 -4
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +1 -3
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.js +3 -3
package/package.json
CHANGED
|
@@ -120,6 +120,14 @@ const ShopBy = props => {
|
|
|
120
120
|
|
|
121
121
|
const newAvailableGroups = searchQuery ? filteredAvailableGroups : availableGroups;
|
|
122
122
|
|
|
123
|
+
const splitToNChunks = (array, n) => {
|
|
124
|
+
let result = [];
|
|
125
|
+
for (let i = n; i > 0; i--) {
|
|
126
|
+
result.push(array.splice(0, Math.ceil(array.length / i)));
|
|
127
|
+
}
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
|
|
123
131
|
const setRelases = newAvailableGroups.map((group, index) => {
|
|
124
132
|
const optionsResult = [];
|
|
125
133
|
|
|
@@ -138,15 +146,28 @@ const ShopBy = props => {
|
|
|
138
146
|
</li>)
|
|
139
147
|
})
|
|
140
148
|
|
|
149
|
+
let optionsResultSplitted = [];
|
|
150
|
+
if (active == group) {
|
|
151
|
+
optionsResultSplitted = splitToNChunks(optionsResult, 3);
|
|
152
|
+
}
|
|
153
|
+
|
|
141
154
|
return (
|
|
142
155
|
<>
|
|
143
|
-
{optionsResult ?
|
|
144
|
-
<div className='singles_group-wrapper mb-4 px-2 inline-block
|
|
156
|
+
{optionsResult && active == "all" ?
|
|
157
|
+
<div className={cn('singles_group-wrapper mb-4 px-2 inline-block', classes.singlesGroupWrapper)}>
|
|
145
158
|
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' >
|
|
146
159
|
{group}
|
|
147
160
|
</div>
|
|
148
161
|
<div className={cn('singles_item-list flex flex-col')}>{optionsResult}</div>
|
|
149
162
|
</div> : ''}
|
|
163
|
+
{active == group ? optionsResultSplitted && optionsResultSplitted.length && optionsResultSplitted.map((optionsResult, index) =>
|
|
164
|
+
<div key={index} className={cn('singles_group-wrapper mb-4 px-2 inline-block', classes.singlesGroupWrapper)}>
|
|
165
|
+
{index == 0 ? <div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2'>{group}</div> :
|
|
166
|
+
<div className='singles_item_group_letter text-xl font-semibold pb-1 mb-2' style={{"marginTop":"35px"}}></div>}
|
|
167
|
+
<div className={cn('singles_item-list flex flex-col')}>{optionsResult}</div>
|
|
168
|
+
</div>
|
|
169
|
+
)
|
|
170
|
+
: ''}
|
|
150
171
|
</>
|
|
151
172
|
);
|
|
152
173
|
}
|
|
@@ -31,16 +31,24 @@
|
|
|
31
31
|
|
|
32
32
|
.singlesWrapper {
|
|
33
33
|
column-count: 1;
|
|
34
|
+
display: flex;
|
|
35
|
+
width: 100%;
|
|
36
|
+
flex-wrap: wrap;
|
|
37
|
+
flex-direction: row;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.singlesGroupWrapper {
|
|
41
|
+
width: 100%;
|
|
34
42
|
}
|
|
35
43
|
|
|
36
44
|
@media screen and (min-width: 768px) {
|
|
37
|
-
.
|
|
38
|
-
|
|
45
|
+
.singlesGroupWrapper {
|
|
46
|
+
width: 50%;
|
|
39
47
|
}
|
|
40
48
|
}
|
|
41
49
|
|
|
42
50
|
@media screen and (min-width: 1023px) {
|
|
43
|
-
.
|
|
44
|
-
|
|
51
|
+
.singlesGroupWrapper {
|
|
52
|
+
width: 33.33%;
|
|
45
53
|
}
|
|
46
54
|
}
|
|
@@ -84,6 +84,14 @@ const ShopBySets = props => {
|
|
|
84
84
|
}
|
|
85
85
|
// }, [collectibleGameSets])
|
|
86
86
|
|
|
87
|
+
const splitToNChunks = (array, n) => {
|
|
88
|
+
let result = [];
|
|
89
|
+
for (let i = n; i > 0; i--) {
|
|
90
|
+
result.push(array.splice(0, Math.ceil(array.length / i)));
|
|
91
|
+
}
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
|
|
87
95
|
const setRelases = newCollectibleGameSets.length && newCollectibleGameSets.map((setRelease, index) => {
|
|
88
96
|
const { release_type, sets } = setRelease;
|
|
89
97
|
|
|
@@ -104,16 +112,30 @@ const ShopBySets = props => {
|
|
|
104
112
|
</li>)
|
|
105
113
|
})
|
|
106
114
|
}
|
|
115
|
+
|
|
116
|
+
// console.log('setsResult: '+setsResult.length);
|
|
117
|
+
let setsResultSplitted = [];
|
|
118
|
+
if (active == release_type || newCollectibleGameSets.length == 1) {
|
|
119
|
+
setsResultSplitted = splitToNChunks(setsResult, 3);
|
|
120
|
+
}
|
|
107
121
|
|
|
108
122
|
return (
|
|
109
123
|
<>
|
|
110
|
-
{active == "all"
|
|
111
|
-
<div className='singles_group-wrapper mb-4 px-2 inline-block
|
|
124
|
+
{active == "all" && newCollectibleGameSets.length > 1 ?
|
|
125
|
+
<div className={cn('singles_group-wrapper mb-4 px-2 inline-block', classes.singlesGroupWrapper)}>
|
|
112
126
|
<div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2' >
|
|
113
127
|
{release_type}
|
|
114
128
|
</div>
|
|
115
129
|
<div className={cn('singles_item-list flex flex-col')}>{setsResult}</div>
|
|
116
130
|
</div> : ''}
|
|
131
|
+
{active == release_type || newCollectibleGameSets.length == 1 ? setsResultSplitted && setsResultSplitted.length && setsResultSplitted.map((setsResult, index) =>
|
|
132
|
+
<div key={index} className={cn('singles_group-wrapper mb-4 px-2 inline-block', classes.singlesGroupWrapper)}>
|
|
133
|
+
{index == 0 ? <div className='singles_item_group_letter text-xl font-semibold border-b border-gray-100 pb-1 mb-2'>{release_type}</div> :
|
|
134
|
+
<div className='singles_item_group_letter text-xl font-semibold pb-1 mb-2' style={{"marginTop":"35px"}}></div>}
|
|
135
|
+
<div className={cn('singles_item-list flex flex-col')}>{setsResult}</div>
|
|
136
|
+
</div>
|
|
137
|
+
)
|
|
138
|
+
: ''}
|
|
117
139
|
</>
|
|
118
140
|
);
|
|
119
141
|
});
|
|
@@ -53,16 +53,24 @@
|
|
|
53
53
|
|
|
54
54
|
.singlesWrapper {
|
|
55
55
|
column-count: 1;
|
|
56
|
+
display: flex;
|
|
57
|
+
width: 100%;
|
|
58
|
+
flex-wrap: wrap;
|
|
59
|
+
flex-direction: row;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.singlesGroupWrapper {
|
|
63
|
+
width: 100%;
|
|
56
64
|
}
|
|
57
65
|
|
|
58
66
|
@media screen and (min-width: 768px) {
|
|
59
|
-
.
|
|
60
|
-
|
|
67
|
+
.singlesGroupWrapper {
|
|
68
|
+
width: 50%;
|
|
61
69
|
}
|
|
62
70
|
}
|
|
63
71
|
|
|
64
72
|
@media screen and (min-width: 1023px) {
|
|
65
|
-
.
|
|
66
|
-
|
|
73
|
+
.singlesGroupWrapper {
|
|
74
|
+
width: 33.33%;
|
|
67
75
|
}
|
|
68
76
|
}
|
|
@@ -115,8 +115,6 @@ const CategoryContent = props => {
|
|
|
115
115
|
[items, activeLetter]
|
|
116
116
|
});
|
|
117
117
|
|
|
118
|
-
console.log(galleryItems)
|
|
119
|
-
|
|
120
118
|
const sidebarRef = useRef(null);
|
|
121
119
|
const classes = useStyle(defaultClasses, props.classes);
|
|
122
120
|
const shouldRenderSidebarContent = useIsInViewport({
|
|
@@ -141,7 +139,7 @@ const CategoryContent = props => {
|
|
|
141
139
|
) : null;
|
|
142
140
|
|
|
143
141
|
const sidebar = shouldShowFilterButtons ? (
|
|
144
|
-
<FilterSidebar children={children} filters={filters} allowedFilters={category ? category.allowed_filters : []} />
|
|
142
|
+
<FilterSidebar hideFilters={category && category.hide_filters ? true : false} children={children} filters={filters} allowedFilters={category ? category.allowed_filters : []} />
|
|
145
143
|
) : shouldShowFilterShimmer ? (
|
|
146
144
|
<FilterSidebarShimmer />
|
|
147
145
|
) : null;
|
|
@@ -21,7 +21,7 @@ const SCROLL_OFFSET = 150;
|
|
|
21
21
|
* @param {Object} props.filters - filters to display
|
|
22
22
|
*/
|
|
23
23
|
const FilterSidebar = props => {
|
|
24
|
-
const { filters, filterCountToOpen, allowedFilters } = props;
|
|
24
|
+
const { filters, filterCountToOpen, allowedFilters, hideFilters } = props;
|
|
25
25
|
const talonProps = useFilterSidebar({ filters });
|
|
26
26
|
const {
|
|
27
27
|
filterApi,
|
|
@@ -154,14 +154,14 @@ const FilterSidebar = props => {
|
|
|
154
154
|
<Filter size={15} className='text-gray-900' />
|
|
155
155
|
</h2>
|
|
156
156
|
</div>
|
|
157
|
+
{hideFilters ? <ul className={classes.blocks}>No filters available.</ul> : <>
|
|
157
158
|
<CurrentFilters
|
|
158
159
|
filterApi={filterApi}
|
|
159
160
|
filterNames={filterNames}
|
|
160
161
|
filterState={filterState}
|
|
161
162
|
onRemove={handleApplyFilter}
|
|
162
163
|
/>
|
|
163
|
-
|
|
164
|
-
<ul className={classes.blocks}>{filtersList}</ul>
|
|
164
|
+
<ul className={classes.blocks}>{filtersList}</ul></>}
|
|
165
165
|
</div>
|
|
166
166
|
</aside>
|
|
167
167
|
);
|