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): correct invalid colors #4771

Merged
merged 2 commits into from
May 26, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
14 changes: 14 additions & 0 deletions src/demo-app/input/input-demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,20 @@ <h4>Textarea</h4>
<md-input-container color="warn">
<textarea mdInput placeholder="Warn Color">example</textarea>
</md-input-container>

<h4>With error</h4>
<md-input-container color="primary" >
<input mdInput placeholder="Default Color" [(ngModel)]="dividerColorExample1" required>
<md-error>This field is required</md-error>
</md-input-container>
<md-input-container color="accent">
<input mdInput placeholder="Accent Color" [(ngModel)]="dividerColorExample2" required>
<md-error>This field is required</md-error>
</md-input-container>
<md-input-container color="warn">
<input mdInput placeholder="Warn Color" [(ngModel)]="dividerColorExample3" required>
<md-error>This field is required</md-error>
</md-input-container>
</md-card-content>
</md-card>

Expand Down
3 changes: 3 additions & 0 deletions src/demo-app/input/input-demo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ export class InputDemo {
errorMessageExample1: string;
errorMessageExample2: string;
errorMessageExample3: string;
dividerColorExample1: string;
dividerColorExample2: string;
dividerColorExample3: string;
items: any[] = [
{ value: 10 },
{ value: 20 },
Expand Down
26 changes: 14 additions & 12 deletions src/lib/input/_input-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
color: mat-color($foreground, disabled-text);
}

// See mat-input-placeholder-floating mixin in input.scss
// See mat-input-placeholder-floating mixin in input-container.scss
input.mat-input-element:-webkit-autofill + .mat-input-placeholder,
.mat-focused .mat-input-placeholder.mat-float {
.mat-placeholder-required {
Expand All @@ -52,26 +52,28 @@

.mat-input-underline {
border-color: $input-underline-color;
}

.mat-input-ripple {
background-color: $input-underline-focused-color;
.mat-input-ripple {
background-color: $input-underline-focused-color;

&.mat-accent {
background-color: $input-underline-color-accent;
}
&.mat-warn {
background-color: $input-underline-color-warn;
}
&.mat-accent {
background-color: $input-underline-color-accent;
}

&.mat-warn {
background-color: $input-underline-color-warn;
}
}

// Styling for the error state of the input container. Note that while the same can be
// achieved with the ng-* classes, we use this approach in order to ensure that the same
// logic is used to style the error state and to show the error messages.
.mat-input-invalid {
.mat-input-placeholder,
.mat-placeholder-required {
color: $input-underline-color-warn;
.mat-input-placeholder {
&, &.mat-accent, &.mat-float .mat-placeholder-required {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you put each selector on its own line (makes it obvious that there's multiple and not one complex one).

also I think we can't have rules that end with & in our theme files, so maybe:

.mat-input-placeholder {
  color: $input-underline-color-warn;

  &.mat-accent,
  &.mat-float .mat-placeholder-required {
    color: $input-underline-color-warn;
  }
}

color: $input-underline-color-warn;
}
}

.mat-input-ripple {
Expand Down