-
Notifications
You must be signed in to change notification settings - Fork 23
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
refactor(codemods): upgrade to Button v3 #5360
Conversation
|
…multiple components
…mesMapByComponentName
…to transformComponentsAndImportsInDirByPattern
…mportAttributesMap
Why
Make adoption easier.
What
Codemod to upgrade Button v1/v2 and IconButton v1/v2 to Button v3 or LinkButton v3
Assumptions:
label
should always exist, and become childrenchildren
should not already exist (always a self-closing element)Props:
onClick
→onPress
label
→children
(self-closing → open/close element)"Actions"
{"Actions for section" // TODO: i18n}
{"Back to Main Menu"}
{`Further options for ${track.name}`}
{ showEmojiPicker ? formatMessage({ id: "liteRTE.emojiPickerLabel.close", defaultMessage: "Close emoji picker", description: "Label for the button that closes the emoji picker", }) : formatMessage({ id: "liteRTE.emojiPickerLabel.open", defaultMessage: "Open emoji picker", description: "Label for the button that opens the emoji picker", }) }
{label}
primary
→ ?secondary
→ ?destructive
→ ?secondary
+destructive
→ ?regular
→ ?small
→ ?reversed
→isReversed
classNameOverride
→className
data-automation-id
→data-testid
disabled
→isDisabled
href
exists:newTabAndIUnderstandTheAccessibilityImplications
→target="_blank"
rel="noopener noreferrer"
IconButton
only:hasHiddenLabel
Component name:
IconButton
(v1/v2) withouthref
orcomponent
→Button
(v3)IconButton
(v1/v2) withhref
→LinkButton
IconButton
(v1/v2) withcomponent
→LinkButton
component
prop but add a@todo
to reviewButton
(v1/v2) withouthref
orcomponent
→Button
(v3)Button
(v1/v2) withhref
→LinkButton
Button
(v1/v2) withcomponent
→LinkButton
Imports:
@kaizen/components
@kaizen/components/v1/actions
@kaizen/components/v2/actions
@kaizen/components/v3/actions
IconButton
may be aliased - use aliasButton
may be aliased - use aliasButton
(v3) not imported - add importButton
(v3) may already be usedButton
may be aliased - use alias