Skip to content

Commit

Permalink
feat(text-field): Update mixins
Browse files Browse the repository at this point in the history
  • Loading branch information
williamernest committed Jan 16, 2018
1 parent 326c665 commit 3e8aac1
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 37 deletions.
12 changes: 6 additions & 6 deletions demos/text-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
@include mdc-text-field-focused-bottom-line-color(blue);
@include mdc-text-field-ink-color(black);
@include mdc-text-field-label-color(rgba(blue, .5));
@include mdc-text-field-outline-stroke-color(rgba(blue, .38));
@include mdc-text-field-hover-outline-stroke-color(rgba(blue, .6));
@include mdc-text-field-focused-outline-stroke-color(rgba(blue, 1));
@include mdc-text-field-outline-color(rgba(blue, .38));
@include mdc-text-field-hover-outline-color(rgba(blue, .6));
@include mdc-text-field-focused-outline-color(rgba(blue, 1));
@include mdc-text-field-helper-text-color(rgba(blue, .38));

&.mdc-text-field--focused {
Expand All @@ -41,9 +41,9 @@
@include mdc-text-field-focused-bottom-line-color(orange);
@include mdc-text-field-ink-color(orange);
@include mdc-text-field-label-color(rgba(orange, .87));
@include mdc-text-field-outline-stroke-color(rgba(orange, .38));
@include mdc-text-field-hover-outline-stroke-color(rgba(orange, .6));
@include mdc-text-field-focused-outline-stroke-color(rgba(orange, 1));
@include mdc-text-field-outline-color(rgba(orange, .38));
@include mdc-text-field-hover-outline-color(rgba(orange, .6));
@include mdc-text-field-focused-outline-color(rgba(orange, 1));
@include mdc-text-field-helper-text-validation-color(rgba(orange, .6));
}
// stylelint-enable selector-class-pattern
6 changes: 3 additions & 3 deletions packages/mdc-textfield/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,9 @@ Mixin | Description
`mdc-text-field-focused-bottom-line-color($color)` | Customizes the bottom-line ripple color when the text-field is focused.
`mdc-text-field-ink-color($color)` | Customizes the text entered into the text-field.
`mdc-text-field-label-color($color)` | Customizes the label color of the text-field.
`mdc-text-field-outline-stroke-color($color)` | Customizes the color of the border of the outlined text-field.
`mdc-text-field-hover-outline-stroke-color($color)` | Customizes the hover color of the border of the outlined text-field.
`mdc-text-field-focused-outline-stroke-color($color)` | Customizes the outlined border color when the text-field is focused.
`mdc-text-field-outline-color($color)` | Customizes the color of the border of the outlined text-field.
`mdc-text-field-hover-outline-color($color)` | Customizes the hover color of the border of the outlined text-field.
`mdc-text-field-focused-outline-color($color)` | Customizes the outlined border color when the text-field is focused.
`mdc-text-field-helper-text-color($color)` | Customizes the color of the helper text following a text-field.
`mdc-text-field-helper-text-validation-color($color)` | Customizes the color of the helper text when it's used as a validation message.
}
Expand Down
20 changes: 4 additions & 16 deletions packages/mdc-textfield/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,6 @@
}
}

@mixin mdc-text-field-input-hover-outline-stroke-color($color) {
&:not(.mdc-text-field--disabled) {
@include mdc-text-field-input-hover-outline-stroke-color_($color);
}
}

// Private mixins

// Common
Expand Down Expand Up @@ -128,9 +122,9 @@
@include mdc-text-field-helper-text-validation-color($mdc-text-field-error-on-light);

// Outline specific mixins
@include mdc-text-field-outline-stroke-color($mdc-text-field-error-on-light);
@include mdc-text-field-hover-outline-stroke-color($mdc-text-field-error-on-light);
@include mdc-text-field-focused-outline-stroke-color($mdc-text-field-error-on-light);
@include mdc-text-field-outline-color($mdc-text-field-error-on-light);
@include mdc-text-field-hover-outline-color($mdc-text-field-error-on-light);
@include mdc-text-field-focused-outline-color($mdc-text-field-error-on-light);

+ .mdc-text-field-helper-text--validation-msg {
opacity: 1;
Expand Down Expand Up @@ -167,7 +161,7 @@

@mixin mdc-text-field-outline-disabled_ {
@include mdc-text-field-ink-color_($mdc-text-field-light-placeholder);
@include mdc-text-field-outline-stroke-color_($mdc-text-field-outlined-disabled-border);
@include mdc-text-field-outline-color_($mdc-text-field-outlined-disabled-border);

.mdc-text-field__input {
border-bottom: none;
Expand Down Expand Up @@ -242,9 +236,3 @@
@include mdc-theme-prop(color, $color);
}
}

@mixin mdc-text-field-input-hover-outline-stroke-color_($color) {
.mdc-text-field__input:hover ~ .mdc-text-field__idle-outline {
@include mdc-theme-prop(border-color, $color);
}
}
6 changes: 3 additions & 3 deletions packages/mdc-textfield/mdc-text-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@
@include mdc-text-field-helper-text-color(text-hint-on-light);

// Outline specific colors
@include mdc-text-field-outline-stroke-color($mdc-text-field-outlined-idle-border);
@include mdc-text-field-hover-outline-stroke-color($mdc-text-field-outlined-hover-border);
@include mdc-text-field-focused-outline-stroke-color(primary);
@include mdc-text-field-outline-color($mdc-text-field-outlined-idle-border);
@include mdc-text-field-hover-outline-color($mdc-text-field-outlined-hover-border);
@include mdc-text-field-focused-outline-color(primary);

display: inline-block;
position: relative;
Expand Down
18 changes: 9 additions & 9 deletions packages/mdc-textfield/outline/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@

// Public mixins

@mixin mdc-text-field-outline-stroke-color($color) {
@mixin mdc-text-field-outline-color($color) {
&:not(.mdc-text-field--disabled) {
@include mdc-text-field-outline-stroke-color_($color);
@include mdc-text-field-outline-color_($color);
}
}

@mixin mdc-text-field-hover-outline-stroke-color($color) {
@mixin mdc-text-field-hover-outline-color($color) {
&:not(.mdc-text-field--disabled) {
@include mdc-text-field-hover-outline-stroke-color_($color);
@include mdc-text-field-hover-outline-color_($color);
}
}

@mixin mdc-text-field-focused-outline-stroke-color($color) {
@mixin mdc-text-field-focused-outline-color($color) {
&:not(.mdc-text-field--disabled) {
@include mdc-text-field-focused-outline-stroke-color_($color);
@include mdc-text-field-focused-outline-color_($color);
}
}

// Private mixins

@mixin mdc-text-field-outline-stroke-color_($color) {
@mixin mdc-text-field-outline-color_($color) {
.mdc-text-field__idle-outline {
@include mdc-theme-prop(border-color, $color);
}
Expand All @@ -46,14 +46,14 @@
}
}

@mixin mdc-text-field-hover-outline-stroke-color_($color) {
@mixin mdc-text-field-hover-outline-color_($color) {
.mdc-text-field__input:hover ~ .mdc-text-field__idle-outline,
.mdc-text-field__icon:hover ~ .mdc-text-field__idle-outline {
@include mdc-theme-prop(border-color, $color);
}
}

@mixin mdc-text-field-focused-outline-stroke-color_($color) {
@mixin mdc-text-field-focused-outline-color_($color) {
&.mdc-text-field--focused .mdc-text-field__outline-path {
@include mdc-theme-prop(stroke, $color);
}
Expand Down

0 comments on commit 3e8aac1

Please sign in to comment.