Skip to content
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

Merged
merged 6 commits into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make a more robust check for isLegacyProps
  • Loading branch information
sarayourfriend committed Aug 12, 2021
commit aea20573429831f8a71ae79eb4ba3c762d2f4f4b
3 changes: 1 addition & 2 deletions packages/components/src/ui/color-picker/stories/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { useState } from '@wordpress/element';
* Internal dependencies
*/
import { ColorPicker } from '..';
import { LegacyAdapter } from '../legacy-adapter';
import { Flex } from '../../../flex';
import { Spacer } from '../../../spacer';
import { space } from '../../utils/space';
Expand Down Expand Up @@ -69,7 +68,7 @@ const LegacyExample = () => {

return (
<Flex align="flex-start" justify="flex-start">
<LegacyAdapter { ...legacyProps } />
<ColorPicker { ...legacyProps } />
<pre style={ { width: '20em' } }>
{ JSON.stringify( legacyColor, undefined, 4 ) }
</pre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ export interface LegacyProps {
}

function isLegacyProps( props: any ): props is LegacyProps {
return typeof props.onChangeComplete !== 'undefined';
return (
typeof props.onChangeComplete !== 'undefined' ||
typeof props.color === 'string' ||
typeof props.hex === 'string'
sarayourfriend marked this conversation as resolved.
Show resolved Hide resolved
);
}

function getColorFromLegacyProps(
Expand Down