Skip to content
This repository has been archived by the owner on Aug 2, 2024. It is now read-only.

Modernize polaris-radio-button component #504

Merged
merged 4 commits into from
Feb 17, 2020

Conversation

tomnez
Copy link
Contributor

@tomnez tomnez commented Feb 14, 2020

DEV-76

Updates PolarisRadioButton to tagless component, ES6 classes, and angle bracket syntax.

Dummy app:

radio

@tomnez tomnez force-pushed the refactor/es6-polaris-radio-button-DEV-76 branch from a085d4d to 3646e7c Compare February 14, 2020 21:36
checked={{@checked}}
disabled={{@disabled}}
aria-describedby={{this.describedBy}}
onchange={{action (or @onChange this.onChange) value="target.value"}}
Copy link
Contributor Author

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 the fn wasn't working as expected when passing value="target.value" 🤷‍♂

Copy link
Member

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)}} ....>

Copy link
Contributor Author

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 🤷‍♂

Copy link
Member

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

Screen Shot 2020-02-17 at 4 09 59 PM

Copy link
Contributor Author

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 👍

@tomnez tomnez requested review from vladucu and andrewpye February 14, 2020 21:37
@tomnez tomnez self-assigned this Feb 14, 2020
checked={{@checked}}
disabled={{@disabled}}
aria-describedby={{this.describedBy}}
onchange={{action (or @onChange this.onChange) value="target.value"}}
Copy link
Member

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)}} ....>

disabled={{@disabled}}
aria-describedby={{this.describedBy}}
onchange={{action (or @onChange this.onChange) value="target.value"}}
onfocus={{fn (or @onFocus this.onFocus)}}
Copy link
Member

Choose a reason for hiding this comment

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

same...let's use the on modifier for these last 2

@tomnez tomnez requested a review from vladucu February 17, 2020 15:40
checked={{@checked}}
disabled={{@disabled}}
aria-describedby={{this.describedBy}}
onchange={{action (or @onChange this.onChange) value="target.value"}}
Copy link
Member

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

Screen Shot 2020-02-17 at 4 09 59 PM

@tomnez tomnez requested a review from vladucu February 17, 2020 18:15
Copy link
Member

@vladucu vladucu left a comment

Choose a reason for hiding this comment

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

1 small comment and then this should be good to go

checked={{@checked}}
disabled={{@disabled}}
aria-describedby={{this.describedBy}}
{{on "change" (or @onChange this.onChange)}}
Copy link
Member

Choose a reason for hiding this comment

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

I think we still want to pass the value to the onChange action....assuming we were correct and that's what the react implementation does
PS: we shouldn't modify tests to match our implementation.....but make sure tests are testing correct behavior and we pass 😬

Copy link
Member

Choose a reason for hiding this comment

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

check the example I've posted earlier....that should be in the component not in the tests
let me know if this doesn't makes sense pls

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah so you mean we want a middle-man method (something like a private handleChange action) where we grab the value and then call onChange?

Originally when you said

we can just handle in the local action

I thought you meant that the passed-in onChange would be responsible for this. Sorry about the confusion 😬

Copy link
Member

Choose a reason for hiding this comment

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

yeah, like handleChange
moving this to the caller onChange would mean we break the API of this component...which we don't want

@tomnez tomnez requested a review from vladucu February 17, 2020 18:38
Copy link
Member

@vladucu vladucu left a comment

Choose a reason for hiding this comment

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

yasss 🚀

@tomnez tomnez merged commit c071e0f into refactor/es6-classes Feb 17, 2020
@tomnez tomnez deleted the refactor/es6-polaris-radio-button-DEV-76 branch February 17, 2020 20:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants