Skip to content

Commit

Permalink
[ProgressBar] Rename color to tone (Shopify#10051)
Browse files Browse the repository at this point in the history
### WHY are these changes introduced?

Fixes Shopify#10049 

### WHAT is this pull request doing?

- Renames the `color` prop to `tone`
- Remove existing `color` prop
  • Loading branch information
aveline committed Aug 17, 2023
1 parent ce6f75b commit 537dabf
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/healthy-boxes-wave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/polaris': major
---

Renamed `color` prop to `tone` for `ProgressBar` component
8 changes: 4 additions & 4 deletions polaris-react/src/components/ProgressBar/ProgressBar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
height: progress-bar-height(large);
}

.colorHighlight {
.toneHighlight {
// stylelint-disable -- Polaris component custom properties
--pc-progress-bar-background: var(--p-color-bg-strong);
--pc-progress-bar-indicator: var(--p-color-border-info);
Expand All @@ -47,14 +47,14 @@
}
}

.colorPrimary {
.tonePrimary {
// stylelint-disable -- Polaris component custom properties
--pc-progress-bar-background: var(--p-color-bg-strong);
--pc-progress-bar-indicator: var(--p-color-bg-primary);
// stylelint-enable
}

.colorSuccess {
.toneSuccess {
// stylelint-disable -- Polaris component custom properties
--pc-progress-bar-background: var(--p-color-bg-strong);
--pc-progress-bar-indicator: var(--p-color-border-success);
Expand All @@ -66,7 +66,7 @@
}
}

.colorCritical {
.toneCritical {
// stylelint-disable -- Polaris component custom properties
--pc-progress-bar-background: var(--p-color-bg-strong);
--pc-progress-bar-indicator: var(--p-color-bg-critical);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ export function Small() {
export function WithColors() {
return (
<div>
<ProgressBar progress={70} color="primary" />
<ProgressBar progress={70} tone="primary" />
<br />
<ProgressBar progress={30} color="success" />
<ProgressBar progress={30} tone="success" />
<br />
<ProgressBar progress={30} color="critical" />
<ProgressBar progress={30} tone="critical" />
<br />
<ProgressBar progress={30} color="highlight" />
<ProgressBar progress={30} tone="highlight" />
</div>
);
}
Expand Down
16 changes: 8 additions & 8 deletions polaris-react/src/components/ProgressBar/ProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {useI18n} from '../../utilities/i18n';
import styles from './ProgressBar.scss';

type Size = 'small' | 'medium' | 'large';
type Color = 'highlight' | 'primary' | 'success' | 'critical';
type Tone = 'highlight' | 'primary' | 'success' | 'critical';

export interface ProgressBarProps {
/**
Expand All @@ -21,11 +21,6 @@ export interface ProgressBarProps {
* @default 'medium'
*/
size?: Size;
/**
* Color of progressbar
* @default 'highlight'
*/
color?: Color;
/**
* Whether the fill animation is triggered
* @default 'true'
Expand All @@ -35,12 +30,17 @@ export interface ProgressBarProps {
* Id (ids) of element (elements) that describes progressbar
*/
ariaLabelledBy?: string;
/**
* Color of progressbar
* @default 'highlight'
*/
tone?: Tone;
}

export function ProgressBar({
progress = 0,
size = 'medium',
color = 'highlight',
tone = 'highlight',
animated: hasAppearAnimation = true,
ariaLabelledBy,
}: ProgressBarProps) {
Expand All @@ -50,7 +50,7 @@ export function ProgressBar({
const className = classNames(
styles.ProgressBar,
size && styles[variationName('size', size)],
color && styles[variationName('color', color)],
tone && styles[variationName('tone', tone)],
);

const warningMessage = i18n.translate(
Expand Down
4 changes: 2 additions & 2 deletions polaris.shopify.com/pages/examples/progress-bar-colored.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {withPolarisExample} from '../../src/components/PolarisExampleWrapper';
function ProgressBarExample() {
return (
<div style={{width: 225}}>
<ProgressBar progress={70} color="primary" />
<ProgressBar progress={70} tone="primary" />
<br />
<ProgressBar progress={30} color="success" />
<ProgressBar progress={30} tone="success" />
</div>
);
}
Expand Down

0 comments on commit 537dabf

Please sign in to comment.