From 5371722e328e0b852c95fc0d6669cdd24156e330 Mon Sep 17 00:00:00 2001 From: Mayank-Tripathi32 Date: Thu, 12 Dec 2024 23:10:16 +0530 Subject: [PATCH] feat: migrate to ToolsPanel --- packages/block-library/src/button/edit.js | 56 ++++++++++++++--------- 1 file changed, 35 insertions(+), 21 deletions(-) diff --git a/packages/block-library/src/button/edit.js b/packages/block-library/src/button/edit.js index 2106c2031491fe..9f2a9048af4c0b 100644 --- a/packages/block-library/src/button/edit.js +++ b/packages/block-library/src/button/edit.js @@ -18,10 +18,11 @@ import { useEffect, useState, useRef, useMemo } from '@wordpress/element'; import { Button, ButtonGroup, - PanelBody, TextControl, ToolbarButton, Popover, + __experimentalToolsPanel as ToolsPanel, + __experimentalToolsPanelItem as ToolsPanelItem, } from '@wordpress/components'; import { AlignmentControl, @@ -123,26 +124,39 @@ function WidthPanel( { selectedWidth, setAttributes } ) { } return ( - - - { [ 25, 50, 75, 100 ].map( ( widthValue ) => { - return ( - - ); - } ) } - - + { + handleChange( undefined ); + } } + > + !! selectedWidth } + onDeselect={ () => handleChange( undefined ) } + > + + { [ 25, 50, 75, 100 ].map( ( widthValue ) => { + return ( + + ); + } ) } + + + ); }