Skip to content

Conversation

@thatblindgeye
Copy link
Collaborator

@thatblindgeye thatblindgeye commented Mar 6, 2023

Closes #289, closes #295

The update made to SelectableRowObject in the linked PR for this codemod shouldn't be needed here, as patternfly/patternfly-react#8423 will require a codemod that will handle that.

Also made an update to the onToggle codemod similar to this.

@thatblindgeye thatblindgeye requested a review from gitdallas March 6, 2023 14:35
})),
...onToggleAPIUpdateList.map((component) => ({
code: `import { ${component} } from '@patternfly/react-core'; const onToggle = (isOpen) => {}; <${component} onToggle={onToggle} />;`,
output: `import { ${component} } from '@patternfly/react-core'; const onToggle = (_event, isOpen) => {}; <${component} onToggle={onToggle} />;`,
Copy link
Contributor

Choose a reason for hiding this comment

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

bitmoji

@thatblindgeye thatblindgeye requested a review from gitdallas March 6, 2023 23:23
@thatblindgeye
Copy link
Collaborator Author

@gitdallas for now I ust copy+pasted the logic from the onToggle codemod to the DataList one. I can do something similar to my other 2 open PRs. Figure we can create a possible helper as a followup.

Copy link
Contributor

@gitdallas gitdallas left a comment

Choose a reason for hiding this comment

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

overall this is awesome, a few comments/nits

Copy link
Collaborator

@wise-king-sullyman wise-king-sullyman left a comment

Choose a reason for hiding this comment

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

This is like magic

@thatblindgeye
Copy link
Collaborator Author

@gitdallas @wise-king-sullyman refactored the logic in both codemods as a (currently very basic, specific) helper function. Should be a lot easier for similar codemods for adding that "event" param (or any param really, as long as its meant to be the first one).

Figure this could be a building block for more flexible things down the line

Copy link
Collaborator

@wise-king-sullyman wise-king-sullyman left a comment

Choose a reason for hiding this comment

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

🔥 🔥 🔥 🔥 🔥

Copy link
Contributor

@gitdallas gitdallas left a comment

Choose a reason for hiding this comment

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

🏆

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.

Misc - toggle props codemod enhancement DataList - added event param to callback

3 participants