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

Refactor "Settings" panel of Next Post block to use ToolsPanel instead of PanelBody #67976

Open
wants to merge 5 commits into
base: trunk
Choose a base branch
from
Open
Changes from 3 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
108 changes: 62 additions & 46 deletions packages/block-library/src/post-navigation-link/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
ToggleControl,
SelectControl,
PanelBody,
__experimentalToolsPanel as ToolsPanel,
__experimentalToolsPanelItem as ToolsPanelItem,
} from '@wordpress/components';
import {
InspectorControls,
Expand Down Expand Up @@ -94,20 +95,28 @@ export default function PostNavigationLinkEdit( {
return (
<>
<InspectorControls>
<PanelBody>
<ToggleControl
__nextHasNoMarginBottom
<ToolsPanel label={ __( 'Settings' ) }>
rinkalpagdar marked this conversation as resolved.
Show resolved Hide resolved
<ToolsPanelItem
rinkalpagdar marked this conversation as resolved.
Show resolved Hide resolved
hasValue={ () => !! 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 } )
}
/>
>
<ToggleControl
__nextHasNoMarginBottom
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,
} )
}
/>
</ToolsPanelItem>
{ showTitle && (
<ToggleControl
rinkalpagdar marked this conversation as resolved.
Show resolved Hide resolved
__nextHasNoMarginBottom
Expand All @@ -120,44 +129,51 @@ export default function PostNavigationLinkEdit( {
linkLabel: ! linkLabel,
} )
}
isShownByDefault
/>
) }
<ToggleGroupControl
__next40pxDefaultSize
__nextHasNoMarginBottom
<ToolsPanelItem
hasValue={ () => !! arrow }
label={ __( 'Arrow' ) }
value={ arrow }
onChange={ ( value ) => {
setAttributes( { arrow: value } );
} }
help={ __(
'A decorative arrow for the next and previous link.'
) }
isBlock
onDeselect={ () => setAttributes( { arrow: 'none' } ) }
>
<ToggleGroupControlOption
value="none"
label={ _x(
'None',
'Arrow option for Next/Previous link'
) }
/>
<ToggleGroupControlOption
value="arrow"
label={ _x(
'Arrow',
'Arrow option for Next/Previous link'
) }
/>
<ToggleGroupControlOption
value="chevron"
label={ _x(
'Chevron',
'Arrow option for Next/Previous link'
<ToggleGroupControl
__next40pxDefaultSize
__nextHasNoMarginBottom
label={ __( 'Arrow' ) }
value={ arrow }
onChange={ ( value ) => {
setAttributes( { arrow: value } );
} }
help={ __(
'A decorative arrow for the next and previous link.'
) }
/>
</ToggleGroupControl>
</PanelBody>
isBlock
>
<ToggleGroupControlOption
value="none"
label={ _x(
'None',
'Arrow option for Next/Previous link'
) }
/>
<ToggleGroupControlOption
value="arrow"
label={ _x(
'Arrow',
'Arrow option for Next/Previous link'
) }
/>
<ToggleGroupControlOption
value="chevron"
label={ _x(
'Chevron',
'Arrow option for Next/Previous link'
) }
/>
</ToggleGroupControl>
</ToolsPanelItem>
</ToolsPanel>
</InspectorControls>
<InspectorControls group="advanced">
<SelectControl
Expand Down
Loading