Skip to content

Commit 14a9496

Browse files
authored
[Icon] Add support for emphasis and text tones and migrated color custom properties (#10722)
### WHY are these changes introduced? Resolves #10486. Adds support for net new tones on `Icon` component `tone` prop. ### WHAT is this pull request doing? Adds `emphasis` and `text` tones to `Icon`. Migrates `primary` and `subdued` color custom properties. ### How to 🎩 [Storybook](https://5d559397bae39100201eedc1-sbgcrlbgjk.chromatic.com/?path=/story/all-components-icon--colored) 🖥 [Local development instructions](https://github.com/Shopify/polaris/blob/main/README.md#local-development) 🗒 [General tophatting guidelines](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md) 📄 [Changelog guidelines](https://github.com/Shopify/polaris/blob/main/.github/CONTRIBUTING.md#changelog) ### 🎩 checklist - [x] Tested on [mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing) - [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) - [ ] Updated the component's `README.md` with documentation changes - [ ] [Tophatted documentation](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting%20documentation.md) changes in the style guide
1 parent e9192f8 commit 14a9496

File tree

4 files changed

+110
-6
lines changed

4 files changed

+110
-6
lines changed

.changeset/five-cooks-fly.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/polaris': minor
3+
---
4+
5+
Added support for `emphasis` and `text` tones on `Icon` and migrated `primary` and `subdued` tone color tokens

polaris-react/src/components/Icon/Icon.scss

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
}
1919

2020
.toneSubdued svg {
21-
fill: var(--p-color-icon-subdued);
21+
fill: var(--p-color-icon-secondary);
2222
}
2323

2424
.toneCaution svg {
@@ -46,13 +46,45 @@
4646
}
4747

4848
.tonePrimary svg {
49-
fill: var(--p-color-icon-primary);
49+
fill: var(--p-color-icon-brand);
50+
}
51+
52+
.toneEmphasis svg {
53+
fill: var(--p-color-icon-emphasis);
5054
}
5155

5256
.toneMagic svg {
5357
fill: var(--p-color-icon-magic);
5458
}
5559

60+
.toneTextCaution svg {
61+
fill: var(--p-color-text-caution);
62+
}
63+
64+
.toneTextWarning svg {
65+
fill: var(--p-color-text-warning);
66+
}
67+
68+
.toneTextCritical svg {
69+
fill: var(--p-color-text-critical);
70+
}
71+
72+
.toneTextInfo svg {
73+
fill: var(--p-color-text-info);
74+
}
75+
76+
.toneTextPrimary svg {
77+
fill: var(--p-color-text-brand);
78+
}
79+
80+
.toneTextSuccess svg {
81+
fill: var(--p-color-text-success);
82+
}
83+
84+
.toneTextMagic svg {
85+
fill: var(--p-color-text-magic);
86+
}
87+
5688
.Svg,
5789
.Img {
5890
position: relative;

polaris-react/src/components/Icon/Icon.stories.tsx

Lines changed: 62 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from 'react';
22
import type {ComponentMeta} from '@storybook/react';
3-
import {Icon} from '@shopify/polaris';
3+
import {Icon, Text, BlockStack} from '@shopify/polaris';
44
import {CirclePlusMinor} from '@shopify/polaris-icons';
55

66
export default {
@@ -13,17 +13,76 @@ export function Default() {
1313

1414
export function Colored() {
1515
return (
16-
<div>
16+
<BlockStack gap="2">
17+
<Text as="p" variant="bodyMd" alignment="center">
18+
Base tone
19+
</Text>
1720
<Icon source={CirclePlusMinor} tone="base" />
21+
<Text as="p" variant="bodyMd" alignment="center">
22+
Subdued tone
23+
</Text>
1824
<Icon source={CirclePlusMinor} tone="subdued" />
25+
<Text as="p" variant="bodyMd" alignment="center">
26+
Primary tone
27+
</Text>
1928
<Icon source={CirclePlusMinor} tone="primary" />
29+
<Text as="p" variant="bodyMd" alignment="center">
30+
Info tone
31+
</Text>
2032
<Icon source={CirclePlusMinor} tone="info" />
33+
<Text as="p" variant="bodyMd" alignment="center">
34+
Success tone
35+
</Text>
2136
<Icon source={CirclePlusMinor} tone="success" />
37+
<Text as="p" variant="bodyMd" alignment="center">
38+
Caution tone
39+
</Text>
2240
<Icon source={CirclePlusMinor} tone="caution" />
41+
<Text as="p" variant="bodyMd" alignment="center">
42+
Warning tone
43+
</Text>
2344
<Icon source={CirclePlusMinor} tone="warning" />
45+
<Text as="p" variant="bodyMd" alignment="center">
46+
Critical tone
47+
</Text>
2448
<Icon source={CirclePlusMinor} tone="critical" />
49+
<Text as="p" variant="bodyMd" alignment="center">
50+
Emphasis tone
51+
</Text>
52+
<Icon source={CirclePlusMinor} tone="emphasis" />
53+
<Text as="p" variant="bodyMd" alignment="center">
54+
Magic tone
55+
</Text>
2556
<Icon source={CirclePlusMinor} tone="magic" />
26-
</div>
57+
<Text as="p" variant="bodyMd" alignment="center">
58+
Text Primary tone
59+
</Text>
60+
<Icon source={CirclePlusMinor} tone="textPrimary" />
61+
<Text as="p" variant="bodyMd" alignment="center">
62+
Text Caution tone
63+
</Text>
64+
<Icon source={CirclePlusMinor} tone="textCaution" />
65+
<Text as="p" variant="bodyMd" alignment="center">
66+
Text Warning tone
67+
</Text>
68+
<Icon source={CirclePlusMinor} tone="textWarning" />
69+
<Text as="p" variant="bodyMd" alignment="center">
70+
Text Critical tone
71+
</Text>
72+
<Icon source={CirclePlusMinor} tone="textCritical" />
73+
<Text as="p" variant="bodyMd" alignment="center">
74+
Text Info tone
75+
</Text>
76+
<Icon source={CirclePlusMinor} tone="textInfo" />
77+
<Text as="p" variant="bodyMd" alignment="center">
78+
Text Success tone
79+
</Text>
80+
<Icon source={CirclePlusMinor} tone="textSuccess" />
81+
<Text as="p" variant="bodyMd" alignment="center">
82+
Text Magic tone
83+
</Text>
84+
<Icon source={CirclePlusMinor} tone="textMagic" />
85+
</BlockStack>
2786
);
2887
}
2988

polaris-react/src/components/Icon/Icon.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@ type Tone =
1616
| 'info'
1717
| 'success'
1818
| 'primary'
19-
| 'magic';
19+
| 'emphasis'
20+
| 'magic'
21+
| 'textCaution'
22+
| 'textWarning'
23+
| 'textCritical'
24+
| 'textInfo'
25+
| 'textSuccess'
26+
| 'textPrimary'
27+
| 'textMagic';
2028

2129
export interface IconProps {
2230
/** The SVG contents to display in the icon (icons should fit in a 20 × 20 pixel viewBox) */

0 commit comments

Comments
 (0)