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

refactor(notched-outline): remove text-field notched outline styles and coupling #2401

Merged
merged 108 commits into from
Mar 21, 2018

Conversation

moog16
Copy link
Contributor

@moog16 moog16 commented Mar 14, 2018

fixes #2128
related #1982

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
@moog16 moog16 changed the base branch from chore/text-field/decouple-outline to master March 16, 2018 05:18
@codecov-io
Copy link

codecov-io commented Mar 16, 2018

Codecov Report

Merging #2401 into master will increase coverage by 0.02%.
The diff coverage is 83.78%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2401      +/-   ##
==========================================
+ Coverage   98.88%   98.91%   +0.02%     
==========================================
  Files         104      104              
  Lines        4210     4234      +24     
  Branches      533      534       +1     
==========================================
+ Hits         4163     4188      +25     
+ Misses         47       46       -1
Impacted Files Coverage Δ
packages/mdc-notched-outline/constants.js 100% <100%> (ø) ⬆️
packages/mdc-notched-outline/foundation.js 100% <100%> (+12.5%) ⬆️
packages/mdc-textfield/foundation.js 98.89% <100%> (+0.03%) ⬆️
packages/mdc-notched-outline/index.js 77.77% <33.33%> (-0.8%) ⬇️
packages/mdc-textfield/index.js 95.51% <50%> (-0.6%) ⬇️

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 a8b3193...c015302. Read the comment docs.

Copy link
Contributor

@williamernest williamernest left a comment

Choose a reason for hiding this comment

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

A few minor nits, but LGTM

`setOutlinePathAttr(value: string) => void` | Sets the "d" attribute of the outline element's SVG path.
`getIdleOutlineStyleValue(propertyName: string) => string` | Returns the idle outline element's computed style value of a given css `propertyName`.

### `MDCNotchedOutlineFoundation`

Method Signature | Description
--- | ---
`notch(activateNotch: boolean)` | Adds remove the outline notched selector if activateNotch is true. Updates the component to activate/deactivate 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.

I think this description needs to be reworded. Maybe just the second sentence is needed

@@ -50,13 +57,31 @@ class MDCNotchedOutlineFoundation extends MDCFoundation {
super(Object.assign(MDCNotchedOutlineFoundation.defaultAdapter, adapter));
}

/**
* Adds the outline notched selector and updates the notch width
* if activateNotch is true, otherwise it will remove notched
Copy link
Contributor

Choose a reason for hiding this comment

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

"remove the notched selector"

@@ -274,6 +274,6 @@ Method Signature | Description
`activateFocus() => void` | Activates the focus state of the Text Field. Normally called in response to the input focus event.
`deactivateFocus() => void` | Deactivates the focus state of the Text Field. Normally called in response to the input blur event.
`setHelperTextContent(content: string) => void` | Sets the content of the helper text
Copy link
Contributor

Choose a reason for hiding this comment

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

Trailing period.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice find <needle_in_haystack_emoji>

@moog16 moog16 assigned lynnmercier and unassigned williamernest Mar 20, 2018
@@ -82,6 +83,7 @@ Mixin | Description

Method Signature | Description
--- | ---
`notch(activateNotch: boolean)` | Updates outline to activate/deactivate notch in outline path.
`updateSvgPath(notchWidth: number, isRtl: boolean) => void` | Updates the SVG of the outline element with a notch calculated based off of the notchWidth. The notch will appear left justified, unless isRtl is true.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we change this so there are two methods
notch(notchWidth: number, isRtl: boolean) => void
and
closeNotch() => void

@@ -248,7 +248,7 @@ Method Signature | Description
`isFocused() => boolean` | Returns whether the input is focused
`isRtl() => boolean` | Returns whether the direction of the root element is set to RTL
`hasOutline() => boolean` | Returns whether there is an outline element
`updateOutlinePath(labelWidth: number, isRtl: boolean) => void` | Updates the outline path to create a notch for the label element
`notchOutline(labelWidth: number, isRtl: boolean) => void` | Updates the outline path to create a notch for the label element

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you also need a closeOutlineNotch method in MDCTextFieldAdapter?

if (activateNotch) {
this.adapter_.notchOutline(labelWidth, isRtl);
} else {
this.adapter_.notchOutline(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

setting the labelWidth = 0 in order to simulate "closing the notch" is unintuitive. Just add another method that explicitly closes the notch

@@ -204,7 +207,11 @@ class MDCTextFieldFoundation extends MDCFoundation {
const labelScale = isDense ? numbers.DENSE_LABEL_SCALE : numbers.LABEL_SCALE;
const labelWidth = this.adapter_.getLabelWidth() * labelScale;
const isRtl = this.adapter_.isRtl();
Copy link
Contributor

Choose a reason for hiding this comment

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

calculate all this labelWidth and isRTL within the if statement for opening the notch.

@@ -193,9 +195,10 @@ class MDCTextFieldFoundation extends MDCFoundation {
}

/**
* Updates the focus outline for outlined text fields.
* Activates/deactivates the notched outline.
* @param {boolean} activateNotch
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: open notch? instead of activate?

@moog16 moog16 merged commit 4f83757 into master Mar 21, 2018
@moog16 moog16 deleted the refactor/notched-outline/update-api branch March 21, 2018 20:24
trimox added a commit to trimox/angular-mdc-web that referenced this pull request Apr 9, 2018
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
4 participants