Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Attribute, Rating and Stock filters: Fix the dropdown indicator icon display #8080

Merged
merged 3 commits into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion assets/js/blocks/attribute-filter/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,10 @@ const AttributeFilterBlock = ( {
return null;
}

const showChevron = multiple
? ! isLoading && checked.length < displayedOptions.length
: ! isLoading && checked.length === 0;

const heading = (
<TagName className="wc-block-attribute-filter__title">
{ blockAttributes.heading }
Expand Down Expand Up @@ -666,7 +670,7 @@ const AttributeFilterBlock = ( {
),
} }
/>
{ multiple && (
{ showChevron && (
<Icon icon={ chevronDown } size={ 30 } />
) }
</>
Expand Down
6 changes: 5 additions & 1 deletion assets/js/blocks/rating-filter/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ const RatingFilterBlock = ( {

const multiple = blockAttributes.selectType !== 'single';

const showChevron = multiple
? ! isLoading && checked.length < displayedOptions.length
: ! isLoading && checked.length === 0;

const onSubmit = useCallback(
( checkedOptions ) => {
if ( isEditor ) {
Expand Down Expand Up @@ -466,7 +470,7 @@ const RatingFilterBlock = ( {
),
} }
/>
{ multiple && (
{ showChevron && (
<Icon icon={ chevronDown } size={ 30 } />
) }
</>
Expand Down
6 changes: 5 additions & 1 deletion assets/js/blocks/stock-filter/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,10 @@ const StockStatusFilterBlock = ( {
return null;
}

const showChevron = allowsMultipleOptions
? ! isLoading && checked.length < displayedOptions.length
: ! isLoading && checked.length === 0;

const heading = (
<TagName className="wc-block-stock-filter__title">
{ blockAttributes.heading }
Expand Down Expand Up @@ -500,7 +504,7 @@ const StockStatusFilterBlock = ( {
),
} }
/>
{ allowsMultipleOptions && (
{ showChevron && (
<Icon icon={ chevronDown } size={ 30 } />
) }
</>
Expand Down