Skip to content

Commit

Permalink
[Icon] Add "Magic" colour to the Icon component (#8546)
Browse files Browse the repository at this point in the history
### WHY are these changes introduced?

Fixes [#629](Shopify/storefront-setup#629)

The Icon component doesn't have the "Magic" colour yet, whereas the
tokens are already available for use. We should add "magic" to the
colour prop and the CSS.

### WHAT is this pull request doing?

<img src="https://shopify.click/03-54-46fx7-wqvbe.png" width="300" />

- Added `magic` entry to the Icon color prop type.
- Added corresponding CSS rule.
- Added Storybook variant.

### 🎩 checklist

- [ ] Tested on
[mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing)
N/A
- [x] Tested on [multiple
browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- [ ] Tested for
[accessibility](https://github.com/Shopify/polaris/blob/main/documentation/Accessibility%20testing.md)
N/A
- [ ] Updated the component's `README.md` with documentation changes N/A
- [ ] [Tophatted
documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md)
changes in the style guide N/A
  • Loading branch information
MindRave committed Mar 7, 2023
1 parent 45ca38d commit 8872c08
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/little-doors-search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': major
---

Added "magic" color to the Icon component's color prop type.
5 changes: 5 additions & 0 deletions polaris-react/src/components/Icon/Icon.scss
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@
@include recolor-icon(var(--p-action-primary));
}

.colorMagic {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
@include recolor-icon(var(--p-color-icon-magic));
}

.Svg,
.Img {
// stylelint-disable-next-line -- generated by polaris-migrator DO NOT COPY
Expand Down
1 change: 1 addition & 0 deletions polaris-react/src/components/Icon/Icon.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function Colored() {
<Icon source={CirclePlusMinor} color="success" />
<Icon source={CirclePlusMinor} color="warning" />
<Icon source={CirclePlusMinor} color="critical" />
<Icon source={CirclePlusMinor} color="magic" />
</div>
);
}
Expand Down
3 changes: 2 additions & 1 deletion polaris-react/src/components/Icon/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ type Color =
| 'warning'
| 'highlight'
| 'success'
| 'primary';
| 'primary'
| 'magic';

const COLORS_WITH_BACKDROPS = [
'base',
Expand Down

0 comments on commit 8872c08

Please sign in to comment.