@riosst100/pwa-marketplace 1.5.8 → 1.5.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/FilterTop/CustomFilters/customFilter.js +0 -3
- package/src/overwrites/peregrine/lib/talons/FilterSidebar/useFilterSidebar.js +2 -2
- package/src/overwrites/peregrine/lib/talons/RootComponents/Category/useCategoryContent.js +3 -1
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItem.js +2 -1
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItemRadio.js +7 -4
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItemRadioGroup.js +2 -1
- package/src/overwrites/venia-ui/lib/components/FilterSidebar/filterSidebar.js +29 -1
package/package.json
CHANGED
|
@@ -140,8 +140,8 @@ export const useFilterSidebar = props => {
|
|
|
140
140
|
// Add frontend input type
|
|
141
141
|
frontendInput.set(group, null);
|
|
142
142
|
// add items
|
|
143
|
-
for (const { label, value } of options) {
|
|
144
|
-
items.push({ title: stripHtml(label), value });
|
|
143
|
+
for (const { label, value, path } of options) {
|
|
144
|
+
items.push({ title: stripHtml(label), value, path });
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
itemsByGroup.set(group, items);
|
|
@@ -106,7 +106,8 @@ export const useCategoryContent = props => {
|
|
|
106
106
|
children && children.map((category, index) => {
|
|
107
107
|
filterOptions.push({
|
|
108
108
|
'label': category.name,
|
|
109
|
-
'value': category.uid
|
|
109
|
+
'value': category.uid,
|
|
110
|
+
'path': category.url_path
|
|
110
111
|
});
|
|
111
112
|
});
|
|
112
113
|
|
|
@@ -117,6 +118,7 @@ export const useCategoryContent = props => {
|
|
|
117
118
|
attribute_code: filter.attribute_code,
|
|
118
119
|
count: filter.count,
|
|
119
120
|
label: label,
|
|
121
|
+
position: filter.position,
|
|
120
122
|
options: filterOptions.length ? filterOptions : filter.options
|
|
121
123
|
};
|
|
122
124
|
|
|
@@ -26,9 +26,11 @@ const FilterItemRadio = props => {
|
|
|
26
26
|
|
|
27
27
|
const handleOnchange = useCallback(
|
|
28
28
|
e => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
if (group != "category_uid") {
|
|
30
|
+
removeGroup({ group });
|
|
31
|
+
if (e.target.value === item.value) {
|
|
32
|
+
toggleItem({ group, item });
|
|
33
|
+
}
|
|
32
34
|
}
|
|
33
35
|
if (typeof onApply === 'function') {
|
|
34
36
|
onApply(group, item);
|
|
@@ -67,7 +69,8 @@ FilterItemRadio.propTypes = {
|
|
|
67
69
|
item: shape({
|
|
68
70
|
title: string.isRequired,
|
|
69
71
|
value: oneOfType([number, string]).isRequired,
|
|
70
|
-
label: string
|
|
72
|
+
label: string,
|
|
73
|
+
path: string
|
|
71
74
|
}).isRequired,
|
|
72
75
|
onApply: func,
|
|
73
76
|
labels: instanceOf(Map).isRequired
|
|
@@ -10,6 +10,8 @@ import FilterBlock from '@riosst100/pwa-marketplace/src/overwrites/venia-ui/lib/
|
|
|
10
10
|
import defaultClasses from './filterSidebar.module.css';
|
|
11
11
|
import { Filter } from 'iconsax-react';
|
|
12
12
|
import cn from 'classnames';
|
|
13
|
+
import { useHistory } from 'react-router-dom';
|
|
14
|
+
|
|
13
15
|
|
|
14
16
|
const SCROLL_OFFSET = 150;
|
|
15
17
|
|
|
@@ -52,6 +54,30 @@ const FilterSidebar = props => {
|
|
|
52
54
|
[handleApply, filterRef]
|
|
53
55
|
);
|
|
54
56
|
|
|
57
|
+
const history = useHistory();
|
|
58
|
+
|
|
59
|
+
const handleCategoryApplyFilter = useCallback(
|
|
60
|
+
(...args) => {
|
|
61
|
+
// const filterElement = filterRef.current;
|
|
62
|
+
// if (
|
|
63
|
+
// filterElement &&
|
|
64
|
+
// typeof filterElement.getBoundingClientRect === 'function'
|
|
65
|
+
// ) {
|
|
66
|
+
// const filterTop = filterElement.getBoundingClientRect().top;
|
|
67
|
+
// const windowScrollY =
|
|
68
|
+
// window.scrollY + filterTop - SCROLL_OFFSET;
|
|
69
|
+
// window.scrollTo(0, windowScrollY);
|
|
70
|
+
// }
|
|
71
|
+
|
|
72
|
+
history.push('/'+args[1].path+'.html');
|
|
73
|
+
|
|
74
|
+
if (args[0] != "category_uid") {
|
|
75
|
+
handleApply(...args);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
[handleApply, filterRef]
|
|
79
|
+
);
|
|
80
|
+
|
|
55
81
|
const allowedFiltersArr = [];
|
|
56
82
|
|
|
57
83
|
allowedFilters.length && allowedFilters.map((val, index) => {
|
|
@@ -65,6 +91,8 @@ const FilterSidebar = props => {
|
|
|
65
91
|
const groupName = filterNames.get(group);
|
|
66
92
|
const frontendInput = filterFrontendInput.get(group);
|
|
67
93
|
if (!allowedFiltersArr.length && group != "category_uid" || allowedFiltersArr.length && allowedFiltersArr.includes(group)) {
|
|
94
|
+
|
|
95
|
+
|
|
68
96
|
return (
|
|
69
97
|
<FilterBlock
|
|
70
98
|
key={group}
|
|
@@ -74,7 +102,7 @@ const FilterSidebar = props => {
|
|
|
74
102
|
group={group}
|
|
75
103
|
items={items}
|
|
76
104
|
name={groupName}
|
|
77
|
-
onApply={handleApplyFilter}
|
|
105
|
+
onApply={group == "category_uid" ? handleCategoryApplyFilter : handleApplyFilter}
|
|
78
106
|
initialOpen={iteration < filterCountToOpen}
|
|
79
107
|
/>
|
|
80
108
|
);
|