From 2b5da49117f7bca612099ae39e36c0c184bd4e99 Mon Sep 17 00:00:00 2001 From: Mayank Tripathi <70465598+Mayank-Tripathi32@users.noreply.github.com> Date: Fri, 13 Dec 2024 20:16:02 +0530 Subject: [PATCH] Refactor "Settings" panel of Details block to use ToolsPanel instead of PanelBody (#67966) Co-authored-by: Mayank-Tripathi32 Co-authored-by: fabiankaegy --- packages/block-library/src/details/edit.js | 44 ++++++++++++++++------ 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/packages/block-library/src/details/edit.js b/packages/block-library/src/details/edit.js index 314556ba6d591..14c89b7d0f9f0 100644 --- a/packages/block-library/src/details/edit.js +++ b/packages/block-library/src/details/edit.js @@ -9,7 +9,11 @@ import { InspectorControls, } from '@wordpress/block-editor'; import { useSelect } from '@wordpress/data'; -import { PanelBody, ToggleControl } from '@wordpress/components'; +import { + ToggleControl, + __experimentalToolsPanel as ToolsPanel, + __experimentalToolsPanelItem as ToolsPanelItem, +} from '@wordpress/components'; import { __ } from '@wordpress/i18n'; const TEMPLATE = [ @@ -46,18 +50,36 @@ function DetailsEdit( { attributes, setAttributes, clientId } ) { return ( <> - - { + setAttributes( { + showContent: false, + } ); + } } + > + + hasValue={ () => showContent } + onDeselect={ () => { setAttributes( { - showContent: ! showContent, - } ) - } - /> - + showContent: false, + } ); + } } + > + + setAttributes( { + showContent: ! showContent, + } ) + } + /> + +