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

Remove: __experimentalUseColors hook #31438

Merged
merged 1 commit into from
May 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
36 changes: 0 additions & 36 deletions packages/block-editor/src/components/colors/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,42 +35,6 @@ export default compose(
MyColorfulComponent
);
```

## `useColors` hook

Provides the functionality of `withColors` as a React hook, see [React's hook overview](https://reactjs.org/docs/hooks-overview.html) for additional details on using hooks.

It takes an array of color configuration objects for its first parameter. The second parameter is an optional hooks dependency array for cases where you have closures in your configuration objects, and the third is an optional string to overwrite the default panel title, `__( 'Color Settings' )`.

### Usage

```jsx
import { __experimentalUseColors } from '@wordpress/block-editor';

function MyColorfulComponent() {
const { TextColor } = __experimentalUseColors(
[ { name: 'textColor', property: 'color' } ],
{
contrastCheckers: [
{
textColor: true,
},
],
}
);

return (
<>
<TextColor>{ /* Colorful content */ }</TextColor>
</>
);
}
```

### Note on sunsetting.

The functionality provided by the `useColors` hook is also available in the form of a—[also currently experimental](https://github.com/WordPress/gutenberg/pull/21021)—support key, `__experimentalColor`. It's expected that the support key version of this feature sunsets the hook.

## Related components.

- [`PanelColorSettings`](https://github.com/WordPress/gutenberg/blob/bb00ad891db9937862b16867dcebd2a4d830ea86/packages/block-editor/src/components/panel-color-settings/index.js).
Expand Down
1 change: 0 additions & 1 deletion packages/block-editor/src/components/colors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ export {
getColorObjectByColorValue,
} from './utils';
export { createCustomColorsHOC, default as withColors } from './with-colors';
export { default as __experimentalUseColors } from './use-colors';
314 changes: 0 additions & 314 deletions packages/block-editor/src/components/colors/use-colors.js

This file was deleted.