Skip to content

Commit f08b28e

Browse files
authored
fix: add paused state to progress (#2197)
* fix: add paused state to progress
1 parent 265ccd9 commit f08b28e

File tree

6 files changed

+58
-4
lines changed

6 files changed

+58
-4
lines changed

packages/fast-components-class-name-contracts-msft/src/progress/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ export interface ProgressClassNameContract extends BaseProgressClassNameContract
99
*/
1010
progress__circular?: string;
1111

12+
/**
13+
* The root progress paused modifier
14+
*/
15+
progress__paused?: string;
16+
1217
/**
1318
* The progress size control modifier
1419
*/

packages/fast-components-react-msft/src/progress/progress.props.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,17 @@ export interface ProgressHandledProps
2323
extends Subtract<BaseProgressHandledProps, BaseProgressManagedClasses>,
2424
ProgressManagedClasses {
2525
/**
26-
* The progess circular prop
26+
* The progress circular prop
2727
*/
2828
circular?: boolean;
2929

3030
/**
31-
* The progess size prop
31+
* The progress paused prop
32+
*/
33+
paused?: boolean;
34+
35+
/**
36+
* The progress size prop
3237
*/
3338
size?: ProgressSize;
3439
}

packages/fast-components-react-msft/src/progress/progress.schema.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ export default {
2323
type: "boolean",
2424
default: false,
2525
},
26+
paused: {
27+
title: "Paused",
28+
type: "boolean",
29+
default: false,
30+
},
2631
size: {
2732
title: "Circular progress size",
2833
type: "string",

packages/fast-components-react-msft/src/progress/progress.spec.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ configure({ adapter: new Adapter() });
1414
const managedClasses: ProgressClassNameContract = {
1515
progress: "progress-class",
1616
progress__circular: "progress__circular-class",
17+
progress__paused: "progress__paused-class",
1718
progress_circularSVG__control: "progress_circularSVG__control-class",
1819
progress_circularSVG__container: "progress_circularSVG__container-class",
1920
progress_circularSVG__page: "progress_circularSVG__page-class",
@@ -67,6 +68,14 @@ describe("progress", (): void => {
6768
expect(rendered.exists("div.progress__circular-class")).toBe(true);
6869
});
6970

71+
test("should use paused class names when paused prop is set to true", () => {
72+
const rendered: any = mount(
73+
<MSFTProgress managedClasses={managedClasses} paused={true} />
74+
);
75+
76+
expect(rendered.exists("div.progress__paused-class")).toBe(true);
77+
});
78+
7079
test("should use not use interdeterminate class names when value prop is set", () => {
7180
const rendered: any = shallow(
7281
<MSFTProgress managedClasses={managedClasses} circular={true} value={75} />

packages/fast-components-react-msft/src/progress/progress.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class Progress extends Foundation<ProgressHandledProps, ProgressUnhandledProps,
1919
minValue: 0,
2020
maxValue: 100,
2121
circular: false,
22+
paused: false,
2223
size: ProgressSize.container,
2324
managedClasses: {},
2425
};
@@ -34,6 +35,7 @@ class Progress extends Foundation<ProgressHandledProps, ProgressUnhandledProps,
3435
maxValue: void 0,
3536
managedClasses: void 0,
3637
circular: void 0,
38+
paused: void 0,
3739
size: void 0,
3840
};
3941

@@ -62,10 +64,15 @@ class Progress extends Foundation<ProgressHandledProps, ProgressUnhandledProps,
6264
const {
6365
progress,
6466
progress__circular,
67+
progress__paused,
6568
}: Partial<ProgressClassNameContract> = this.props.managedClasses;
6669

6770
return super.generateClassNames(
68-
classNames(progress, [progress__circular, this.props.circular])
71+
classNames(
72+
progress,
73+
[progress__circular, this.props.circular],
74+
[progress__paused, this.props.paused]
75+
)
6976
);
7077
}
7178

packages/fast-components-styles-msft/src/progress/index.ts

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import designSystemDefaults, {
44
} from "../design-system";
55
import { ComponentStyles, ComponentStyleSheet } from "@microsoft/fast-jss-manager";
66
import { ProgressClassNameContract } from "@microsoft/fast-components-class-name-contracts-msft";
7-
import { accentFillRest, neutralFillRest } from "../utilities/color";
7+
import {
8+
accentFillRest,
9+
neutralFillRest,
10+
neutralForegroundHint,
11+
} from "../utilities/color";
812
import { multiply, toPx } from "@microsoft/fast-jss-utilities";
913
import { designUnit } from "../utilities/design-system";
1014
import { glyphSize, height, heightNumber } from "../utilities/density";
@@ -44,6 +48,25 @@ const styles: ComponentStyles<ProgressClassNameContract, DesignSystem> = {
4448
},
4549
},
4650
},
51+
progress__paused: {
52+
"& $progress_valueIndicator": {
53+
background: neutralForegroundHint,
54+
stroke: neutralForegroundHint,
55+
},
56+
"& $progress_dot": {
57+
"background-color": neutralFillRest,
58+
},
59+
"& $progress_dot__1": {
60+
"animation-play-state": "paused",
61+
},
62+
"& $progress_dot__2": {
63+
"animation-play-state": "paused",
64+
},
65+
"& $progress_valueIndicator__indeterminate": {
66+
"animation-play-state": "paused",
67+
stroke: neutralFillRest,
68+
},
69+
},
4770
progress_circularSVG__control: {
4871
height: glyphSize,
4972
width: glyphSize,

0 commit comments

Comments
 (0)