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

updates LayoutTypeSwitcher to use ToggleGroupControl #65498

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Changes from all 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
29 changes: 17 additions & 12 deletions packages/block-editor/src/hooks/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { addFilter } from '@wordpress/hooks';
import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks';
import { useSelect } from '@wordpress/data';
import {
Button,
ButtonGroup,
__experimentalToggleGroupControl as ToggleGroupControl,
__experimentalToggleGroupControlOption as ToggleGroupControlOption,
ToggleControl,
PanelBody,
privateApis as componentsPrivateApis,
Expand Down Expand Up @@ -315,21 +315,26 @@ export default {

function LayoutTypeSwitcher( { type, onChange } ) {
return (
<ButtonGroup>
<ToggleGroupControl
__next40pxDefaultSize
isBlock
label={ __( 'Layout type' ) }
__nextHasNoMarginBottom
hideLabelFromVision
isAdaptiveWidth
value={ type }
onChange={ onChange }
>
{ getLayoutTypes().map( ( { name, label } ) => {
return (
<Button
// TODO: Switch to `true` (40px size) if possible
__next40pxDefaultSize={ false }
<ToggleGroupControlOption
key={ name }
isPressed={ type === name }
onClick={ () => onChange( name ) }
>
{ label }
</Button>
value={ name }
label={ label }
/>
);
} ) }
</ButtonGroup>
</ToggleGroupControl>
);
}

Expand Down
Loading