Skip to content

Commit

Permalink
refactor: revert toggle markup and use consistent wording
Browse files Browse the repository at this point in the history
  • Loading branch information
yogeshbhutkar committed Feb 3, 2025
1 parent 6fa7b84 commit 8fc1b13
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ import { __ } from '@wordpress/i18n';
import {
__experimentalVStack as VStack,
__experimentalHeading as Heading,
__experimentalHStack as HStack,
__experimentalDropdownContentWrapper as DropdownContentWrapper,
Button,
FlexItem,
Dropdown,
Composite,
Tooltip,
Expand Down Expand Up @@ -150,17 +152,20 @@ function renderShadowToggle( shadow, onShadowChange ) {
'block-editor-global-styles__shadow-editor__remove-button',
{ 'is-open': isOpen }
),
label: __( 'Remove shadow' ),
label: __( 'Remove' ),
};

return (
<>
<Button
__next40pxDefaultSize
icon={ shadowIcon }
{ ...toggleProps }
>
{ __( 'Drop shadow' ) }
<Button __next40pxDefaultSize { ...toggleProps }>
<HStack justify="flex-start">
<Icon
className="block-editor-global-styles__toggle-icon"
icon={ shadowIcon }
size={ 24 }
/>
<FlexItem>{ __( 'Drop shadow' ) }</FlexItem>
</HStack>
</Button>
{ !! shadow && (
<Button
Expand Down
15 changes: 7 additions & 8 deletions packages/block-editor/src/components/global-styles/style.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
.block-editor-global-styles__toggle-icon {
fill: currentColor;
}

// @todo Ideally, popover, swatch size, and gap values should be CSS variables
// to apply precise grid layouts.
// https://github.com/WordPress/gutenberg/blob/954ecae571abbddc113d3a4bd8e1a72230180554/packages/block-editor/src/components/duotone-control/style.scss#L3-L9
Expand Down Expand Up @@ -32,20 +36,15 @@
}
}

.block-editor-global-styles__shadow-dropdown {
> .components-button.has-icon.has-text:first-child {
gap: $grid-unit-10;
}
}

.block-editor-global-styles__shadow-editor__remove-button {
position: absolute;
right: 0;
top: $grid-unit;
margin: auto $grid-unit auto;
opacity: 0;
transition: opacity 0.1s ease-in-out;
@include reduce-motion("transition");
@media not (prefers-reduced-motion) {
transition: opacity 0.1s ease-in-out;
}

.block-editor-global-styles__shadow-dropdown:hover &,
&:focus,
Expand Down

0 comments on commit 8fc1b13

Please sign in to comment.