-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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(factories): changed createShorthand signature, to use the optional shorthandConfig static on the component #12783
feat(factories): changed createShorthand signature, to use the optional shorthandConfig static on the component #12783
Conversation
-added shorthandConfig on the Button component -replaced Button.create usages
Perf AnalysisNo significant results to display. All results
Perf Analysis (Fluent)Potential regressions comparing to master
Perf comparison
Perf tests with no regressions
|
Asset size changesSize Auditor did not detect a change in bundle size for any component! Baseline commit: 89b53e7f43d70ffac4e9d308428356c90b8ac06b (build) |
@@ -68,7 +69,7 @@ class ButtonGroup extends UIComponent<WithAsProp<ButtonGroupProps>, any> { | |||
return ( | |||
<ElementType {...unhandledProps} className={classes.root}> | |||
{_.map(buttons, (button, idx) => | |||
Button.create(button, { | |||
createShorthand<WithAsProp<ButtonProps>>(Button, button, { |
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.
I expect that this will be inferred from the first param
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.
Make sense, I changed it
-added class component example
…al shorthandConfig static on the component (microsoft#12783) * -added updated createdShorthand method -added shorthandConfig on the Button component -replaced Button.create usages * -fixed typings * -removed console log * -removed unnecessary undefined * -improved typings -added class component example * -updated changelog
This PR is adding updated
createShorthand
utility, that based on the staticshorthandConfig
on the component, allows user to create react elements from the shorthand. As a showcase it is used on this PR to replace theButton.create
,AccordionTitle.create
andAccordionContent.create
usages (this covers both functional and class components). This will allow us to have more flexible shorthand story, for allowing users to define their own components for the shorthands (this will be required later on on the compose factory).BREAKING CHANGES
The
mappedProp
,allowsJSX
andmappedArrayProp
are expected to be defined as a static shorthandConfig on the component. If it is not defined, this are the defaults:Example: