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

feat(select): Move colors for default select to mixins #1934

Merged
merged 13 commits into from
Jan 17, 2018

Conversation

williamernest
Copy link
Contributor

refs: #1150

Move colors for the select into a new mixins file.

@codecov-io
Copy link

codecov-io commented Jan 10, 2018

Codecov Report

Merging #1934 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           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.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 568fc32...6bda358. Read the comment docs.

Copy link
Contributor

@bonniezhou bonniezhou left a 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.

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.
Copy link
Contributor

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

`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.
Copy link
Contributor

Choose a reason for hiding this comment

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

this note seems unfinished?

Copy link
Contributor Author

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.


@mixin mdc-select-focused-bottom-line-color_($color) {
.mdc-select__surface:focus .mdc-select__bottom-line,
.mdc-select__surface:focus ~ .mdc-select__bottom-line {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@include mdc-select-focused-bottom-line-color(primary);
@include mdc-select-focused-label-color(primary);
}

// postcss-bem-linter: define select
.mdc-select {
Copy link
Contributor

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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

screen shot 2018-01-11 at 3 59 04 pm

@@ -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 {
Copy link
Contributor

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

`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.
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 attach a screenshot of what you are coloring here? I cant figure out what this is.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

screen shot 2018-01-11 at 3 40 38 pm

The "Fruit Roll Ups" text is the mdc-select-selected-text-color

Maybe mdc-select-selected-item-ink-color? The css class is .mcd-select__selected-text so I left it similar for the mixin.

Copy link
Contributor

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.

@lynnmercier lynnmercier self-assigned this Jan 11, 2018
@williamernest
Copy link
Contributor Author

@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.

@@ -58,6 +58,14 @@
}
}

@mixin mdc-select-focused-bottom-line {
Copy link
Contributor

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

@include mdc-theme-prop(background-color, $color);
}

.mdc-select--open .mdc-select__bottom-line {
&.mdc-select--open .mdc-select__bottom-line {
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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

@williamernest williamernest deleted the feat/select/sass_color_mixins branch January 12, 2018 22:00
@williamernest williamernest restored the feat/select/sass_color_mixins branch January 12, 2018 22:00
@williamernest williamernest reopened this Jan 12, 2018
Copy link
Contributor

@lynnmercier lynnmercier left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -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.
Copy link
Contributor

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

@williamernest williamernest merged commit d6c68ce into master Jan 17, 2018
@williamernest williamernest deleted the feat/select/sass_color_mixins branch January 17, 2018 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants