Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Social Icon: Migrate to Toolspanel #67974

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading