@riosst100/pwa-marketplace 2.9.0 → 2.9.2
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/FilterTop/FilterBlockList/filterTopItem.js +1 -1
- package/src/components/{ShopBy/shopBy.js → ShopBy copy/shopBy.js } +1 -1
- package/src/components/ShowMore/index.js +2 -0
- package/src/components/ShowMore/shopBy.js +454 -0
- package/src/components/ShowMore/shopBy.shimmer.js +50 -0
- package/src/components/ShowMore/showMore.js +428 -0
- package/src/components/ShowMore/showMore.module.css +76 -0
- package/src/components/ShowMore/showMore.shimmer.js +50 -0
- package/src/components/SubCategory/subCategory.js +8 -2
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/categoryContent.gql.js +5 -0
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js +53 -2
- package/src/overwrites/venia-ui/lib/RootComponents/Category/category.js +8 -1
- package/src/overwrites/venia-ui/lib/RootComponents/Category/categoryContent.js +1 -7
- package/src/talons/ShopBy/useShopBy.js +2 -4
- package/src/talons/ShopBy copy/useShopBy.js +280 -0
- package/src/talons/ShowMore/showMore.gql.js +98 -0
- package/src/talons/ShowMore/useShopBy.js +280 -0
- package/src/talons/ShowMore/useShowMore.js +273 -0
package/package.json
CHANGED
|
@@ -86,7 +86,7 @@ const FilterTopItem = props => {
|
|
|
86
86
|
) : group == "category" ? (
|
|
87
87
|
<Link className={classes.item} to={'/'+value}>{title}</Link>
|
|
88
88
|
) : value == "shopby_all" ? (
|
|
89
|
-
<Link className={classes.item} to={search ? filterSearch + '&
|
|
89
|
+
<Link className={classes.item} to={search ? filterSearch + '&show_more=' + group : '?show_more=' + group}>{title}</Link>
|
|
90
90
|
) : group == "shopby" || group == "shopby_with_all" ? (
|
|
91
91
|
<Link className={classes.item} to={search ? filterSearch + '&shopby=' + value : '?shopby=' + value}>{title}</Link>
|
|
92
92
|
) : group == "cat_id" ? (
|
|
@@ -37,7 +37,7 @@ import ErrorView from '@magento/venia-ui/lib/components/ErrorView';
|
|
|
37
37
|
import { StoreTitle, Meta } from '@magento/venia-ui/lib/components/Head';
|
|
38
38
|
import { Link } from 'react-router-dom';
|
|
39
39
|
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
40
|
-
import defaultClasses from '
|
|
40
|
+
import defaultClasses from '@riosst100/pwa-marketplace/src/components/ShowMore/shopBy.module.css';
|
|
41
41
|
import Divider from '@riosst100/pwa-marketplace/src/components/Divider';
|
|
42
42
|
import { ShopByShimmer } from '@riosst100/pwa-marketplace/src/components/ShopBy';
|
|
43
43
|
import CustomSortBy from '@riosst100/pwa-marketplace/src/components/CustomSortBy';
|
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
import React, { Fragment, Suspense, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { FormattedMessage } from 'react-intl';
|
|
3
|
+
import { array, number, shape, string } from 'prop-types';
|
|
4
|
+
|
|
5
|
+
import { useIsInViewport } from '@magento/peregrine/lib/hooks/useIsInViewport';
|
|
6
|
+
import { useCategoryContent } from '@magento/peregrine/lib/talons/RootComponents/Category';
|
|
7
|
+
|
|
8
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
9
|
+
import Breadcrumbs from '@magento/venia-ui/lib/components/Breadcrumbs';
|
|
10
|
+
import FilterModalOpenButton, {
|
|
11
|
+
FilterModalOpenButtonShimmer
|
|
12
|
+
} from '@magento/venia-ui/lib/components/FilterModalOpenButton';
|
|
13
|
+
import { FilterSidebarShimmer } from '@magento/venia-ui/lib/components/FilterSidebar';
|
|
14
|
+
import Gallery, { GalleryShimmer } from '@magento/venia-ui/lib/components/Gallery';
|
|
15
|
+
import Pagination from '@magento/venia-ui/lib/components/Pagination';
|
|
16
|
+
import ProductSort, { ProductSortShimmer } from '@magento/venia-ui/lib/components/ProductSort';
|
|
17
|
+
import RichContent from '@magento/venia-ui/lib/components/RichContent';
|
|
18
|
+
import Shimmer from '@magento/venia-ui/lib/components/Shimmer';
|
|
19
|
+
import SortedByContainer, {
|
|
20
|
+
SortedByContainerShimmer
|
|
21
|
+
} from '@magento/venia-ui/lib/components/SortedByContainer';
|
|
22
|
+
import NoProductsFound from '@magento/venia-ui/lib/RootComponents/Category/NoProductsFound';
|
|
23
|
+
import cn from 'classnames';
|
|
24
|
+
import ProductListTab, { ProductListTabShimmer } from '@riosst100/pwa-marketplace/src/components/ProductListTab';
|
|
25
|
+
import SubCategory from '@riosst100/pwa-marketplace/src/components/SubCategory/subCategory';
|
|
26
|
+
import AttributesBlock from '@riosst100/pwa-marketplace/src/components/AttributesBlock/attributesBlock';
|
|
27
|
+
|
|
28
|
+
import BrandSlider from '@riosst100/pwa-marketplace/src/components/BrandSlider';
|
|
29
|
+
import CollectibleGameSets from '@riosst100/pwa-marketplace/src/components/CollectibleGameSets/collectibleGameSets';
|
|
30
|
+
import { useLocation } from 'react-router-dom';
|
|
31
|
+
import { getFiltersFromSearch } from '@magento/peregrine/lib/talons/FilterModal/helpers';
|
|
32
|
+
import CustomSubCategory from '@riosst100/pwa-marketplace/src/components/SubCategory/customSubCategory';
|
|
33
|
+
import AlphaFilter from '@riosst100/pwa-marketplace/src/components/AlphaFilter';
|
|
34
|
+
import ShopByFilters from '@riosst100/pwa-marketplace/src/components/ShopByFilters';
|
|
35
|
+
|
|
36
|
+
import ErrorView from '@magento/venia-ui/lib/components/ErrorView';
|
|
37
|
+
import { StoreTitle, Meta } from '@magento/venia-ui/lib/components/Head';
|
|
38
|
+
import { Link } from 'react-router-dom';
|
|
39
|
+
import resourceUrl from '@magento/peregrine/lib/util/makeUrl';
|
|
40
|
+
import defaultClasses from '@riosst100/pwa-marketplace/src/components/ShowMore/shopBy.module.css';
|
|
41
|
+
import Divider from '@riosst100/pwa-marketplace/src/components/Divider';
|
|
42
|
+
import { ShopByShimmer } from '@riosst100/pwa-marketplace/src/components/ShopBy';
|
|
43
|
+
import CustomSortBy from '@riosst100/pwa-marketplace/src/components/CustomSortBy';
|
|
44
|
+
import ArraySearchInput from '@riosst100/pwa-marketplace/src/components/ArraySearchInput';
|
|
45
|
+
import { useCustomSort } from '@riosst100/pwa-marketplace/src/hooks/useCustomSort';
|
|
46
|
+
import { useShopBy } from '@riosst100/pwa-marketplace/src/talons/ShopBy/useShopBy';
|
|
47
|
+
|
|
48
|
+
const FilterModal = React.lazy(() => import('@magento/venia-ui/lib/components/FilterModal'));
|
|
49
|
+
const FilterSidebar = React.lazy(() =>
|
|
50
|
+
import('@magento/venia-ui/lib/components/FilterSidebar')
|
|
51
|
+
);
|
|
52
|
+
const FilterTop = React.lazy(() =>
|
|
53
|
+
import('@riosst100/pwa-marketplace/src/components/FilterTop')
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
const ShopBy = props => {
|
|
57
|
+
const {
|
|
58
|
+
categoryId,
|
|
59
|
+
shopby
|
|
60
|
+
// data,
|
|
61
|
+
// isLoading,
|
|
62
|
+
// pageControl,
|
|
63
|
+
// sortProps,
|
|
64
|
+
// pageSize
|
|
65
|
+
} = props || {};
|
|
66
|
+
// const [currentSort] = sortProps;
|
|
67
|
+
|
|
68
|
+
// const talonProps = useCategoryContent({
|
|
69
|
+
// categoryId,
|
|
70
|
+
// data,
|
|
71
|
+
// pageSize
|
|
72
|
+
// });
|
|
73
|
+
|
|
74
|
+
// const {
|
|
75
|
+
// availableSortMethods,
|
|
76
|
+
// categoryName,
|
|
77
|
+
// categoryDescription,
|
|
78
|
+
// filters,
|
|
79
|
+
// items,
|
|
80
|
+
// children,
|
|
81
|
+
// parent,
|
|
82
|
+
// totalCount,
|
|
83
|
+
// totalPagesFromData,
|
|
84
|
+
// attributesBlock,
|
|
85
|
+
// category,
|
|
86
|
+
// } = talonProps;
|
|
87
|
+
|
|
88
|
+
const [active, setActive] = useState('all')
|
|
89
|
+
const [activeTab, setActiveTab] = useState('all');
|
|
90
|
+
const [activeFilter, setActiveFilter] = useState('');
|
|
91
|
+
const [searchQuery, setSearchQuery] = useState('');
|
|
92
|
+
|
|
93
|
+
const { search } = useLocation();
|
|
94
|
+
|
|
95
|
+
const sortProps = useCustomSort({ sortFromSearch: false, defaultSort: {
|
|
96
|
+
sortText: 'All (A-Z)',
|
|
97
|
+
value: 'all'
|
|
98
|
+
}});
|
|
99
|
+
|
|
100
|
+
const [currentSort] = sortProps;
|
|
101
|
+
|
|
102
|
+
// const [sortBy, setSortBy] = useState({
|
|
103
|
+
// sortText: 'All (A-Z)',
|
|
104
|
+
// value: 'all'
|
|
105
|
+
// });
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
const classes = useStyle(defaultClasses);
|
|
109
|
+
|
|
110
|
+
const talonProps = useShopBy({ activeFilter, searchQuery, active, setActive, currentSort, categoryId, shopby });
|
|
111
|
+
|
|
112
|
+
const { error, loading, dataResult, categoryUrlSuffix, categoryUrlKey, productType, filteredAvailableGroups, availableGroups, attributeData, alpha, category, pageInfo } = talonProps;
|
|
113
|
+
|
|
114
|
+
if (loading) {
|
|
115
|
+
return <ShopByShimmer />;
|
|
116
|
+
} else if (error) {
|
|
117
|
+
return <ErrorView />;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const newAvailableGroups = searchQuery ? filteredAvailableGroups : availableGroups;
|
|
121
|
+
|
|
122
|
+
const splitToNChunks = (array, n) => {
|
|
123
|
+
let result = [];
|
|
124
|
+
for (let i = n; i > 0; i--) {
|
|
125
|
+
result.push(array.splice(0, Math.ceil(array.length / i)));
|
|
126
|
+
}
|
|
127
|
+
return result;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
let filterSearchArr = search ? search.split('&') : [];
|
|
131
|
+
filterSearchArr = filterSearchArr.filter(function(data) {
|
|
132
|
+
return !data.includes('shopby');
|
|
133
|
+
})
|
|
134
|
+
filterSearchArr = filterSearchArr.filter(function(data) {
|
|
135
|
+
return !data.includes('trains_roadname_country');
|
|
136
|
+
})
|
|
137
|
+
let filterSearch = filterSearchArr.join('&')
|
|
138
|
+
|
|
139
|
+
if (!filterSearch.includes('?')) {
|
|
140
|
+
filterSearch = '?'+filterSearch;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
let additionalFilter = '';
|
|
144
|
+
if (shopby == 'sc_brands') {
|
|
145
|
+
additionalFilter = '&shopby=release&active_tab=brand';
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const setRelases = newAvailableGroups && newAvailableGroups.length && newAvailableGroups.map((group, index) => {
|
|
149
|
+
const optionsResult = [];
|
|
150
|
+
|
|
151
|
+
if (active === 'all' || active === group) {
|
|
152
|
+
dataResult[group] && dataResult[group].length && dataResult[group].map((option, index) => {
|
|
153
|
+
const { count, label, value } = option;
|
|
154
|
+
|
|
155
|
+
const filter = attributeData.attribute_code + '[filter]=' + label + ',' + value;
|
|
156
|
+
const params = filterSearch ? filterSearch + '&' + filter + additionalFilter : '?' + filter + additionalFilter;
|
|
157
|
+
|
|
158
|
+
const categoryUrl = resourceUrl(
|
|
159
|
+
`/${category?.url_path}${categoryUrlSuffix || ''}${params}`
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
optionsResult.push(<li key={index} className='list-none'>
|
|
163
|
+
<Link to={categoryUrl} className="hover_bg-darkblue-900 hover_text-white w-full block text-[14px] py-[2px] px-0">
|
|
164
|
+
{label} <span className='text-[12px]'>({count})</span>
|
|
165
|
+
</Link>
|
|
166
|
+
</li>)
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
let optionsResultSplitted = [];
|
|
170
|
+
if (newAvailableGroups.length == 1 || active == group) {
|
|
171
|
+
optionsResultSplitted = splitToNChunks(optionsResult, 3);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const all = active == "all" ? (
|
|
175
|
+
newAvailableGroups.length == 1 ? (
|
|
176
|
+
optionsResultSplitted && optionsResultSplitted.length && optionsResultSplitted.map((data, index) => (
|
|
177
|
+
<div key={index} className={cn('singles_group-wrapper mb-4 px-2 inline-block', classes.singlesGroupWrapper)}>
|
|
178
|
+
{searchQuery && availableGroups.length > 1 && (index == 0 ? <div className='singles_item_group_letter text-xl font-medium border-b border-gray-100 pb-1 mb-2'>{group}</div> :
|
|
179
|
+
<div className='singles_item_group_letter text-xl font-medium pb-1 mb-2' style={{"marginTop":"35px"}}></div>)}
|
|
180
|
+
<div className={cn('singles_item-list flex flex-col')}>{data}</div>
|
|
181
|
+
</div>
|
|
182
|
+
)
|
|
183
|
+
)
|
|
184
|
+
) : (
|
|
185
|
+
<div className={cn('singles_group-wrapper mb-4 px-2 inline-block', classes.singlesGroupWrapper)}>
|
|
186
|
+
<div className='singles_item_group_letter text-xl font-medium border-b border-gray-100 pb-1 mb-2' >
|
|
187
|
+
{group}
|
|
188
|
+
</div>
|
|
189
|
+
<div className={cn('singles_item-list flex flex-col')}>{optionsResult}</div>
|
|
190
|
+
</div>
|
|
191
|
+
)
|
|
192
|
+
) : '';
|
|
193
|
+
|
|
194
|
+
return (
|
|
195
|
+
<>
|
|
196
|
+
{all}
|
|
197
|
+
{active == group ? optionsResultSplitted && optionsResultSplitted.length && optionsResultSplitted.map((optionsResult, index) =>
|
|
198
|
+
<div key={index} className={cn('singles_group-wrapper mb-4 px-2 inline-block', classes.singlesGroupWrapper)}>
|
|
199
|
+
{index == 0 ? <div className='singles_item_group_letter text-xl font-medium border-b border-gray-100 pb-1 mb-2'>{group}</div> :
|
|
200
|
+
<div className='singles_item_group_letter text-xl font-medium pb-1 mb-2' style={{"marginTop":"35px"}}></div>}
|
|
201
|
+
<div className={cn('singles_item-list flex flex-col')}>{optionsResult}</div>
|
|
202
|
+
</div>
|
|
203
|
+
)
|
|
204
|
+
: ''}
|
|
205
|
+
</>
|
|
206
|
+
);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
return null;
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
const handleActive = (val) => {
|
|
213
|
+
setActive(val);
|
|
214
|
+
setSearchQuery('')
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// let availableSortBy = [
|
|
218
|
+
// {
|
|
219
|
+
// 'label': 'All (A-Z)',
|
|
220
|
+
// 'value': 'all'
|
|
221
|
+
// }
|
|
222
|
+
// ];
|
|
223
|
+
|
|
224
|
+
let availableSortBy = [
|
|
225
|
+
{
|
|
226
|
+
'label': 'All (A-Z)',
|
|
227
|
+
'value': 'all'
|
|
228
|
+
}
|
|
229
|
+
];
|
|
230
|
+
|
|
231
|
+
// const title = attributeData ? (attributeData.attribute_code == "sc_baseball_parallel" ? "Parallel Sets" : (attributeData.attribute_code == "sc_baseball_inserts" ? "Insert Sets" : attributeData.label)) : "Shop By"
|
|
232
|
+
const title = pageInfo ? pageInfo.label : '';
|
|
233
|
+
|
|
234
|
+
let availableFilterOption = [];
|
|
235
|
+
|
|
236
|
+
if (shopby == "vehicles_make" || shopby == "vehicles_brands") {
|
|
237
|
+
availableFilterOption = [
|
|
238
|
+
{
|
|
239
|
+
'code': 'vehicles_diecast',
|
|
240
|
+
'value': 'Cars',
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
'code': 'vehicles_diecast',
|
|
244
|
+
'value': 'Formula Racing'
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
'code': 'vehicles_diecast',
|
|
248
|
+
'value': 'Motorsport'
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
'code': 'vehicles_diecast',
|
|
252
|
+
'value': 'Aircraft'
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
'code': 'vehicles_diecast',
|
|
256
|
+
'value': 'Bikes'
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
'code': 'vehicles_diecast',
|
|
260
|
+
'value': 'Military'
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
'code': 'vehicles_diecast',
|
|
264
|
+
'value': 'Transport'
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
'code': 'vehicles_diecast',
|
|
268
|
+
'value': 'Emergency Services'
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
'code': 'vehicles_diecast',
|
|
272
|
+
'value': 'Heavy Machinery'
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
'code': 'vehicles_diecast',
|
|
276
|
+
'value': 'TV/Movies'
|
|
277
|
+
}
|
|
278
|
+
];
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
if (shopby == "brands" || shopby == "product_line") {
|
|
282
|
+
if (category && category?.url_path.includes('anime-figures')) {
|
|
283
|
+
availableFilterOption = [
|
|
284
|
+
{
|
|
285
|
+
'code': 'anime_figures',
|
|
286
|
+
'value': 'Complete Figures',
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
'code': 'anime_figures',
|
|
290
|
+
'value': 'Articulated Figures'
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
'code': 'anime_figures',
|
|
294
|
+
'value': 'Statues'
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
'code': 'anime_figures',
|
|
298
|
+
'value': 'Mini-Figures'
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
'code': 'anime_figures',
|
|
302
|
+
'value': 'Capsule Toys (Gashapon)'
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
'code': 'anime_figures',
|
|
306
|
+
'value': 'Candy Toys'
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
'code': 'anime_figures',
|
|
310
|
+
'value': 'R18+'
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
'code': 'anime_figures',
|
|
314
|
+
'value': 'Model Kits'
|
|
315
|
+
}
|
|
316
|
+
];
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
const handleActiveTab = (val) => {
|
|
321
|
+
setActiveTab(val);
|
|
322
|
+
setActive('all');
|
|
323
|
+
setActiveFilter('');
|
|
324
|
+
|
|
325
|
+
setSearchQuery('')
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
const handleActiveFilter = (val) => {
|
|
329
|
+
setActiveFilter(val);
|
|
330
|
+
|
|
331
|
+
setActive('all');
|
|
332
|
+
|
|
333
|
+
setSearchQuery('')
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const activeFilters = [];
|
|
337
|
+
|
|
338
|
+
const allActiveFilters = getFiltersFromSearch(search);
|
|
339
|
+
|
|
340
|
+
if (allActiveFilters && allActiveFilters.size > 0) {
|
|
341
|
+
allActiveFilters.forEach((value, key) => {
|
|
342
|
+
value.forEach((value) => {
|
|
343
|
+
const filterArr = value.split(',');
|
|
344
|
+
|
|
345
|
+
const label = filterArr[0];
|
|
346
|
+
const optionId = filterArr[1];
|
|
347
|
+
if (label == "Singles") {
|
|
348
|
+
isSingles = true;
|
|
349
|
+
}
|
|
350
|
+
if (key == "bricks_categories" || key == "sc_sports_categories" || key == "card_game" || key == "product_line" && urlKey == "brands" || key == "product_line" && urlKey == "franchise" || key == "franchise" && urlKey == "brands" || key == "franchise" && urlKey == "franchise" || key == "brands" && urlKey == "franchise" || key == "brands" && urlKey == "brands") {
|
|
351
|
+
activeFilters.push(
|
|
352
|
+
{
|
|
353
|
+
'label': label,
|
|
354
|
+
'code': key,
|
|
355
|
+
'option_id': optionId
|
|
356
|
+
}
|
|
357
|
+
)
|
|
358
|
+
}
|
|
359
|
+
})
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
return (
|
|
364
|
+
<Fragment>
|
|
365
|
+
<StoreTitle>{title}</StoreTitle>
|
|
366
|
+
<Breadcrumbs categoryId={categoryId} customPage={title} currentFilter={activeFilters} />
|
|
367
|
+
{category?.url_path.includes('model-railway') && <FilterTop shopby={shopby} filters={[]} category={category} children={[]} allowedFilters={category ? category.allowed_filters : []} />}
|
|
368
|
+
{/* <ShopByFilters handleActiveFilter={handleActiveFilter} activeFilter={activeFilter} category={category} /> */}
|
|
369
|
+
{availableFilterOption.length ?
|
|
370
|
+
<ul className={classes.nav}>
|
|
371
|
+
{availableFilterOption.map((filter, index) => (
|
|
372
|
+
<li className={classes.nav_item}>
|
|
373
|
+
<button
|
|
374
|
+
onClick={() => {
|
|
375
|
+
handleActiveFilter(filter.code + '|' + filter.value)
|
|
376
|
+
}}
|
|
377
|
+
>
|
|
378
|
+
{activeFilter == filter.code + '|' + filter.value ? <b>{filter.value}</b> : filter.value}
|
|
379
|
+
</button>
|
|
380
|
+
</li>
|
|
381
|
+
))}
|
|
382
|
+
<li className={classes.nav_item}>
|
|
383
|
+
<button
|
|
384
|
+
onClick={() => {
|
|
385
|
+
handleActiveFilter('')
|
|
386
|
+
}}
|
|
387
|
+
>
|
|
388
|
+
{activeFilter == '' ? <b>All</b> : 'All'}
|
|
389
|
+
</button>
|
|
390
|
+
</li>
|
|
391
|
+
</ul>
|
|
392
|
+
: ''}
|
|
393
|
+
<h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'>
|
|
394
|
+
{title}
|
|
395
|
+
</h1>
|
|
396
|
+
<div className='border border-gray-100 px-6'>
|
|
397
|
+
{dataResult ? (
|
|
398
|
+
<div
|
|
399
|
+
className={classes.toolbar}
|
|
400
|
+
>
|
|
401
|
+
<div style={{"width":"35%"}}><ArraySearchInput active={active} searchQuery={searchQuery} placeholder="Search sets..." isOpen={true} setSearchQuery={setSearchQuery} /></div>
|
|
402
|
+
<CustomSortBy sortProps={sortProps} availableSortMethods={availableSortBy} />
|
|
403
|
+
</div>
|
|
404
|
+
) : ''}
|
|
405
|
+
{shopby != "vehicles_year" && shopby != "trains_gauge" && shopby != "vehicles_scale" && shopby != "lego_theme" && shopby != "lego_subtheme" && shopby != "lego_interest" && shopby != "lego_age_level" && productType != "expansion-sets" ? (
|
|
406
|
+
<>
|
|
407
|
+
<section className='single_list-indexing-container relative m-auto pt-5'>
|
|
408
|
+
<ul className='flex gap-2 justify-center flex-wrap'>
|
|
409
|
+
<li>
|
|
410
|
+
<button
|
|
411
|
+
className={cn(
|
|
412
|
+
'rounded-md border border-solid border-gray-100 p-2 min-w-[28px]',
|
|
413
|
+
'leading-4 font-medium text-base hover_bg-gray-50'
|
|
414
|
+
)}
|
|
415
|
+
onClick={() => {
|
|
416
|
+
handleActive('all')
|
|
417
|
+
}}
|
|
418
|
+
>
|
|
419
|
+
{active == 'all' ? <b>All</b> : 'All'}
|
|
420
|
+
</button>
|
|
421
|
+
</li>
|
|
422
|
+
{alpha && alpha.length && alpha.map((letter, index) => (
|
|
423
|
+
<li key={index}>
|
|
424
|
+
<button
|
|
425
|
+
className={cn(
|
|
426
|
+
'rounded-md border border-solid border-gray-100 p-2 min-w-[28px]',
|
|
427
|
+
'leading-4 font-medium text-base ',
|
|
428
|
+
availableGroups.includes(letter) > 0 ? 'hover_bg-gray-50' : 'bg-gray-100 text-gray-400',
|
|
429
|
+
)}
|
|
430
|
+
onClick={() => {
|
|
431
|
+
handleActive(letter)
|
|
432
|
+
}}
|
|
433
|
+
disabled={availableGroups.includes(letter) > 0 ? false : true}
|
|
434
|
+
>
|
|
435
|
+
{active == letter ? <b>{letter}</b> : letter}
|
|
436
|
+
</button>
|
|
437
|
+
</li>
|
|
438
|
+
))}
|
|
439
|
+
</ul>
|
|
440
|
+
</section>
|
|
441
|
+
</>
|
|
442
|
+
) : ''}
|
|
443
|
+
<Divider className="mb-5 px-4 mt-5" />
|
|
444
|
+
<section className='singles-container'>
|
|
445
|
+
<div className={cn('singles-wrapper block -mx-4', classes.singlesWrapper)}>
|
|
446
|
+
{dataResult && Object.keys(dataResult).length != 0 ? setRelases : (searchQuery ? <div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>No data found for <b>{searchQuery}</b> search query.</div> : <div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>No data found.</div>)}
|
|
447
|
+
</div>
|
|
448
|
+
</section>
|
|
449
|
+
</div>
|
|
450
|
+
</Fragment>
|
|
451
|
+
);
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
export default ShopBy;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { shape, string } from 'prop-types';
|
|
3
|
+
import { useStyle } from '@magento/venia-ui/lib/classify';
|
|
4
|
+
|
|
5
|
+
import Shimmer from '@magento/venia-ui/lib/components/Shimmer';
|
|
6
|
+
import defaultClasses from '@riosst100/pwa-marketplace/src/components/ShowMore/shopBy';
|
|
7
|
+
import cn from 'classnames';
|
|
8
|
+
import Divider from '@riosst100/pwa-marketplace/src/components/Divider';
|
|
9
|
+
|
|
10
|
+
const ShopBy = props => {
|
|
11
|
+
const classes = useStyle(defaultClasses, props.classes);
|
|
12
|
+
|
|
13
|
+
return (
|
|
14
|
+
<>
|
|
15
|
+
<h1 className='mx-auto relative block text-xl font-bold text-center pt-10 pb-4'><Shimmer width="25%" height="6vh" /></h1>
|
|
16
|
+
<div className='border border-gray-100 px-6'>
|
|
17
|
+
<center>
|
|
18
|
+
<section className='single_list-indexing-container relative m-auto pt-5'>
|
|
19
|
+
<Shimmer width="95%" height="6vh" />
|
|
20
|
+
</section>
|
|
21
|
+
</center>
|
|
22
|
+
<Divider className="mb-5 px-4" />
|
|
23
|
+
<section className='singles-container'>
|
|
24
|
+
<div className={cn('singles-wrapper block -mx-4', classes.singlesWrapper)}>
|
|
25
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
26
|
+
<div className='singles_item_group_letter text-xl font-medium border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
27
|
+
</div>
|
|
28
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
29
|
+
<div className='singles_item_group_letter text-xl font-medium border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
30
|
+
</div>
|
|
31
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
32
|
+
<div className='singles_item_group_letter text-xl font-medium border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
33
|
+
</div>
|
|
34
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
35
|
+
<div className='singles_item_group_letter text-xl font-medium border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
36
|
+
</div>
|
|
37
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
38
|
+
<div className='singles_item_group_letter text-xl font-medium border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
39
|
+
</div>
|
|
40
|
+
<div className='singles_group-wrapper mb-4 px-2 inline-block w-full'>
|
|
41
|
+
<div className='singles_item_group_letter text-xl font-medium border-b border-gray-100 pb-1 mb-2' ><Shimmer width="95%" height="100vh" /></div>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
</section>
|
|
45
|
+
</div>
|
|
46
|
+
</>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export default ShopBy;
|