-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
feat(text-field): Move final JS colors to mixins. Update demos #2006
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2006 +/- ##
=======================================
Coverage 99.43% 99.43%
=======================================
Files 84 84
Lines 3717 3717
Branches 485 485
=======================================
Hits 3696 3696
Misses 21 21 Continue to review full report at Codecov.
|
Talked offline, we're going to split this into two PRs: one to remove the CSS only version of text field, and one to finish the Sass color mixin story |
demos/text-field.scss
Outdated
|
||
&.mdc-text-field--focused { | ||
@include mdc-text-field-label-color(rgba(blue, .87)); | ||
@include mdc-text-field-focused-textarea-stroke-color($focused-border); |
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.
Does this belong under the .mdc-text-field--focused
selector?
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.
No, this should just be renamed. It's our "double border" for the text area. There's a div and a textarea together with the outer div being non-focused and both of them together being the focused state.
packages/mdc-textfield/README.md
Outdated
`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-box-background-color($color)` | Customizes the background color of the text-field box. |
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.
box-fill-color, not background
packages/mdc-textfield/README.md
Outdated
`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-box-background-color($color)` | Customizes the background color of the text-field box. | ||
`mdc-text-field-textarea-stroke-color($color)` | Customizes the color of the border of the textarea. | ||
`mdc-text-field-textarea-background-color($color)` | Customizes the color of the background of the textarea. |
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.
textarea-fill-color, not background
packages/mdc-textfield/README.md
Outdated
`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. | ||
`mdc-text-field-label-background-color` | Customizes the background color of the label. Used only by the textarea. |
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.
hmmm, I think we should only allow clients to customize the fill color of the entire textarea, not specific to the label. I think we should delete this mixin (At least publicly)
packages/mdc-textfield/_mixins.scss
Outdated
} | ||
|
||
@mixin mdc-text-field-textarea-background-color($color) { | ||
&.mdc-text-field--textarea:not(.mdc-text-field--disabled) { |
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 shouldn't have mdc-text-field--textarea
within this mixin. We should assume the developer calling this mixin has already specified a CSS selector which only selects mdc-text-field--textarea
elements. So, mdc-text-field--textarea
is unnecessarily specific.
packages/mdc-textfield/_mixins.scss
Outdated
@@ -126,6 +164,10 @@ | |||
@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); | |||
|
|||
// Textarea specific mixins |
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 this to mdc-text-field-textarea-invalid_
mixin. Its at HEAD of master now
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.
Should we move all of the variants to their own invalid mixins? textarea is the only one that has an -invalid mixin.
I opted to condense everything here, but if we break out textarea, shouldn't we also break out outline ?
textfield mixin in master
@mixin mdc-text-field-textarea-invalid_ { |
invalid mixin in master
@include mdc-text-field-outline-color($mdc-text-field-error-on-light); |
packages/mdc-textfield/_mixins.scss
Outdated
} | ||
|
||
@mixin mdc-text-field-fullwidth-bottom-line-color_($color) { | ||
&.mdc-text-field--fullwidth:not(.mdc-text-field--textarea) { |
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--fullwidth
is unnecessarily specific here. Assume the developer is already using a CSS selector that only selects mdc-text-field--fullwidth
elements
@@ -17,19 +17,19 @@ | |||
//Public | |||
|
|||
@mixin mdc-text-field-bottom-line-color($color) { | |||
&:not(.mdc-text-field--disabled) { | |||
&:not(.mdc-text-field--disabled):not(.mdc-text-field--outlined):not(.mdc-text-field--textarea) { |
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.
Don't we say in our README to never use a mdc-text-field__bottom-line
element within a mdc-text-field--outlined
element? or mdc-text-field--textarea
?
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.
Yes. They share the mdc-text-field__input, the bottom line color is automatically set, resulting in some weird behavior on outline and textfield if we don't stop it here. This mixin applies border-bottom-color, and outline applies border-color, resulting in a weird line
Without :not(.mdc-text-field--outlined):not(.mdc-text-field--textarea)
The mdc-text-field-border-bottom-line-color
mixin is applied to the border-bottom-color
of the input field for idle and hover. The actual bottom line element is a separate element that only gets activated on focus.
Oh and...this PR is not a breaking change anymore, now that you moved the CSS only stuff to the other PR |
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/_mixins.scss
Outdated
// Private mixins | ||
|
||
@mixin mdc-text-field-invalid-label-shake-keyframes_($modifier, $positionY, $scale: .75) { | ||
@mixin mdc-text-field-invalid-label-shake-keyframes_($modifier, $positionY, $positionX: 0%, $scale: .75) { |
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.
is this change something that should be in this PR? Or unrelated to this PR?
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.
Unrelated. This was my merge with master.
packages/mdc-textfield/_mixins.scss
Outdated
@@ -324,13 +312,18 @@ | |||
.mdc-text-field__label--float-above ~ .mdc-text-field__outline { | |||
opacity: 1; | |||
} | |||
|
|||
&.mdc-text-field--invalid { | |||
@include mdc-text-field-outlined-invalid_; |
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 this call to mdc-text-field.scss
.mdc-text-field--focused.mdc-text-field--invalid {
@include mdc-text-field-outlined-invalue_;
}
packages/mdc-textfield/_mixins.scss
Outdated
padding: 8px 16px; | ||
margin-top: 2px; | ||
margin-left: 8px; | ||
padding: 8px; |
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.
Is this a new change? Or did you move existing logic into here?
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.
Unrelated. This was my merge with master.
packages/mdc-textfield/_mixins.scss
Outdated
} | ||
|
||
&.mdc-text-field--invalid { | ||
@include mdc-text-field-textarea-invalid_; |
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 this call to mdc-text-field.scss
packages/mdc-textfield/_mixins.scss
Outdated
&.mdc-text-field--focused:not(.mdc-text-field--invalid) { | ||
@include mdc-text-field-focused-textarea-stroke-color(primary); | ||
&.mdc-text-field--disabled { | ||
@include mdc-text-field-textarea-disabled_; |
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 this call to mdc-text-field.scss
packages/mdc-textfield/_mixins.scss
Outdated
&.mdc-text-field--disabled { | ||
@include mdc-text-field-textarea-disabled_; | ||
&.mdc-text-field--focused { | ||
@include mdc-text-field-textarea-stroke-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.
Move this call to mdc-text-field.scss
.mdc-text-field--textarea.mdc-text-field--focused {
@include mdc-text-field-textarea-stroke-color(primary);
}
BREAKING CHANGE: Moves the text-field colors to mixins. Removes css only. Refer to the docs/demo for usage.
resolves #1526
fixes #1925