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

Commit

Permalink
Update "remove filter" icon to use Icon component.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
danielwrobert committed Sep 9, 2022
1 parent 0fecf2b commit 1ab83d5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 36 deletions.
14 changes: 11 additions & 3 deletions assets/js/blocks/active-filters/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -151,18 +151,26 @@
}

.wc-block-active-filters__list-item-remove {
background: transparent;
@include font-size(smaller);
background: $gray-200;
border: 0;
border-radius: 25px;
appearance: none;
padding: 0;
height: 16px;
width: 16px;
line-height: 16px;
padding: 0;
margin: 0 0.5em 0 0;
color: currentColor;

&:hover {
color: $gray-600;
&:hover,
&:focus {
background: $gray-600;

.wc-block-components-chip__remove-icon {
fill: #fff;
}
}

&:disabled {
Expand Down
39 changes: 6 additions & 33 deletions assets/js/blocks/active-filters/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { RemovableChip } from '@woocommerce/base-components/chip';
import Label from '@woocommerce/base-components/label';
import { getQueryArgs, addQueryArgs, removeQueryArgs } from '@wordpress/url';
import { changeUrl } from '@woocommerce/utils';
import { Icon, closeSmall } from '@wordpress/icons';

/**
* Format a min/max price range to display.
Expand Down Expand Up @@ -108,39 +109,11 @@ export const renderRemovableListItem = ( {
className="wc-block-active-filters__list-item-remove"
onClick={ removeCallback }
>
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<ellipse
cx="8"
cy="8"
rx="8"
ry="8"
transform="rotate(-180 8 8)"
fill="currentColor"
fillOpacity="0.7"
/>
<rect
x="10.636"
y="3.94983"
width="2"
height="9.9466"
transform="rotate(45 10.636 3.94983)"
fill="white"
/>
<rect
x="12.0503"
y="11.0209"
width="2"
height="9.9466"
transform="rotate(135 12.0503 11.0209)"
fill="white"
/>
</svg>
<Icon
className="wc-block-components-chip__remove-icon"
icon={ closeSmall }
size={ 16 }
/>
<Label screenReaderLabel={ removeText } />
</button>
{ prefixedName }
Expand Down

0 comments on commit 1ab83d5

Please sign in to comment.