Skip to content

Commit

Permalink
Refactor "Settings" panel of Social Icons block to use ToolsPanel ins…
Browse files Browse the repository at this point in the history
…tead of PanelBody (#67975)

Co-authored-by: Mayank-Tripathi32 <mayanktripathi32@git.wordpress.org>
Co-authored-by: fabiankaegy <fabiankaegy@git.wordpress.org>
3 people authored Dec 13, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 18e4eda commit 75289cf
Showing 1 changed file with 44 additions and 15 deletions.
59 changes: 44 additions & 15 deletions packages/block-library/src/social-links/edit.js
Original file line number Diff line number Diff line change
@@ -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 ) {
</ToolbarDropdownMenu>
</BlockControls>
<InspectorControls>
<PanelBody title={ __( 'Settings' ) }>
<ToggleControl
__nextHasNoMarginBottom
<ToolsPanel
label={ __( 'Settings' ) }
resetAll={ () => {
setAttributes( {
openInNewTab: false,
showLabels: false,
} );
} }
>
<ToolsPanelItem
isShownByDefault
label={ __( 'Open links in new tab' ) }
checked={ openInNewTab }
onChange={ () =>
setAttributes( { openInNewTab: ! openInNewTab } )
hasValue={ () => !! openInNewTab }
onDeselect={ () =>
setAttributes( { openInNewTab: false } )
}
/>
<ToggleControl
__nextHasNoMarginBottom
>
<ToggleControl
__nextHasNoMarginBottom
label={ __( 'Open links in new tab' ) }
checked={ openInNewTab }
onChange={ () =>
setAttributes( {
openInNewTab: ! openInNewTab,
} )
}
/>
</ToolsPanelItem>
<ToolsPanelItem
isShownByDefault
label={ __( 'Show text' ) }
checked={ showLabels }
onChange={ () =>
setAttributes( { showLabels: ! showLabels } )
hasValue={ () => !! showLabels }
onDeselect={ () =>
setAttributes( { showLabels: false } )
}
/>
</PanelBody>
>
<ToggleControl
__nextHasNoMarginBottom
label={ __( 'Show text' ) }
checked={ showLabels }
onChange={ () =>
setAttributes( { showLabels: ! showLabels } )
}
/>
</ToolsPanelItem>
</ToolsPanel>
</InspectorControls>
{ colorGradientSettings.hasColorsOrGradients && (
<InspectorControls group="color">

1 comment on commit 75289cf

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 75289cf.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12318087193
📝 Reported issues:

Please sign in to comment.