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 <mayanktripathi32@git.wordpress.org>
Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org>
  • Loading branch information
3 people authored Dec 13, 2024
1 parent 2b5da49 commit afb6752
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 afb6752

Please sign in to comment.