Skip to content
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
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- `Flex`, `FlexItem`, `FlexBlock`: Convert to TypeScript ([#42537](https://github.com/WordPress/gutenberg/pull/42537)).
- `InputControl`: Fix incorrect `size` prop passing ([#42793](https://github.com/WordPress/gutenberg/pull/42793)).
- `Popover`: rewrite Storybook examples using controls [#42903](https://github.com/WordPress/gutenberg/pull/42903)).
- `Swatch`: Convert to TypeScript ([#42162](https://github.com/WordPress/gutenberg/pull/42162)).

## 19.16.0 (2022-07-27)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ import { swatch } from '@wordpress/icons';
* Internal dependencies
*/
import Icon from '../icon';
import type { SwatchProps } from './types';

function Swatch( { fill } ) {
// This component will be deprecated. Use `ColorIndicator` instead.
// TODO: Consolidate this component with `ColorIndicator`.
function Swatch( { fill }: SwatchProps ) {
Comment thread
walbo marked this conversation as resolved.
Resolved
return fill ? (
<span className="components-swatch" style={ { background: fill } } />
) : (
Expand Down
11 changes: 11 additions & 0 deletions packages/components/src/swatch/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* External dependencies
*/
import type { CSSProperties } from 'react';

export type SwatchProps = {
/**
* The color to display in the swatch.
*/
fill?: CSSProperties[ 'background' ];
};
1 change: 1 addition & 0 deletions packages/components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"src/spacer/**/*",
"src/spinner/**/*",
"src/surface/**/*",
"src/swatch/**/*",
"src/text/**/*",
"src/text-control/**/*",
"src/text-highlight/**/*",
Expand Down