Skip to content

Commit

Permalink
Remove: Use colors hook
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgefilipecosta committed May 3, 2021
1 parent ab2a61a commit 5473194
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 352 deletions.
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';
315 changes: 0 additions & 315 deletions packages/block-editor/src/components/colors/use-colors.js

This file was deleted.

0 comments on commit 5473194

Please sign in to comment.