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

Commit 7b01374

Browse files
Update Active Filters "remove filter" icon to use Icon component (#7035)
* Update "remove filter" icon to use Icon component. To be consistent with the button icon used on the Chips view, this replaces the native svg element used in the List view with the same Icon component from core. * Add proper margin to active filters by price list. There is currently no top margin when the active filters contain a price filter in the list view. This is because the filters only contain a range and do not render a child list. This update will target that price filter item and add a top margin that is consistent with the other active filters.
1 parent 0fecf2b commit 7b01374

File tree

2 files changed

+21
-36
lines changed

2 files changed

+21
-36
lines changed

assets/js/blocks/active-filters/style.scss

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@
127127
max-width: 200px;
128128
}
129129
}
130+
131+
> .wc-block-active-filters__list-item .wc-block-active-filters__list-item-name {
132+
margin: 9px 0 0;
133+
}
130134
}
131135

132136
.wc-block-active-filters__list-item-type {
@@ -151,18 +155,26 @@
151155
}
152156

153157
.wc-block-active-filters__list-item-remove {
154-
background: transparent;
158+
@include font-size(smaller);
159+
background: $gray-200;
155160
border: 0;
161+
border-radius: 25px;
156162
appearance: none;
163+
padding: 0;
157164
height: 16px;
158165
width: 16px;
159166
line-height: 16px;
160167
padding: 0;
161168
margin: 0 0.5em 0 0;
162169
color: currentColor;
163170

164-
&:hover {
165-
color: $gray-600;
171+
&:hover,
172+
&:focus {
173+
background: $gray-600;
174+
175+
.wc-block-components-chip__remove-icon {
176+
fill: #fff;
177+
}
166178
}
167179

168180
&:disabled {

assets/js/blocks/active-filters/utils.tsx

Lines changed: 6 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { RemovableChip } from '@woocommerce/base-components/chip';
77
import Label from '@woocommerce/base-components/label';
88
import { getQueryArgs, addQueryArgs, removeQueryArgs } from '@wordpress/url';
99
import { changeUrl } from '@woocommerce/utils';
10+
import { Icon, closeSmall } from '@wordpress/icons';
1011

1112
/**
1213
* Format a min/max price range to display.
@@ -108,39 +109,11 @@ export const renderRemovableListItem = ( {
108109
className="wc-block-active-filters__list-item-remove"
109110
onClick={ removeCallback }
110111
>
111-
<svg
112-
width="16"
113-
height="16"
114-
viewBox="0 0 16 16"
115-
fill="none"
116-
xmlns="http://www.w3.org/2000/svg"
117-
>
118-
<ellipse
119-
cx="8"
120-
cy="8"
121-
rx="8"
122-
ry="8"
123-
transform="rotate(-180 8 8)"
124-
fill="currentColor"
125-
fillOpacity="0.7"
126-
/>
127-
<rect
128-
x="10.636"
129-
y="3.94983"
130-
width="2"
131-
height="9.9466"
132-
transform="rotate(45 10.636 3.94983)"
133-
fill="white"
134-
/>
135-
<rect
136-
x="12.0503"
137-
y="11.0209"
138-
width="2"
139-
height="9.9466"
140-
transform="rotate(135 12.0503 11.0209)"
141-
fill="white"
142-
/>
143-
</svg>
112+
<Icon
113+
className="wc-block-components-chip__remove-icon"
114+
icon={ closeSmall }
115+
size={ 16 }
116+
/>
144117
<Label screenReaderLabel={ removeText } />
145118
</button>
146119
{ prefixedName }

0 commit comments

Comments
 (0)