Skip to content

Commit

Permalink
DuotonePicker: Simplify Button styles (#66641)
Browse files Browse the repository at this point in the history
* DuotonePicker: Simplify Button styles

* Add changelog

Co-authored-by: mirka <[email protected]>
Co-authored-by: tyxla <[email protected]>
  • Loading branch information
3 people authored Nov 27, 2024
1 parent 8dd99aa commit 6781982
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
- `Autocomplete`: Increase option height ([#67214](https://github.com/WordPress/gutenberg/pull/67214)).
- `DropZone`: Add `isEligible` prop to allow customizing whether the drop zone should activate ([#67317](https://github.com/WordPress/gutenberg/pull/67317)).
- `CircularOptionPicker`: Update `Button` sizes to be ready for 40px default size ([#67285](https://github.com/WordPress/gutenberg/pull/67285)).
- `DuotonePicker`: Simplify Button styles ([#66641](https://github.com/WordPress/gutenberg/pull/66641)).

### Experimental

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import Button from '../../button';
import ColorPalette from '../../color-palette';
import ColorIndicator from '../../color-indicator';
import Icon from '../../icon';
import { HStack } from '../../h-stack';
import type { ColorListPickerProps, ColorOptionProps } from './types';
import { useInstanceId } from '@wordpress/compose';

Expand All @@ -32,23 +31,24 @@ function ColorOption( {
return (
<>
<Button
__next40pxDefaultSize
className="components-color-list-picker__swatch-button"
id={ labelId }
onClick={ () => setIsOpen( ( prev ) => ! prev ) }
aria-expanded={ isOpen }
aria-controls={ contentId }
>
<HStack justify="flex-start" spacing={ 2 }>
{ value ? (
icon={
value ? (
<ColorIndicator
colorValue={ value }
className="components-color-list-picker__swatch-color"
/>
) : (
<Icon icon={ swatch } />
) }
<span id={ labelId }>{ label }</span>
</HStack>
</Button>
)
}
text={ label }
/>
<div
role="group"
id={ contentId }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
margin: $grid-unit-10 0;
}

.components-color-list-picker__swatch-button {
// Used to simulate styles as a .button.has-icon (which this component can't
// opt into, because it has to show more than a simple SVG as the "icon")
padding: 6px;
}

.components-color-list-picker__swatch-color {
// Match the 24px size of the `swatch` icon (used when no color is set)
margin: 2px;
Expand Down

0 comments on commit 6781982

Please sign in to comment.