Skip to content

Commit

Permalink
feat: migrate to toolspanel
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayank-Tripathi32 committed Dec 13, 2024
1 parent 8a10c75 commit ebbe821
Showing 1 changed file with 30 additions and 12 deletions.
42 changes: 30 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 {
ToggleControl,
__experimentalToolsPanel as ToolsPanel,
__experimentalToolsPanelItem as ToolsPanelItem,
} 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,31 @@ 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
isShownByDefault
label={ __( 'Hide the excerpt' ) }
onDeselect={ () => {
setAttributes( { noTeaser: false } );
} }
hasValue={ () => !! noTeaser }
>
<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 ebbe821

Please sign in to comment.