Skip to content

Commit 69edd97

Browse files
authored
[ProgressBar] Rename color to tone (#10051)
### WHY are these changes introduced? Fixes #10049 ### WHAT is this pull request doing? - Renames the `color` prop to `tone` - Remove existing `color` prop
1 parent 8f927f7 commit 69edd97

File tree

5 files changed

+23
-18
lines changed

5 files changed

+23
-18
lines changed

.changeset/healthy-boxes-wave.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/polaris': major
3+
---
4+
5+
Renamed `color` prop to `tone` for `ProgressBar` component

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
height: progress-bar-height(large);
3636
}
3737

38-
.colorHighlight {
38+
.toneHighlight {
3939
// stylelint-disable -- Polaris component custom properties
4040
--pc-progress-bar-background: var(--p-color-bg-strong);
4141
--pc-progress-bar-indicator: var(--p-color-border-info);
@@ -47,14 +47,14 @@
4747
}
4848
}
4949

50-
.colorPrimary {
50+
.tonePrimary {
5151
// stylelint-disable -- Polaris component custom properties
5252
--pc-progress-bar-background: var(--p-color-bg-strong);
5353
--pc-progress-bar-indicator: var(--p-color-bg-primary);
5454
// stylelint-enable
5555
}
5656

57-
.colorSuccess {
57+
.toneSuccess {
5858
// stylelint-disable -- Polaris component custom properties
5959
--pc-progress-bar-background: var(--p-color-bg-strong);
6060
--pc-progress-bar-indicator: var(--p-color-border-success);
@@ -66,7 +66,7 @@
6666
}
6767
}
6868

69-
.colorCritical {
69+
.toneCritical {
7070
// stylelint-disable -- Polaris component custom properties
7171
--pc-progress-bar-background: var(--p-color-bg-strong);
7272
--pc-progress-bar-indicator: var(--p-color-bg-critical);

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ export function Small() {
1717
export function WithColors() {
1818
return (
1919
<div>
20-
<ProgressBar progress={70} color="primary" />
20+
<ProgressBar progress={70} tone="primary" />
2121
<br />
22-
<ProgressBar progress={30} color="success" />
22+
<ProgressBar progress={30} tone="success" />
2323
<br />
24-
<ProgressBar progress={30} color="critical" />
24+
<ProgressBar progress={30} tone="critical" />
2525
<br />
26-
<ProgressBar progress={30} color="highlight" />
26+
<ProgressBar progress={30} tone="highlight" />
2727
</div>
2828
);
2929
}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {useI18n} from '../../utilities/i18n';
88
import styles from './ProgressBar.scss';
99

1010
type Size = 'small' | 'medium' | 'large';
11-
type Color = 'highlight' | 'primary' | 'success' | 'critical';
11+
type Tone = 'highlight' | 'primary' | 'success' | 'critical';
1212

1313
export interface ProgressBarProps {
1414
/**
@@ -21,11 +21,6 @@ export interface ProgressBarProps {
2121
* @default 'medium'
2222
*/
2323
size?: Size;
24-
/**
25-
* Color of progressbar
26-
* @default 'highlight'
27-
*/
28-
color?: Color;
2924
/**
3025
* Whether the fill animation is triggered
3126
* @default 'true'
@@ -35,12 +30,17 @@ export interface ProgressBarProps {
3530
* Id (ids) of element (elements) that describes progressbar
3631
*/
3732
ariaLabelledBy?: string;
33+
/**
34+
* Color of progressbar
35+
* @default 'highlight'
36+
*/
37+
tone?: Tone;
3838
}
3939

4040
export function ProgressBar({
4141
progress = 0,
4242
size = 'medium',
43-
color = 'highlight',
43+
tone = 'highlight',
4444
animated: hasAppearAnimation = true,
4545
ariaLabelledBy,
4646
}: ProgressBarProps) {
@@ -50,7 +50,7 @@ export function ProgressBar({
5050
const className = classNames(
5151
styles.ProgressBar,
5252
size && styles[variationName('size', size)],
53-
color && styles[variationName('color', color)],
53+
tone && styles[variationName('tone', tone)],
5454
);
5555

5656
const warningMessage = i18n.translate(

polaris.shopify.com/pages/examples/progress-bar-colored.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';
55
function ProgressBarExample() {
66
return (
77
<div style={{width: 225}}>
8-
<ProgressBar progress={70} color="primary" />
8+
<ProgressBar progress={70} tone="primary" />
99
<br />
10-
<ProgressBar progress={30} color="success" />
10+
<ProgressBar progress={30} tone="success" />
1111
</div>
1212
);
1313
}

0 commit comments

Comments
 (0)