diff --git a/packages/edit-site/src/components/global-styles/shadows-edit-panel.js b/packages/edit-site/src/components/global-styles/shadows-edit-panel.js index 780b5684f62030..b2c5c5a59bf742 100644 --- a/packages/edit-site/src/components/global-styles/shadows-edit-panel.js +++ b/packages/edit-site/src/components/global-styles/shadows-edit-panel.js @@ -16,11 +16,15 @@ import { __experimentalGrid as Grid, __experimentalDropdownContentWrapper as DropdownContentWrapper, __experimentalUseNavigator as useNavigator, + __experimentalToggleGroupControl as ToggleGroupControl, + __experimentalToggleGroupControlOption as ToggleGroupControlOption, Dropdown, + DropdownMenu, + NavigableMenu, RangeControl, Button, FlexItem, - ColorPicker, + ColorPalette, } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; @@ -30,6 +34,7 @@ import { shadow as shadowIcon, lineSolid, settings, + moreVertical, } from '@wordpress/icons'; import { useState, useMemo } from '@wordpress/element'; import { debounce } from '@wordpress/compose'; @@ -49,6 +54,21 @@ import { const { useGlobalSetting } = unlock( blockEditorPrivateApis ); +const menuItems = [ + { + label: __( 'Rename' ), + action: 'rename', + }, + { + label: __( 'Duplicate' ), + action: 'duplicate', + }, + { + label: __( 'Delete' ), + action: 'delete', + }, +]; + export default function ShadowsEditPanel() { const { params: { category, slug }, @@ -67,9 +87,53 @@ export default function ShadowsEditPanel() { ); }, 100 ); + const onMenuClick = ( action ) => { + switch ( action ) { + case 'rename': + break; + case 'duplicate': + break; + case 'delete': + break; + } + }; + return ( <> - + + + + + + { ( { onClose } ) => + menuItems.map( ( item ) => ( + + + + ) ) + } + + + +
- Drop shadow + { shadowObj.inset + ? __( 'Inner shadow' ) + : __( 'Drop shadow' ) } { canRemove && (
@@ -223,8 +290,7 @@ function ShadowItem( { shadow, onChange, canRemove, onRemove } ) { ); } -function ShadowPopover( { shadow: savedShadow, onChange } ) { - const shadowObj = shadowStringToObject( savedShadow ); +function ShadowPopover( { shadowObj, onChange } ) { const [ shadow, setShadow ] = useState( { x: shadowObj.x, y: shadowObj.y, @@ -233,6 +299,8 @@ function ShadowPopover( { shadow: savedShadow, onChange } ) { color: shadowObj.color, inset: shadowObj.inset, } ); + const __experimentalIsRenderedInSidebar = true; + const enableAlpha = true; const onShadowChange = ( key, value ) => { onChange( shadowObjectToString( shadow ) ); @@ -243,35 +311,58 @@ function ShadowPopover( { shadow: savedShadow, onChange } ) { }; return ( -
+
- { __( 'Drop shadow' ) } - - onShadowChange( 'color', value ) } - /> - - + { __( 'Shadow' ) } +
+ + onShadowChange( 'color', value ) + } + /> +
+ + onShadowChange( 'inset', value === 'inset' ) + } + > + + + + onShadowChange( 'x', value ) } /> onShadowChange( 'y', value ) } /> onShadowChange( 'blur', value ) } /> onShadowChange( 'spread', value ) @@ -283,49 +374,6 @@ function ShadowPopover( { shadow: savedShadow, onChange } ) { ); } -function ShadowColorPicker( { color, onChange } ) { - const popoverProps = { - placement: 'left-start', - offset: 36, - shift: true, - }; - - return ( - { - const toggleProps = { - onClick: onToggle, - className: classnames( - 'block-editor-panel-color-gradient-settings__dropdown', - { 'is-open': isOpen } - ), - }; - - return ( -