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

chore(notched-outline): separate outline from text-field #2326

Merged
merged 86 commits into from
Mar 16, 2018

Conversation

moog16
Copy link
Contributor

@moog16 moog16 commented Feb 28, 2018

fixes #2128
related #1982

BREAKING CHANGE: removed mdc-text-field__outline element for mdc-notched-outline.
Renamed mdc-text-field-outlined-corner-radius to mdc-text-field-outline-corner-radius.

Matt Goo added 30 commits February 6, 2018 13:55
…-components/material-components-web into chore/text-field/decouple-label
…-components/material-components-web into chore/text-field/decouple-label
…-components/material-components-web into chore/text-field/decouple-label
Mixin | Description
--- | ---
`mdc-text-field-outline-color($color)` | Customizes the border color of the outline text field.
`mdc-text-field-outlined-corner-radius($radius)` | Sets the border radius of of the text field outline variant.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bonniezhou I think this should be changed to mdc-text-field-outline-corner-radius what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually I'm going to change mdc-text-field-outline-color --> mdc-text-field-outlined-color so it isn't a breaking change.

Copy link
Contributor

Choose a reason for hiding this comment

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

How is that not a breaking change? AFAICT mdc-text-field-outline-color is also already a thing that exists.

Plus, it seems like the one "outlined" name is the outlier, and "outline" sounds more natural to me in mixin names, so IMO I'd go with your first suggestion.

Copy link
Contributor Author

@moog16 moog16 Mar 6, 2018

Choose a reason for hiding this comment

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

True, but that mdc-text-field-outline-color is in the mdc-text-field__outline package, which is moved to the mdc-notched-outline. I this would cover it:

BREAKING CHANGE: removed mdc-text-field__outline element for mdc-notched-outline

But yes you're right, mdc-text-field-outline-color and mdc-text-field-outline-corner-radius are more natural.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I think initially "Outlined" should refer to the variant of Text Field and "Outline" refers to the actual subcomponent. But changing them both to "Outline" sounds like a good idea, and would cause less confusion.

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.

LGTM!

@acdvorak acdvorak assigned lynnmercier and unassigned acdvorak Mar 9, 2018
@acdvorak
Copy link
Contributor

acdvorak commented Mar 9, 2018

@lynnjepsen will take the review from here 😄

@@ -2,6 +2,16 @@
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"JSONStream": {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think package-lock.json should change in this PR. We're only adding new modules.

@include mdc-text-field-outline-color($mdc-text-field-error);
@include mdc-text-field-hover-outline-color($mdc-text-field-error);
@include mdc-text-field-focused-outline-color($mdc-text-field-error);
}

@mixin mdc-text-field-outlined-focused_ {
.mdc-text-field__outline-path {
.mdc-notched-outline__path {
stroke-width: 2px;
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should make a mixin to support customizing the width of the notched outline. And then call that mixin here.

border: 1px solid;
.mdc-notched-outline,
.mdc-notched-outline__idle {
@include mdc-text-field-outline-corner-radius($mdc-text-field-border-radius);
Copy link
Contributor

Choose a reason for hiding this comment

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

calling a text-field mixin within the scope of .mdc-notched-outline seems backwards. Shouldn't we call a notched outline mixin here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch...that should be a notched-outline mixin


@mixin mdc-text-field-outline-color_($color) {
@include mdc-notched-outline-idle-color($color);
@include mdc-notched-outline-color($color);
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a comment that outlined version of text field wants the "idle" and "notched" version to have the same color. This covers two cases: 1) the "idle" state when a text field renders with no value 2) the "notched" state when a text field renders with an initial value

.mdc-text-field__icon:hover ~ {
@include mdc-notched-outline-idle-color($color);

.mdc-notched-outline {
Copy link
Contributor

Choose a reason for hiding this comment

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

Put a bunch of comments here around the ~ and sibling selector, and why thats hella complicated because mdc-notched-outline__path is a sub-element but mdc-notched-outline__idle is a sibling element.

And then file a GitHub issue to investigate making mdc-notched-outline__idle a sub-element of mdc-notched-outline.

@@ -43,7 +43,7 @@ let NativeInputType;
* helperText: (!MDCTextFieldHelperTextFoundation|undefined),
* icon: (!MDCTextFieldIconFoundation|undefined),
* label: (!MDCFloatingLabelFoundation|undefined),
* outline: (!MDCTextFieldOutlineFoundation|undefined)
* outline: (!MDCNotchedOutlineFoundation|undefined)
Copy link
Contributor

Choose a reason for hiding this comment

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

You dont need lineRipple, label, or outline anymore. MDCTextFieldFoundation only needs helperText and icon

}

@mixin mdc-notched-outline-corner-radius($radius) {
&,
Copy link
Contributor

Choose a reason for hiding this comment

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

Add some comments here about why you have to do this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you are looking at an older commit. This is now


@mixin mdc-notched-outline-corner-radius($radius) {
  border-radius: $radius;
}

@mixin mdc-notched-outline-idle-corner-radius($radius) {
  .mdc-notched-outline__idle {
    border-radius: $radius;
  }
}

@@ -2,16 +2,6 @@
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"JSONStream": {
Copy link
Contributor

Choose a reason for hiding this comment

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

This changed again...remove this from PR

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah nevermind. Ignore me.

`mdc-notched-outline-stroke-width($width)` | Changes notched outline width to a specified pixel value.
`mdc-notched-outline-corner-radius($radius)` | Sets the corner radius of the notched outline element to the given number.
`mdc-notched-outline-idle-corner-radius($radius)` | Sets the corner radius of the notched outline element in idle state.
> NOTE:
Copy link
Contributor

Choose a reason for hiding this comment

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

Change this whole NOTE to

Because notched-outline has sibling elements, you need to call the "idle" Sass mixins with parent selectors.
Consider the following example HTML:

<div class="foo-line-ripple-parent">
  <div class="mdc-notched-outline foo-line-ripple">
    <svg>
      <path class="mdc-notched-outline__path"/>
    </svg>
  </div>
  <div class="mdc-notched-outline__idle"></div>
</div>

In order to customize any "non-idle" part of notched-outline, use the .foo-line-ripple CSS selector:

.foo-line-ripple {
  @include mdc-notched-outline-color(fooColor);
}

But in order to customize any "idle" part of the notched-outline, you must use the .foo-line-ripple-parent CSS selector:

.foo-line-ripple-parent {
  @include mdc-notched-outline-idle-color(fooColor);
}

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.

Split notched outline into a new Node module
7 participants