-
Notifications
You must be signed in to change notification settings - Fork 2.1k
feat(text-field): Move color for default text-field to mixins. #1885
feat(text-field): Move color for default text-field to mixins. #1885
Conversation
45c9ae3
to
07205bd
Compare
packages/mdc-textfield/_mixins.scss
Outdated
} | ||
} | ||
|
||
@mixin mdc-text-field-bottom-line-hover-color($color) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mdc-text-field-hover-bottom-line-color
is better I think. Since you hover on the text field, not the bottom line.
packages/mdc-textfield/_mixins.scss
Outdated
} | ||
} | ||
|
||
@mixin mdc-text-field-bottom-line-focused-color($color) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mdc-text-field-focused-bottom-line-color
is better I think. Since you focus on the text field, not the bottom line.
packages/mdc-textfield/_mixins.scss
Outdated
} | ||
} | ||
|
||
@mixin mdc-text-field-input-ink-color($color) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just use mdc-text-field-ink-color
. <input>
is an implementation detail
@@ -38,14 +38,21 @@ | |||
// postcss-bem-linter: define text-field | |||
|
|||
.mdc-text-field { | |||
@include mdc-text-field-bottom-line-color($mdc-text-field-underline-on-light-idle); | |||
@include mdc-text-field-bottom-line-hover-color($mdc-text-field-underline-on-light); | |||
@include mdc-text-field-bottom-line-focused-color(primary); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love these bottom line mixins
@include mdc-text-field-bottom-line-focused-color(primary); | ||
@include mdc-text-field-label-ink-color($mdc-text-field-light-label); | ||
@include mdc-text-field-input-ink-color(text-primary-on-light); | ||
@include mdc-text-field-input-placeholder-ink-color(text-hint-on-light); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
combine the label-color, input-placeholder-ink-color (one is CSS only and one is JS)
@include mdc-text-field-label-ink-color($mdc-text-field-light-label); | ||
@include mdc-text-field-input-ink-color(text-primary-on-light); | ||
@include mdc-text-field-input-placeholder-ink-color(text-hint-on-light); | ||
@include mdc-text-field-input-placeholder-hover-ink-color($mdc-text-field-light-placeholder); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drop this "change label color on hover" feature from the CSS only version of text field
packages/mdc-textfield/_mixins.scss
Outdated
} | ||
} | ||
|
||
@mixin mdc-text-field-label-ink-color($color) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can just say label-color
there is only one way to color the label
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.mdc-text-field--textarea .mdc-text-field__label
has a background-color attribute.
Codecov Report
@@ Coverage Diff @@
## master #1885 +/- ##
=======================================
Coverage 99.43% 99.43%
=======================================
Files 84 84
Lines 3721 3721
Branches 484 484
=======================================
Hits 3700 3700
Misses 21 21 Continue to review full report at Codecov.
|
08b875d
to
8abecc7
Compare
packages/mdc-textfield/README.md
Outdated
@@ -198,6 +198,12 @@ Mixin | Description | |||
--- | --- | |||
`mdc-text-field-box-corner-radius($radius)` | Customizes the border radius for a box text field | |||
`mdc-text-field-textarea-corner-radius($radius)` | Customizes the border radius for a `<textarea>` text field | |||
`mdc-text-field-bottom-line-color($color)` | Customizes the color of the default bottom line of the text-field. | |||
`mdc-text-field-hover-bottom-line-color($color)` | Customizes the hover color of the bottom line of the text-field. | |||
`mdc-text-field-focused-bottom-line-color($color)` | Customizes the bottom-line ripple color when the text-field is selected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when the text field is focused, not selected
packages/mdc-textfield/_mixins.scss
Outdated
|
||
@mixin mdc-text-field-bottom-line-color_($color) { | ||
.mdc-text-field__input, | ||
.mdc-text-field__input::placeholder { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need the ::placeholder? Maybe add a comment explaining this, since it is not obvious
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I definitely don't need it there. I need it on the label color mixin for the css only version uses a placeholder instead of a label.
packages/mdc-textfield/README.md
Outdated
@@ -194,10 +194,21 @@ CSS Class | Description | |||
|
|||
### Sass Mixins | |||
|
|||
To customize the colors of any part of the text-field, use the following mixins. We recommend you apply | |||
these mixins within CSS selectors like .foo-text-field:not(.mdc-text-field--focused) to select your inactive text-fields, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to select your unfocused text fields
(no dashes in text field, it is two words)
packages/mdc-textfield/README.md
Outdated
To customize the colors of any part of the text-field, use the following mixins. We recommend you apply | ||
these mixins within CSS selectors like .foo-text-field:not(.mdc-text-field--focused) to select your inactive text-fields, | ||
and .foo-tab.mdc-text-field--focused to select your active text-fields (Note: the `mdc-text-field-focused-bottom-line-color` | ||
mixin should be applied from the not focused class `foo-text-field:not(.mdc-tab--focused)`). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put this note in an '> NOTE: ' comment. You can see examples though-out this README
packages/mdc-textfield/_mixins.scss
Outdated
&:not(.mdc-text-field--disabled) { | ||
@include mdc-text-field-bottom-line-color_($color); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move all the bottom-line mixins to bottom-line/_mixins.scss (and then export them through this file)
packages/mdc-textfield/_mixins.scss
Outdated
&:not(.mdc-text-field--disabled) { | ||
@include mdc-text-field-label-color_($color); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move all the label mixins to label/_mixins.scss (and then export them through this file)
packages/mdc-textfield/_mixins.scss
Outdated
|
||
// Private Color Mixins | ||
|
||
@mixin mdc-text-field-bottom-line-color_($color) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move the private ones too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
packages/mdc-textfield/README.md
Outdated
and .foo-tab.mdc-text-field--focused to select your active text-fields (Note: the `mdc-text-field-focused-bottom-line-color` | ||
mixin should be applied from the not focused class `foo-text-field:not(.mdc-tab--focused)`). | ||
these mixins within CSS selectors like .foo-text-field:not(.mdc-text-field--focused) to select your unfocused text fields, | ||
and .foo-tab.mdc-text-field--focused to select your active text-fields. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
your focused text fields. Fix this too!!
And add a mention about the invalid state.
…olor, remove hover placeholder color change. Add demos for Alternate Colors and Alternate Error Colors
…ubcomponent directories.
f60c4df
to
c54ebf4
Compare
references: #1526
Moves colors for the default text-field into mixins. Separated private/public mixins to prevent users from modifying disabled state colors.