-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
components: Add deprecated props adapter for ColorPicker #34014
Conversation
Size Change: +223 B (0%) Total Size: 1.03 MB
ℹ️ View Unchanged
|
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.
This looks really good already, @sarayourfriend !
packages/components/src/ui/color-picker/use-deprecated-props.ts
Outdated
Show resolved
Hide resolved
packages/components/src/ui/color-picker/use-deprecated-props.ts
Outdated
Show resolved
Hide resolved
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.
LGTM! The legacy adapter is quite neat 🚀
Do you think we should write any unit tests to make sure that the adaptation layer works as intended/avoid regressions?
Description
Adds a
useDeprecatedProps
hook as well as a LegacyAdapter component that acts as a proxy for the new color picker and transforms the deprecated props into the new version of the props (while also allowing for the new props to be passed directly).How has this been tested?
Storybook. The existing story for the new color picker should continue to work (even though it is now using the LegacyAdapter). Likewise, the new story for the legacy adapter should work with all the features of the new color picker correctly working as well as the correct shape of the legacy color values being emitted in the "onChangeComplete" prop. Please refer to the
colorToState
incomponents/src/color-picker/utils.js
to double check the shape of the color picker change object.Types of changes
New feature
Checklist:
*.native.js
files for terms that need renaming or removal).