refactor(OverflowMenu): convert to functional component and add types #18690
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #18689
Converted
OverflowMenu
to a functional component and added types.Changelog
New
OverflowMenu
and other components and utils.Changed
OverflowMenu
to a functional component.Testing / Reviewing
yarn test packages/react/src/components/OverflowMenu
Reference commits: d4a071a...adamalston:carbon:f9390189887725ed4fbe2d1649790861c2bede9b
The changes in this pull request depend on the changes in #18683.
I marked the
ariaLabel
prop in OverflowMenu.tsx as optional so that theOverflowMenu
in TableToolbarMenu.tsx wouldn't throw a type error. The alternative was adding anariaLabel
prop to thatOverflowMenu
. However, that wouldn't work because 29DataTable
tests would fail due to the warning that's logged when deprecated props are used in tests. You can see for yourself by making the following change and runningyarn test packages/react/src/components/DataTable
:Disregarding the reasoning above, the change to mark the prop as optional seems correct because it doesn't make sense for a deprecated prop to be required. This change also demonstrates that the old types for the
OverflowMenu
component weren't being applied because if they were, there would have been a type error in TableToolbarMenu.tsx.