diff --git a/packages/block-library/src/site-logo/edit.js b/packages/block-library/src/site-logo/edit.js index 36c217c1bf0c79..074235b5f5d64b 100644 --- a/packages/block-library/src/site-logo/edit.js +++ b/packages/block-library/src/site-logo/edit.js @@ -14,7 +14,6 @@ import { } from '@wordpress/element'; import { __, isRTL } from '@wordpress/i18n'; import { - PanelBody, RangeControl, ResizableBox, Spinner, @@ -24,6 +23,8 @@ import { Button, DropZone, FlexItem, + __experimentalToolsPanel as ToolsPanel, + __experimentalToolsPanelItem as ToolsPanelItem, __experimentalItemGroup as ItemGroup, __experimentalHStack as HStack, __experimentalTruncate as Truncate, @@ -278,31 +279,55 @@ const SiteLogo = ( { return ( <> - - + !! width } label={ __( 'Image width' ) } - onChange={ ( newWidth ) => - setAttributes( { width: newWidth } ) + onDeselect={ () => + setAttributes( { width: undefined } ) } - min={ minWidth } - max={ maxWidthBuffer } - initialPosition={ Math.min( - defaultWidth, - maxWidthBuffer - ) } - value={ width || '' } - disabled={ ! isResizable } - /> - + + setAttributes( { width: newWidth } ) + } + min={ minWidth } + max={ maxWidthBuffer } + initialPosition={ Math.min( + defaultWidth, + maxWidthBuffer + ) } + value={ width || '' } + disabled={ ! isResizable } + /> + + + !! isLink } label={ __( 'Link image to home' ) } - onChange={ () => setAttributes( { isLink: ! isLink } ) } - checked={ isLink } - /> + onDeselect={ () => setAttributes( { isLink: false } ) } + > + + setAttributes( { isLink: ! isLink } ) + } + checked={ isLink } + /> + + { isLink && ( - <> + linkTarget === '_blank' } + label={ __( 'Open in new tab' ) } + onDeselect={ () => + setAttributes( { linkTarget: '_self' } ) + } + > - + ) } + { canUserEdit && ( - <> + !! shouldSyncIcon } + label={ __( 'Use as Site Icon' ) } + onDeselect={ () => { + setAttributes( { shouldSyncIcon: false } ); + setIcon( undefined ); + } } + > - + ) } - + { canEditImage && ! isEditingImage && ( @@ -597,8 +630,20 @@ export default function LogoEdit( { const mediaInspectorPanel = ( canUserEdit || logoUrl ) && ( - -
+ { + setAttributes( { + logoUrl: null, + mediaItemData: null, + } ); + } } + > + !! logoUrl && ! canUserEdit } + label={ __( 'Preview Logo (Read-only)' ) } + resetAll={ () => setAttributes( { logoUrl: null } ) } + > { ! canUserEdit && !! logoUrl && ( ) } + + !! logoUrl && canUserEdit } + label={ __( 'Replace Logo' ) } + resetAll={ () => setAttributes( { logoUrl: null } ) } + > { canUserEdit && !! logoUrl && ( ) } + + ! logoUrl && canUserEdit } + label={ __( 'Upload Logo' ) } + resetAll={ () => setAttributes( { logoUrl: null } ) } + > { canUserEdit && ! logoUrl && ( ) } -
-
+ +
);