From 75289cf599ec29cda2dfd6d75298252ec52fa0dc Mon Sep 17 00:00:00 2001 From: Mayank Tripathi <70465598+Mayank-Tripathi32@users.noreply.github.com> Date: Fri, 13 Dec 2024 20:36:17 +0530 Subject: [PATCH] Refactor "Settings" panel of Social Icons block to use ToolsPanel instead of PanelBody (#67975) Co-authored-by: Mayank-Tripathi32 Co-authored-by: fabiankaegy --- .../block-library/src/social-links/edit.js | 59 ++++++++++++++----- 1 file changed, 44 insertions(+), 15 deletions(-) diff --git a/packages/block-library/src/social-links/edit.js b/packages/block-library/src/social-links/edit.js index 068b34a3a70a4..af39219af25a1 100644 --- a/packages/block-library/src/social-links/edit.js +++ b/packages/block-library/src/social-links/edit.js @@ -22,9 +22,10 @@ import { import { MenuGroup, MenuItem, - PanelBody, ToggleControl, ToolbarDropdownMenu, + __experimentalToolsPanel as ToolsPanel, + __experimentalToolsPanelItem as ToolsPanelItem, } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { check } from '@wordpress/icons'; @@ -198,24 +199,52 @@ export function SocialLinksEdit( props ) { - - { + setAttributes( { + openInNewTab: false, + showLabels: false, + } ); + } } + > + - setAttributes( { openInNewTab: ! openInNewTab } ) + hasValue={ () => !! openInNewTab } + onDeselect={ () => + setAttributes( { openInNewTab: false } ) } - /> - + + setAttributes( { + openInNewTab: ! openInNewTab, + } ) + } + /> + + - setAttributes( { showLabels: ! showLabels } ) + hasValue={ () => !! showLabels } + onDeselect={ () => + setAttributes( { showLabels: false } ) } - /> - + > + + setAttributes( { showLabels: ! showLabels } ) + } + /> + + { colorGradientSettings.hasColorsOrGradients && (