This repository has been archived by the owner on Aug 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Modernize polaris-radio-button component #504
Merged
tomnez
merged 4 commits into
refactor/es6-classes
from
refactor/es6-polaris-radio-button-DEV-76
Feb 17, 2020
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
{{#polaris-choice | ||
inputId=_id | ||
label=label | ||
labelHidden=labelHidden | ||
disabled=disabled | ||
helpText=helpText | ||
}} | ||
<span data-test-radio-button class="Polaris-RadioButton"> | ||
<PolarisChoice | ||
@inputId={{this._id}} | ||
@label={{@label}} | ||
@labelHidden={{@labelHidden}} | ||
@disabled={{@disabled}} | ||
@helpText={{@helpText}} | ||
> | ||
<span data-test-radio-button="true" class="Polaris-RadioButton"> | ||
<input | ||
data-test-radio-button-input | ||
type="radio" | ||
class="Polaris-RadioButton__Input" | ||
id={{_id}} | ||
name={{name}} | ||
value={{value}} | ||
checked={{checked}} | ||
disabled={{disabled}} | ||
aria-describedby={{describedBy}} | ||
onchange={{action onChange value="target.value"}} | ||
onfocus={{action onFocus}} | ||
onblur={{action onBlur}} | ||
id={{this._id}} | ||
name={{@name}} | ||
value={{@value}} | ||
checked={{@checked}} | ||
disabled={{@disabled}} | ||
aria-describedby={{this.describedBy}} | ||
onchange={{action (or @onChange this.onChange) value="target.value"}} | ||
onfocus={{fn (or @onFocus this.onFocus)}} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same...let's use the |
||
onblur={{fn (or @onBlur this.onBlur)}} | ||
> | ||
|
||
<span data-test-radio-button-backdrop class="Polaris-RadioButton__Backdrop"></span> | ||
<span data-test-radio-button-icon class="Polaris-RadioButton__Icon"></span> | ||
<span data-test-radio-button-backdrop="true" class="Polaris-RadioButton__Backdrop"></span> | ||
<span data-test-radio-button-icon="true" class="Polaris-RadioButton__Icon"></span> | ||
</span> | ||
{{/polaris-choice}} | ||
</PolarisChoice> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left the
action
helper here because thefn
wasn't working as expected when passingvalue="target.value"
🤷♂There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomnez can you try
<input ...... {{on "change" (or @onChange this.onChange)}} ....>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still passes the
event
as the first (and only) argument now rather than the expected value 🤷♂There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really a problem, we can just handle in the local action right? as the example here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we can do that 👍