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

Global Styles: Move the 'Edit colors' button to a standard menu item #36842

Merged
merged 3 commits into from
Dec 13, 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
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"
>
Copy link
Member

@ramonjd ramonjd Dec 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to make this CSS class name more consistent with others in the component, e.g., components-palette-edit__menu-button

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point - have made this change

{ __( '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%;
}
}
glendaviesnz marked this conversation as resolved.
Show resolved Hide resolved