Skip to content

Commit

Permalink
More Block: Refactor settings panel to use ToolsPanel (WordPress#67905)
Browse files Browse the repository at this point in the history
Co-authored-by: im3dabasia <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: Mayank-Tripathi32 <[email protected]>
Co-authored-by: fabiankaegy <[email protected]>
  • Loading branch information
5 people authored Dec 16, 2024
1 parent 2cdd37d commit 5b7926b
Showing 1 changed file with 32 additions and 12 deletions.
44 changes: 32 additions & 12 deletions packages/block-library/src/more/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';
import { PanelBody, ToggleControl } from '@wordpress/components';
import {
__experimentalToolsPanel as ToolsPanel,
__experimentalToolsPanelItem as ToolsPanelItem,
ToggleControl,
} from '@wordpress/components';
import { InspectorControls, useBlockProps } from '@wordpress/block-editor';
import { ENTER } from '@wordpress/keycodes';
import { getDefaultBlockName, createBlock } from '@wordpress/blocks';
Expand Down Expand Up @@ -40,17 +44,33 @@ export default function MoreEdit( {
return (
<>
<InspectorControls>
<PanelBody>
<ToggleControl
__nextHasNoMarginBottom
label={ __(
'Hide the excerpt on the full content page'
) }
checked={ !! noTeaser }
onChange={ toggleHideExcerpt }
help={ getHideExcerptHelp }
/>
</PanelBody>
<ToolsPanel
label={ __( 'Settings' ) }
resetAll={ () => {
setAttributes( {
noTeaser: false,
} );
} }
>
<ToolsPanelItem
label={ __( 'Hide excerpt' ) }
isShownByDefault
hasValue={ () => noTeaser }
onDeselect={ () =>
setAttributes( { noTeaser: false } )
}
>
<ToggleControl
__nextHasNoMarginBottom
label={ __(
'Hide the excerpt on the full content page'
) }
checked={ !! noTeaser }
onChange={ toggleHideExcerpt }
help={ getHideExcerptHelp }
/>
</ToolsPanelItem>
</ToolsPanel>
</InspectorControls>
<div { ...useBlockProps() }>
<input
Expand Down

0 comments on commit 5b7926b

Please sign in to comment.