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: add RadioGroup middleware #918

Merged
merged 2 commits into from
Jan 6, 2020
Merged

feat: add RadioGroup middleware #918

merged 2 commits into from
Jan 6, 2020

Conversation

bitpshr
Copy link
Member

@bitpshr bitpshr commented Nov 25, 2019

Type: feature

The following has been addressed in the PR:

  • There is a related issue
  • All code matches the style guide
  • Unit tests are included in the PR
  • Any widget variant uses theme.compose like this
  • WidgetProperties are exported

Description:

This pull request adds a new RadioGroup widget and associated middleware.

Resolves #798

@dojo-site
Copy link

This pull request has been deployed to:

Copy link
Contributor

@JamesLMilner JamesLMilner left a comment

Choose a reason for hiding this comment

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

Generally looks good, but needs to fix the unit test and fix the merge conflict. Might be good to get a screenshot of the examples so people can see too :)

middleware: { icache: icacheFactory() },
properties: () => ({}),
children: () => []
})(onValueStub);
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not 100% sure, but I think the build is failing because this is expecting the initialValue argument


return (key: string) => ({
checked(checked?: boolean) {
const existingValue = icache.get('value');
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 should be typed as a string icache.get<string>('value'); ?

Copy link
Member

Choose a reason for hiding this comment

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

same as above


export const radioGroup = factory(({ middleware: { icache } }) => {
return (onValue: (value: string) => void, initialValue: string) => {
const existingInitialValue = icache.get('initial');
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 should be typed as a string: icache.get<string>('initial');?

Copy link
Member

Choose a reason for hiding this comment

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

it's typed above @JamesLMilner via RadioGroupICache

const factory = create({ radioGroup, theme }).properties<RadioGroupProperties>();

export const RadioGroup = factory(function({ properties, middleware: { radioGroup, theme } }) {
const { name, label, options, renderer, onValue, initialValue } = properties();
Copy link
Member

Choose a reason for hiding this comment

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

you could do initialValue = '' here rather than use || below.

Copy link
Member

@tomdye tomdye left a comment

Choose a reason for hiding this comment

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

Looks good to me @bitpshr . Just needs the conflicts sorted and the test fixed. @JamesLMilner there's no need for a screenshot as there's a link automatically added to the PR to the example runner.

@dojo-site
Copy link

This pull request has been deployed to:

@dojo-site
Copy link

This pull request has been deployed to:

@dojo-site
Copy link

This pull request has been deployed to:

@tomdye tomdye merged commit 5d502df into dojo:master Jan 6, 2020
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.

Radio group widget
4 participants