-
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(select): Move colors for default select to mixins #1934
Conversation
eeb8c88
to
79bdf0f
Compare
79bdf0f
to
cb5b822
Compare
Codecov Report
@@ Coverage Diff @@
## master #1934 +/- ##
=======================================
Coverage 99.43% 99.43%
=======================================
Files 84 84
Lines 3718 3718
Branches 486 486
=======================================
Hits 3697 3697
Misses 21 21 Continue to review full report at Codecov.
|
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 dark theme to be removed in this PR? If so, we should remove the rest of the dark theme CSS. If not... maybe we should remove the "dark theme" option on the demo page anyways.
packages/mdc-select/README.md
Outdated
Mixin | Description | ||
--- | --- | ||
`mdc-select-ink-color($color)` | Customizes the text entered into the select.* | ||
`mdc-select-fill-color($color)` | Customizes the background color of the select. |
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.
container-fill-color, not just fill-color. Its a little more specific, since just "fill" is vague
packages/mdc-select/README.md
Outdated
`mdc-select-focused-bottom-line-color($color)` | Customizes the color of the bottom line of the select when focused. | ||
`mdc-select-selected-text-color($color)` | Customizes the color of the option that has been selected. | ||
|
||
>_NOTE_: * - This style applies to the css only version. |
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.
this note seems unfinished?
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.
It references the asterisk on line 279, the mdc-select-ink-color is only applied on the css only version. I'll put it in the description column.
packages/mdc-select/_mixins.scss
Outdated
|
||
@mixin mdc-select-focused-bottom-line-color_($color) { | ||
.mdc-select__surface:focus .mdc-select__bottom-line, | ||
.mdc-select__surface:focus ~ .mdc-select__bottom-line { |
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 both these selectors?
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.
JS version has bottom line as a child element. CSS version is a sibling element.
packages/mdc-select/mdc-select.scss
Outdated
@include mdc-select-focused-bottom-line-color(primary); | ||
@include mdc-select-focused-label-color(primary); | ||
} | ||
|
||
// postcss-bem-linter: define select | ||
.mdc-select { |
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 this with the above mdc-select...and move the postcss-bem-linter up as well
@@ -147,11 +138,8 @@ $mdc-select-menu-transition: transform 180ms $mdc-animation-standard-curve-timin | |||
transform: scaleY(1); | |||
transform-origin: bottom; | |||
transition: $mdc-select-menu-transition; | |||
background-color: rgba(black, .5); | |||
|
|||
&::after { |
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 dont see any ::after in the mixins...did we lose this logic?
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.
On focus/open, the bottom-line turned the primary color. Then the ::after psuedo element applied a transition from the center moving outward that is also the primary color.
Purple is the surface:focus .mdc-select__bottom-line element.
Green is the ::after psuedo element animating outward.
Removing the entire ::after element felt like a separate PR.
packages/mdc-select/mdc-select.scss
Outdated
@@ -175,8 +163,6 @@ $mdc-select-menu-transition: transform 180ms $mdc-animation-standard-curve-timin | |||
// JS-enhanced and CSS-only Selects require different selectors for focused bottom-line due to different DOM structure | |||
&__surface:focus .mdc-select__bottom-line, | |||
&__surface:focus ~ .mdc-select__bottom-line { |
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.
ah...see my comment above where I was confused why we need this.
I would move this to another mixin like this
@mixin mdc-select-focused-bottom-line {
// JS-enhanced and CSS-only Selects require different selectors for focused bottom-line due to different DOM structure
.mdc-select__surface:focus .mdc-select__bottom-line,
.mdc-select__surface:focus ~ .mdc-select__bottom-line {
@content;
}
}
And then use that mixin here in mdc-select.scss and in mdc-select/_mixins.scss
packages/mdc-select/README.md
Outdated
`mdc-select-focused-label-color($color, $opacity: 0.87)` | Customizes the label color of the select when focused. Changing opacity for the label when floating is optional. | ||
`mdc-select-bottom-line-color($color)` | Customizes the color of the default bottom line of the select. | ||
`mdc-select-focused-bottom-line-color($color)` | Customizes the color of the bottom line of the select when focused. | ||
`mdc-select-selected-text-color($color)` | Customizes the color of the option that has been 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.
Can you attach a screenshot of what you are coloring here? I cant figure out what this is.
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.
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.
Try and combine this with mdc-select-ink-color. And mdc-select-ink-color is the better name.
@bonniezhou This PR doesn't remove dark theme, but knowing it's coming out soon I didn't take the time to add a dark theme. |
packages/mdc-select/_mixins.scss
Outdated
@@ -58,6 +58,14 @@ | |||
} | |||
} | |||
|
|||
@mixin mdc-select-focused-bottom-line { |
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 should make this private
packages/mdc-select/_mixins.scss
Outdated
@include mdc-theme-prop(background-color, $color); | ||
} | ||
|
||
.mdc-select--open .mdc-select__bottom-line { | ||
&.mdc-select--open .mdc-select__bottom-line { |
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 this CSS selector? why is mdc-select-focused-bottom-line not enough?
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-select-focused-bottom-line
only covers :focus. The component is no longer focused when the menu is open, the menu is focused. When the menu closes, the component regains :focus.
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.
ahh...okay add a comment above this CSS 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.
LGTM!
packages/mdc-select/README.md
Outdated
@@ -276,13 +244,12 @@ these mixins within CSS selectors like `.foo-select` to apply styling. | |||
|
|||
Mixin | Description | |||
--- | --- | |||
`mdc-select-ink-color($color)` | Customizes the text entered into the select. This style applies only to the css version. | |||
`mdc-select-ink-color($color)` | Customizes the color of the selected item displayed in the select. On css version, this also customized the color of the label. | |||
`mdc-select-container-fill-color($color)` | Customizes the background color of the select. | |||
`mdc-select-label-color($color)` | Customizes the label color of the select in the unfocused state. |
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.
Add that this only covers the JS only version....otherwise label-color is covered by ink-color for CSS only
41bb402
to
6bda358
Compare
refs: #1150
Move colors for the select into a new mixins file.