Skip to content

Commit e4d2bef

Browse files
mmalerbajelbourn
authored andcommitted
fix(progress-circle, progress-bar): bind color via [color] rather than [attr.color] (#2299)
* fix(progress-circle, progress-bar): bind color via [color] rather than [attr.color] * fix typo
1 parent b16031a commit e4d2bef

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

src/lib/progress-bar/_progress-bar-theme.scss

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,11 @@
1515
background-color: md-color($primary, 100);
1616
}
1717

18-
md-progress-bar[color='accent'] {
18+
.md-progress-bar-fill::after {
19+
background-color: md-color($primary, 600);
20+
}
21+
22+
md-progress-bar.md-accent {
1923
.md-progress-bar-background {
2024
background: #{_md-progress-bar-buffer($accent, 100)};
2125
}
@@ -28,7 +32,7 @@
2832
}
2933
}
3034

31-
md-progress-bar[color='warn'] {
35+
md-progress-bar.md-warn {
3236
.md-progress-bar-background {
3337
background: #{_md-progress-bar-buffer($warn, 100)};
3438
}
@@ -40,10 +44,6 @@
4044
background-color: md-color($warn, 600);
4145
}
4246
}
43-
44-
.md-progress-bar-fill::after {
45-
background-color: md-color($primary, 600);
46-
}
4747
}
4848

4949
// TODO(josephperrott): Find better way to inline svgs.

src/lib/progress-bar/progress-bar.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ import {DefaultStyleCompatibilityModeModule} from '../core/compatibility/default
2323
'role': 'progressbar',
2424
'aria-valuemin': '0',
2525
'aria-valuemax': '100',
26+
'[class.md-primary]': 'color == "primary"',
27+
'[class.md-accent]': 'color == "accent"',
28+
'[class.md-warn]': 'color == "warn"',
2629
},
2730
templateUrl: 'progress-bar.html',
2831
styleUrls: ['progress-bar.css'],
@@ -32,6 +35,8 @@ export class MdProgressBar {
3235
/** Value of the progressbar. Defaults to zero. Mirrored to aria-valuenow. */
3336
private _value: number = 0;
3437

38+
@Input() color: 'primary' | 'accent' | 'warn' = 'primary';
39+
3540
@Input()
3641
@HostBinding('attr.aria-valuenow')
3742
get value() {

src/lib/progress-circle/_progress-circle-theme.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@
1212
stroke: md-color($primary, 600);
1313
}
1414

15-
&[color='accent'] path {
15+
&.md-accent path {
1616
stroke: md-color($accent, 600);
1717
}
1818

19-
&[color='warn'] path {
19+
&.md-warn path {
2020
stroke: md-color($warn, 600);
2121
}
2222
}

src/lib/progress-circle/progress-circle.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ type EasingFn = (currentTime: number, startValue: number,
4444
'role': 'progressbar',
4545
'[attr.aria-valuemin]': '_ariaValueMin',
4646
'[attr.aria-valuemax]': '_ariaValueMax',
47+
'[class.md-primary]': 'color == "primary"',
48+
'[class.md-accent]': 'color == "accent"',
49+
'[class.md-warn]': 'color == "warn"',
4750
},
4851
templateUrl: 'progress-circle.html',
4952
styleUrls: ['progress-circle.css'],
@@ -130,6 +133,8 @@ export class MdProgressCircle implements OnDestroy {
130133
}
131134
private _mode: ProgressCircleMode = 'determinate';
132135

136+
@Input() color: 'primary' | 'accent' | 'warn' = 'primary';
137+
133138
constructor(
134139
private _changeDetectorRef: ChangeDetectorRef,
135140
private _ngZone: NgZone,

0 commit comments

Comments
 (0)