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(input): change dividerColor to color #3726

Merged
merged 2 commits into from
Mar 27, 2017
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
20 changes: 10 additions & 10 deletions src/demo-app/input/input-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,24 @@ <h4>Icons</h4>
<md-toolbar color="primary">Divider Colors</md-toolbar>
<md-card-content>
<h4>Input</h4>
<md-input-container dividerColor="primary" >
<md-input-container color="primary" >
<input mdInput placeholder="Default Color" value="example">
</md-input-container>
<md-input-container dividerColor="accent">
<md-input-container color="accent">
<input mdInput placeholder="Accent Color" value="example">
</md-input-container>
<md-input-container dividerColor="warn">
<md-input-container color="warn">
<input mdInput placeholder="Warn Color" value="example">
</md-input-container>

<h4>Textarea</h4>
<md-input-container dividerColor="primary">
<md-input-container color="primary">
<textarea mdInput placeholder="Default Color">example</textarea>
</md-input-container>
<md-input-container dividerColor="accent">
<md-input-container color="accent">
<textarea mdInput placeholder="Accent Color">example</textarea>
</md-input-container>
<md-input-container dividerColor="warn">
<md-input-container color="warn">
<textarea mdInput placeholder="Warn Color">example</textarea>
</md-input-container>
</md-card-content>
Expand Down Expand Up @@ -128,7 +128,7 @@ <h4>Textarea</h4>
<md-card class="demo-card demo-basic">
<md-toolbar color="primary">
Hello&nbsp;
<md-input-container dividerColor="accent">
<md-input-container color="accent">
<input mdInput [(ngModel)]="name" type="text" placeholder="First name">
</md-input-container>,
how are you?
Expand Down Expand Up @@ -177,9 +177,9 @@ <h4>Textarea</h4>
</md-input-container>
</p>
<p>
<md-checkbox [(ngModel)]="dividerColor">Check to change the divider color:</md-checkbox>
<md-input-container [dividerColor]="dividerColor ? 'primary' : 'accent'">
<input mdInput [placeholder]="dividerColor ? 'Primary color' : 'Accent color'">
<md-checkbox [(ngModel)]="color">Check to change the color:</md-checkbox>
<md-input-container [color]="color ? 'primary' : 'accent'">
<input mdInput [placeholder]="color ? 'Primary color' : 'Accent color'">
</md-input-container>
</p>
<p>
Expand Down
2 changes: 1 addition & 1 deletion src/demo-app/input/input-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let max = 5;
})
export class InputDemo {
floatingLabel: string = 'auto';
dividerColor: boolean;
color: boolean;
requiredField: boolean;
ctrlDisabled = false;

Expand Down
8 changes: 4 additions & 4 deletions src/lib/input/input-container.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
[attr.for]="_mdInputChild.id"
[class.mat-empty]="_mdInputChild.empty && !_shouldAlwaysFloat"
[class.mat-float]="_canPlaceholderFloat"
[class.mat-accent]="dividerColor == 'accent'"
[class.mat-warn]="dividerColor == 'warn'"
[class.mat-accent]="color == 'accent'"
[class.mat-warn]="color == 'warn'"
*ngIf="_hasPlaceholder()">
<ng-content select="md-placeholder, mat-placeholder"></ng-content>
{{_mdInputChild.placeholder}}
Expand All @@ -32,8 +32,8 @@
<div class="mat-input-underline"
[class.mat-disabled]="_mdInputChild.disabled">
<span class="mat-input-ripple"
[class.mat-accent]="dividerColor == 'accent'"
[class.mat-warn]="dividerColor == 'warn'"></span>
[class.mat-accent]="color == 'accent'"
[class.mat-warn]="color == 'warn'"></span>
</div>

<div *ngIf="hintLabel != ''" [attr.id]="_hintLabelId" class="mat-hint">{{hintLabel}}</div>
Expand Down
7 changes: 6 additions & 1 deletion src/lib/input/input-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,12 @@ export class MdInputContainer implements AfterContentInit {
@Input() align: 'start' | 'end' = 'start';

/** Color of the input divider, based on the theme. */
@Input() dividerColor: 'primary' | 'accent' | 'warn' = 'primary';
@Input() color: 'primary' | 'accent' | 'warn' = 'primary';

/** @deprecated Use color instead. */
@Input()
get dividerColor() { return this.color; }
set dividerColor(value) { this.color = value; }

/** Whether the floating label should always float or not. */
get _shouldAlwaysFloat() { return this._floatPlaceholder === 'always'; };
Expand Down
4 changes: 2 additions & 2 deletions src/lib/input/input.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ Hint labels are specified in one of two ways: either using the `hintLabel` attri
`align` attribute containing the side. The attribute version is assumed to be at the `start`.
Specifying a side twice will result in an exception during initialization.

### Divider Color
### Underline Color

The divider (line under the `input` content) color can be changed by using the `dividerColor`
The underline (line under the `input` content) color can be changed by using the `color`
attribute of `md-input-container`. A value of `primary` is the default and will correspond to the
theme primary color. Alternatively, `accent` or `warn` can be specified to use the theme's accent or
warn color.