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(checkbox): Add initial checkbox implementation #4638

Merged
merged 2 commits into from Aug 8, 2016

Conversation

traviskaufman
Copy link
Contributor

This commit converts the checkbox POC code over to the new architecture, adds unit tests, and ports
the demos over to working implementations. It also adds a README, and
modifies .stylelintrc.yaml to increase the number of compound selectors
we can use.

Note that ink ripple functionality will be covered in a separate issue.

Finishes #4471

[Delivers #126819487]

p.s. also cleaned up some animation stuff here.

# be disabled for that file, with an explanation.
selector-no-type:
- true
-
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: Why the extra empty - 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.

my bad 😅 there's an object definition which is indented so it's just another array entry. I'll change it to make it on the same line though.

@Garbee
Copy link
Collaborator

Garbee commented Aug 6, 2016

Style-wise and current docs LGTM overall.

Will play around with implementing and using JS triggers a bit to see how that feels before full approval.

<button type="button" onClick="document.getElementById('basic-checkbox').indeterminate = true;">Make indeterminate</button>
<button type="button" onClick="this.parentElement.hasAttribute('dir') ? this.parentElement.removeAttribute('dir') : this.parentElement.setAttribute('dir', 'rtl');">Toggle RTL</button>
<button type="button" onClick="document.querySelector('.mdl-checkbox-wrapper').classList.toggle('mdl-checkbox-wrapper--align-end');">Toggle Align End</button>
<input type="checkbox" id="disable-element-basic" onchange="document.getElementById('basic-checkbox').disabled = this.checked;">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why don't we actually make this use the checkbox component itself instead of using a generic checkbox?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm my thinking was that using another checkbox component might detract from the component that's being demo'd. e.g. does "disable" apply to that checkbox component or the one for the original demo? I don't feel too strongly either way about it though.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It is a bit inceptiony. But, it also shows in an easy demo how a developer can handle events in an actual application of the component.

In lieu of a checkbox we could just have a "Toggle Disabled" button which does e => e.target.disabled = !e.target.disabled; on click. That way all the toggles are buttons vs this one checkbox node.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The toggle button makes sense; I'll add that in.

@traviskaufman
Copy link
Contributor Author

Changes made and fix is in for tests; apparently property descriptors aren't even returned within the android browser.

This commit converts the checkbox POC code over to the new architecture, adds unit tests, and ports
the demos over to working implementations. It also adds a README, and
modifies .stylelintrc.yaml to increase the number of compound selectors
we can use.

Note that ink ripple functionality will be covered in a separate issue.

Finishes #4471

[Delivers #126819487]
@traviskaufman
Copy link
Contributor Author

@Garbee changes made PTAL!

@Garbee
Copy link
Collaborator

Garbee commented Aug 8, 2016

Schweet. Just played around with the native setup with toggling in custom JS. Works great.

LGTM.

@Garbee Garbee added LGTM and removed PTAL labels Aug 8, 2016
@traviskaufman traviskaufman merged commit 5bbe467 into master Aug 8, 2016
@traviskaufman traviskaufman deleted the feat/checkbox branch August 8, 2016 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants