@riosst100/pwa-marketplace 2.3.5 → 2.3.7
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/SetsData/setsData.js +15 -5
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItemRadioGroup.js +7 -3
- package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterList.js +3 -0
- package/src/talons/SetsData/setsData.gql.js +1 -0
package/package.json
CHANGED
|
@@ -127,17 +127,27 @@ const SetsData = props => {
|
|
|
127
127
|
|
|
128
128
|
if (sets.length) {
|
|
129
129
|
sets.map((set, index) => {
|
|
130
|
-
const { set_name, option_id, release_year } = set;
|
|
130
|
+
const { products_count, set_name, option_id, release_year } = set;
|
|
131
|
+
|
|
132
|
+
console.log(products_count)
|
|
131
133
|
|
|
132
134
|
const categoryUrl = resourceUrl(
|
|
133
135
|
`/${category?.url_path}${categoryUrlSuffix || ''}${filterSearch || ''}&${attributeCode}[filter]=${set_name},${option_id}`
|
|
134
136
|
);
|
|
135
137
|
|
|
136
|
-
|
|
137
|
-
<
|
|
138
|
-
{
|
|
139
|
-
|
|
138
|
+
if (parseInt(products_count) > 0) {
|
|
139
|
+
setsResult.push(<li className='list-none'>
|
|
140
|
+
<Link to={categoryUrl} className="hover_bg-darkblue-900 hover_text-white w-full block text-[14px] py-[2px] px-0">
|
|
141
|
+
{set_name} <span className='text-[12px]'>({products_count})</span>
|
|
142
|
+
</Link>
|
|
143
|
+
</li>)
|
|
144
|
+
} else {
|
|
145
|
+
setsResult.push(<li className='list-none'>
|
|
146
|
+
<span className="text-[#8f8f8f] w-full block text-[14px] py-[2px] px-0">
|
|
147
|
+
{set_name} <span className='text-[12px]'>({products_count})</span>
|
|
148
|
+
</span>
|
|
140
149
|
</li>)
|
|
150
|
+
}
|
|
141
151
|
})
|
|
142
152
|
}
|
|
143
153
|
|
package/src/overwrites/venia-ui/lib/components/FilterModal/FilterList/filterItemRadioGroup.js
CHANGED
|
@@ -15,10 +15,14 @@ import { useFieldApi } from 'informed';
|
|
|
15
15
|
import useFieldState from '@magento/peregrine/lib/hooks/hook-wrappers/useInformedFieldStateWrapper';
|
|
16
16
|
|
|
17
17
|
const FilterItemRadioGroup = props => {
|
|
18
|
-
const { filterApi, filterState, group, items, onApply, labels } = props;
|
|
18
|
+
const { filterApi, filterState, group, items, onApply, labels,isListExpanded = true, itemCountToShow = 5 } = props;
|
|
19
19
|
|
|
20
20
|
const radioItems = useMemo(() => {
|
|
21
|
-
return items.map(item => {
|
|
21
|
+
return items.map((item,index) => {
|
|
22
|
+
if (!isListExpanded && index >= itemCountToShow) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
const code = `item-${group}-${item.value}`;
|
|
23
27
|
return (
|
|
24
28
|
<FilterItemRadio
|
|
@@ -32,7 +36,7 @@ const FilterItemRadioGroup = props => {
|
|
|
32
36
|
/>
|
|
33
37
|
);
|
|
34
38
|
});
|
|
35
|
-
}, [filterApi, filterState, group, items, labels, onApply]);
|
|
39
|
+
}, [filterApi, filterState, group, items, labels, onApply,isListExpanded,itemCountToShow]);
|
|
36
40
|
|
|
37
41
|
const fieldValue = useMemo(() => {
|
|
38
42
|
if (filterState) {
|
|
@@ -103,6 +103,7 @@ const FilterList = props => {
|
|
|
103
103
|
// search value is not referenced, so this array is stable
|
|
104
104
|
const itemElements = useMemo(() => {
|
|
105
105
|
// if (filterFrontendInput === 'boolean') {
|
|
106
|
+
|
|
106
107
|
const key = `item-${group}`;
|
|
107
108
|
return (
|
|
108
109
|
<li
|
|
@@ -118,6 +119,8 @@ const FilterList = props => {
|
|
|
118
119
|
items={items}
|
|
119
120
|
onApply={onApply}
|
|
120
121
|
labels={labels}
|
|
122
|
+
isListExpanded={isListExpanded}
|
|
123
|
+
itemCountToShow={itemCountToShow}
|
|
121
124
|
/>
|
|
122
125
|
</li>
|
|
123
126
|
);
|