Skip to content

Commit

Permalink
Global Styles: Move the 'Edit colors' button to a standard menu item (#…
Browse files Browse the repository at this point in the history
…36842)

* Move changes to the new palette edit component

* Remove redundant style

* Change class name to match existing

Co-authored-by: Glen Davies <[email protected]>
  • Loading branch information
2 people authored and noisysocks committed Dec 13, 2021
1 parent 5ce42ff commit dab0864
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
30 changes: 14 additions & 16 deletions packages/components/src/palette-edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,22 +292,8 @@ export default function PaletteEdit( {
} }
/>
) }
{ ! isEditing && (
<Button
disabled={ ! hasElements }
isSmall
icon={ moreVertical }
label={
isGradient
? __( 'Edit gradients' )
: __( 'Edit colors' )
}
onClick={ () => {
setIsEditing( true );
} }
/>
) }
{ isEditing && ( canReset || ! canOnlyChangeValues ) && (

{ hasElements && ( canReset || ! canOnlyChangeValues ) && (
<DropdownMenu
icon={ moreVertical }
label={
Expand All @@ -322,6 +308,17 @@ export default function PaletteEdit( {
{ ( { onClose } ) => (
<>
<NavigableMenu role="menu">
<Button
variant="tertiary"
disabled={ isEditing }
onClick={ () => {
setIsEditing( true );
onClose();
} }
className="components-palette-edit__menu-button"
>
{ __( 'Edit custom colors' ) }
</Button>
{ ! canOnlyChangeValues && (
<Button
variant="tertiary"
Expand All @@ -331,6 +328,7 @@ export default function PaletteEdit( {
onChange();
onClose();
} }
className="components-palette-edit__menu-button"
>
{ isGradient
? __(
Expand Down
5 changes: 5 additions & 0 deletions packages/components/src/palette-edit/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,8 @@
padding: 8px;
}
}
.components-dropdown-menu__menu {
.components-palette-edit__menu-button {
width: 100%;
}
}

0 comments on commit dab0864

Please sign in to comment.