Skip to content

Commit

Permalink
Refactor "Settings" panel of Social Icon block to use ToolsPanel inst…
Browse files Browse the repository at this point in the history
…ead of PanelBody (WordPress#67974)

Co-authored-by: Mayank-Tripathi32 <[email protected]>
Co-authored-by: fabiankaegy <[email protected]>
  • Loading branch information
3 people authored and yogeshbhutkar committed Dec 18, 2024
1 parent 33d0592 commit b332d2c
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions packages/block-library/src/social-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import { useState, useRef } from '@wordpress/element';
import {
Button,
Dropdown,
PanelBody,
PanelRow,
TextControl,
ToolbarButton,
__experimentalToolsPanel as ToolsPanel,
__experimentalToolsPanelItem as ToolsPanelItem,
__experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,
} from '@wordpress/components';
import { useMergeRefs } from '@wordpress/compose';
Expand Down Expand Up @@ -195,8 +195,20 @@ const SocialLinkEdit = ( {
</BlockControls>
) }
<InspectorControls>
<PanelBody title={ __( 'Settings' ) }>
<PanelRow>
<ToolsPanel
label={ __( 'Settings' ) }
resetAll={ () => {
setAttributes( { label: undefined } );
} }
>
<ToolsPanelItem
isShownByDefault
label={ __( 'Text' ) }
hasValue={ () => !! label }
onDeselect={ () => {
setAttributes( { label: undefined } );
} }
>
<TextControl
__next40pxDefaultSize
__nextHasNoMarginBottom
Expand All @@ -210,8 +222,8 @@ const SocialLinkEdit = ( {
}
placeholder={ socialLinkName }
/>
</PanelRow>
</PanelBody>
</ToolsPanelItem>
</ToolsPanel>
</InspectorControls>
<InspectorControls group="advanced">
<TextControl
Expand Down

0 comments on commit b332d2c

Please sign in to comment.