Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(progress-circle, progress-bar): bind color via [color] rather than [attr.color] #2299

Merged
merged 2 commits into from
Dec 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/lib/progress-bar/_progress-bar-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@
background-color: md-color($primary, 100);
}

md-progress-bar[color='accent'] {
.md-progress-bar-fill::after {
background-color: md-color($primary, 600);
}

md-progress-bar.md-accent {
.md-progress-bar-background {
background: #{_md-progress-bar-buffer($accent, 100)};
}
Expand All @@ -28,7 +32,7 @@
}
}

md-progress-bar[color='warn'] {
md-progress-bar.md-warn {
.md-progress-bar-background {
background: #{_md-progress-bar-buffer($warn, 100)};
}
Expand All @@ -40,10 +44,6 @@
background-color: md-color($warn, 600);
}
}

.md-progress-bar-fill::after {
background-color: md-color($primary, 600);
}
}

// TODO(josephperrott): Find better way to inline svgs.
Expand Down
5 changes: 5 additions & 0 deletions src/lib/progress-bar/progress-bar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import {DefaultStyleCompatibilityModeModule} from '../core/compatibility/default
'role': 'progressbar',
'aria-valuemin': '0',
'aria-valuemax': '100',
'[class.md-primary]': 'color == "primary"',
'[class.md-accent]': 'color == "accent"',
'[class.md-warn]': 'color == "warn"',
},
templateUrl: 'progress-bar.html',
styleUrls: ['progress-bar.css'],
Expand All @@ -32,6 +35,8 @@ export class MdProgressBar {
/** Value of the progressbar. Defaults to zero. Mirrored to aria-valuenow. */
private _value: number = 0;

@Input() color: 'primary' | 'accent' | 'warn' = 'primary';

@Input()
@HostBinding('attr.aria-valuenow')
get value() {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/progress-circle/_progress-circle-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
stroke: md-color($primary, 600);
}

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

&[color='warn'] path {
&.md-warn path {
stroke: md-color($warn, 600);
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/lib/progress-circle/progress-circle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ type EasingFn = (currentTime: number, startValue: number,
'role': 'progressbar',
'[attr.aria-valuemin]': '_ariaValueMin',
'[attr.aria-valuemax]': '_ariaValueMax',
'[class.md-primary]': 'color == "primary"',
'[class.md-accent]': 'color == "accent"',
'[class.md-warn]': 'color == "warn"',
},
templateUrl: 'progress-circle.html',
styleUrls: ['progress-circle.css'],
Expand Down Expand Up @@ -130,6 +133,8 @@ export class MdProgressCircle implements OnDestroy {
}
private _mode: ProgressCircleMode = 'determinate';

@Input() color: 'primary' | 'accent' | 'warn' = 'primary';

constructor(
private _changeDetectorRef: ChangeDetectorRef,
private _ngZone: NgZone,
Expand Down