Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Convert the
ColorPalette
component to TypeScript (#44632)
* Convert the ColorPalette component to TypeScript There are some ts-ignore statements that would be good to remove. * Correct the PR number in the CHANGELOG * Apply Marco's suggestion to remove ts-ignore comments Destructure props int constants after the function signature, not inside it. * Replace complex type with ReactNode, thanks to Marco's suggestion * Apply Marco's suggestions for TS verbatim #44632 (review) * Prevent an error from colors possibly being undefined Types of property 'colors' are incompatible. Type 'Colors | undefined' is not assignable to type '(Color | MultipleColors)[]'. Type 'undefined' is not assignable to type '(Color | MultipleColors)[]'. * Rename Color and MultipleColors to ColorObject and PaletteObject * Alphabetize the imports again * Remove another needless ts-ignore comment * Revert "Prevent an error from colors possibly being undefined" This reverts commit 7fe648e. * Make colors allow undefined * Make actions optional, which I forgot before * Commit Marco's changes, including a named export * Add default tags, thanks to Marco's idea * Apply Marco's suggestion to remove ts-ignore Add 'as CSSProperties' to remove the need for ts-ignore * Apply Marco's suggestions, creating UnforwardedColorProps The jsx example might not be right. Also, I added a description for the component in the JS DocBlock, as there wasn't one in README.md. But maybe that's not right. * Fix a linting error, remove needless className * Commit Marco's suggestion: Update packages/components/src/color-palette/stories/index.tsx Co-authored-by: Marco Ciampini <[email protected]> * Commit Marco's suggestion: Update packages/components/src/color-palette/types.ts Co-authored-by: Marco Ciampini <[email protected]> * Rename test/index.js to test/indes.tsx, mv snapshot * Add types to test/index.tsx * Renamce styles.js to styles.ts * Commit Marco's suggestion: Update packages/components/src/color-palette/types.ts Co-authored-by: Marco Ciampini <[email protected]> * Revert "Add types to test/index.tsx" This reverts commit 06f7c4e. * Paste Marco's description verbatim #44632 (review) * Copy props verbatim from types.ts into README.md * Update the JSDoc description to be the same as the README.md description The usage example was already the same as in the README.md * Remove extra entry for Tooltip I think I added this when merging in trunk and resolving the conflicts. * Move the CHANGELOG entry up, to Unreleased * Move Usage section to the top of the README. remove experimental props from README * Commit Marco's suggestion: Update packages/components/src/color-palette/README.md Co-authored-by: Marco Ciampini <[email protected]> * Remove the example of the full props * Change the props format to match CONTRIBUTING.md https://github.com/WordPress/gutenberg/blob/a42805e157f6c6933f4ef7cabcfc87fa3af81aea/packages/components/CONTRIBUTING.md#readme-example * Commit Marco's suggestion: Update packages/components/src/color-palette/stories/index.tsx Co-authored-by: Marco Ciampini <[email protected]> * Commit Marco's suggestion: Update packages/components/src/color-palette/types.ts Co-authored-by: Marco Ciampini <[email protected]> * Commit Marco's suggestion: Update packages/components/src/color-palette/types.ts Co-authored-by: Marco Ciampini <[email protected]> * Commit Marco's suggestion: Update packages/components/src/color-palette/types.ts Co-authored-by: Marco Ciampini <[email protected]> Co-authored-by: Marco Ciampini <[email protected]>
- Loading branch information