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(switch): Merge updated switch into master #3214

Merged
merged 25 commits into from
Jul 27, 2018
Merged

Conversation

rlfriedman
Copy link
Contributor

@rlfriedman rlfriedman commented Jul 25, 2018

BREAKING CHANGE: MDC Switch DOM structure and Sass APIs have changed, and JavaScript APIs have been added. See the documentation for more information.

Fixes #2825

@codecov-io
Copy link

codecov-io commented Jul 25, 2018

Codecov Report

Merging #3214 into master will increase coverage by 0.01%.
The diff coverage is 98.83%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3214      +/-   ##
==========================================
+ Coverage   98.12%   98.13%   +0.01%     
==========================================
  Files         101      104       +3     
  Lines        4421     4507      +86     
  Branches      585      587       +2     
==========================================
+ Hits         4338     4423      +85     
- Misses         83       84       +1
Impacted Files Coverage Δ
packages/mdc-switch/constants.js 100% <100%> (ø)
packages/mdc-switch/foundation.js 100% <100%> (ø)
packages/mdc-switch/index.js 98% <98%> (ø)

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 b95d4e7...b5570a5. Read the comment docs.

@rlfriedman rlfriedman changed the title Feat/switch update feat(switch): Merge updated switch into master Jul 26, 2018
@mdc-web-bot
Copy link
Collaborator

Copy link
Contributor

@kfranqueiro kfranqueiro left a comment

Choose a reason for hiding this comment

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

I started looking this over but will need to continue later. Pointed out a few things I noticed.

.travis.yml Outdated
@@ -6,6 +6,7 @@ branches:
# This prevents excessive resource usage and CI slowness.
only:
- master
- feat/switch-update
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be removed in the merge

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do.

@@ -26,6 +26,7 @@ const checkbox = new mdc.checkbox.MDCCheckbox(document.querySelector('.mdc-check
import { checkbox } from 'material-components-web';
const checkbox = new checkbox.MDCCheckbox(document.querySelector('.mdc-checkbox'));
```
> NOTE: Since switch is a reserved word in JS, switch is instead named `switchControl`.
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 newline before this line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do.

<div class="mdc-switch__thumb-underlay">
<div class="mdc-switch__thumb">
<input type="checkbox" id="basic-switch" class="mdc-switch__native-control" role="switch">
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

The basic usage section seems to be missing the Styles (for imports) and JavaScript Instantiation sections

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, will add!

`mdc-switch__thumb` | Mandatory, for the thumb element.
`mdc-switch__native-control` | Mandatory, for the hidden input checkbox.

## Style Customization
Copy link
Contributor

Choose a reason for hiding this comment

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

There's already a style customization heading above, I think this one shouldn't be 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.

Thanks, will remove.


## Usage within Web Frameworks

If you are using a JavaScript framework, such as React or Angular, you can create a switch for your framework. Depending on your needs, you can use the _Simple Approach: Wrapping MDC Web Vanilla Components_, or the _Advanced Approach: Using Foundations and Adapters_. Please follow the instructions [here](../../docs/integrating-into-frameworks.md).
Copy link
Contributor

Choose a reason for hiding this comment

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

Capitalize "Switch" in "create a switch for your framework"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do.

| `setDisabled(disabled: boolean) => void` | Sets the disabled value of the native control and updates styling to reflect the disabled state. |
| `handleChange() => void` | Handles a change event from the native control. |

### `MDCSwitchFoundation` Event Handlers
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be documented under the component rather than the foundation?

Copy link
Contributor

Choose a reason for hiding this comment

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

I just re-read this and realized why it's here; I had misread it earlier. This is basically an example of the sort of thing Pat was saying we should add, so this can stay here.

@mdc-web-bot
Copy link
Collaborator

@@ -8,17 +8,22 @@
"material design",
"switch"
],
"main": "index.js",
Copy link
Contributor

@moog16 moog16 Jul 26, 2018

Choose a reason for hiding this comment

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

please point this to dist/mdc.switch.js

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@kfranqueiro kfranqueiro Jul 27, 2018

Choose a reason for hiding this comment

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

I can't find a single other package we're doing this for in MDC Web and thus think this is a mistake...

Can you explain this @moog16 ? At the very least I don't think we should be making one package inconsistent from the rest right now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, I just found #3245, which explains this.

I don't think we should be rushing to do that just yet - please revert this here.

Copy link
Contributor

Choose a reason for hiding this comment

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

sorry @rlfriedman! I jumped the gun :)

@mdc-web-bot
Copy link
Collaborator

@mdc-web-bot
Copy link
Collaborator

Copy link
Contributor

@kfranqueiro kfranqueiro left a comment

Choose a reason for hiding this comment

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

This will need a proper BREAKING CHANGE description in the commit description when merging, e.g.:

BREAKING CHANGE: MDC Switch DOM structure and Sass APIs have changed, and JavaScript APIs have been added. See the documentation for more information.

@mdc-web-bot
Copy link
Collaborator

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.

6 participants