-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
ColorPicker: TypeScript refactor #49214
Conversation
Size Change: 0 B Total Size: 1.34 MB ℹ️ View Unchanged
|
Flaky tests detected in b0e9423. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4503717638
|
Addressed latest feedback and updated PR to no longer be a draft |
7b40ebf
to
b3d6b61
Compare
@@ -31,13 +31,13 @@ The current color value to display in the picker. Must be a hex or hex8 string. | |||
|
|||
### `onChange`: `(hex8Color: string) => void` | |||
|
|||
Fired when the color changes. Always passes a hex8 color string. | |||
Fired when the color changes. Always passes a hex or hex8 color string. |
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.
onChange
previously always passed a hex8 string, but since #35562, Colord.toHex()
will return a hex or a hex8 (hex8 only if the color's alpha is < 1)
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.
Nice catch, thank you!
b3d6b61
to
ff362ff
Compare
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.
🚀
- No runtime changes
- Types moved to the same
types.ts
file - Better Storybook examples and auto-generated docs
- Updated some prop descriptions and a unit tests that was still relying on the old color format
What?
Refactor
ColorPicker
component's tests and stories to TypeScriptPart of #35744
Why?
The refactor to TypeScript has many benefits (auto-generated docs, static linting and error prevention, better IDE experience). See #35744 for more details
For
ColorPicker
, the component itself is already written in TypeScript, tests and stories are all that need to be fully refactored.How?
Followed the steps in the TypeScript migration guide
Testing Instructions