diff --git a/packages/block-library/src/post-navigation-link/edit.js b/packages/block-library/src/post-navigation-link/edit.js index e27d094feb79ab..6b31fe649f8071 100644 --- a/packages/block-library/src/post-navigation-link/edit.js +++ b/packages/block-library/src/post-navigation-link/edit.js @@ -11,7 +11,8 @@ import { __experimentalToggleGroupControlOption as ToggleGroupControlOption, ToggleControl, SelectControl, - PanelBody, + __experimentalToolsPanel as ToolsPanel, + __experimentalToolsPanelItem as ToolsPanelItem, } from '@wordpress/components'; import { InspectorControls, @@ -24,6 +25,11 @@ import { __, _x } from '@wordpress/i18n'; import { useSelect } from '@wordpress/data'; import { store as coreStore } from '@wordpress/core-data'; +/** + * Internal dependencies + */ +import { useToolsPanelDropdownMenuProps } from '../utils/hooks'; + export default function PostNavigationLinkEdit( { context: { postType }, attributes: { @@ -47,6 +53,7 @@ export default function PostNavigationLinkEdit( { }; const displayArrow = arrowMap[ arrow ]; + const dropdownMenuProps = useToolsPanelDropdownMenuProps(); if ( showTitle ) { placeholder = isNext @@ -94,70 +101,100 @@ export default function PostNavigationLinkEdit( { return ( <> - - + !! showTitle } label={ __( 'Display the title as a link' ) } - help={ __( - 'If you have entered a custom label, it will be prepended before the title.' - ) } - checked={ !! showTitle } - onChange={ () => - setAttributes( { - showTitle: ! showTitle, - } ) + onDeselect={ () => + setAttributes( { showTitle: false } ) } - /> - { showTitle && ( + isShownByDefault + > setAttributes( { - linkLabel: ! linkLabel, + showTitle: ! showTitle, } ) } /> + + { showTitle && ( + !! linkLabel } + label={ __( + 'Include the label as part of the link' + ) } + onDeselect={ () => + setAttributes( { linkLabel: false } ) + } + isShownByDefault + > + + setAttributes( { + linkLabel: ! linkLabel, + } ) + } + /> + ) } - arrow !== 'none' } label={ __( 'Arrow' ) } - value={ arrow } - onChange={ ( value ) => { - setAttributes( { arrow: value } ); - } } - help={ __( - 'A decorative arrow for the next and previous link.' - ) } - isBlock + onDeselect={ () => setAttributes( { arrow: 'none' } ) } + isShownByDefault > - - - { + setAttributes( { arrow: value } ); + } } + help={ __( + 'A decorative arrow for the next and previous link.' ) } - /> - - + isBlock + > + + + + + +