From 9c048483d2fcfbd011f50d40d570cd343a05cea1 Mon Sep 17 00:00:00 2001 From: NidhiDhandhukiya74 Date: Fri, 13 Dec 2024 16:20:06 +0530 Subject: [PATCH] refactor site logo media panel --- packages/block-library/src/site-logo/edit.js | 34 +++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/packages/block-library/src/site-logo/edit.js b/packages/block-library/src/site-logo/edit.js index 36c217c1bf0c79..813a71cc30ab5e 100644 --- a/packages/block-library/src/site-logo/edit.js +++ b/packages/block-library/src/site-logo/edit.js @@ -24,6 +24,8 @@ import { Button, DropZone, FlexItem, + __experimentalToolsPanel as ToolsPanel, + __experimentalToolsPanelItem as ToolsPanelItem, __experimentalItemGroup as ItemGroup, __experimentalHStack as HStack, __experimentalTruncate as Truncate, @@ -597,8 +599,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 && ( ) } -
-
+ +
);