Skip to content

Commit

Permalink
updates LayoutTypeSwitcher to use ToggleGroupControl (#65498)
Browse files Browse the repository at this point in the history
* updates LayoutTypeSwitcher to useToggleGroupControl

* updates label and corrects LayoutTypeSwitcher component misconfiguration

Co-authored-by: spadeshoe <spdft@git.wordpress.org>
Co-authored-by: mirka <0mirka00@git.wordpress.org>
  • Loading branch information
3 people authored and gutenbergplugin committed Sep 30, 2024
1 parent 88d6723 commit 2233538
Showing 1 changed file with 17 additions and 12 deletions.
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

1 comment on commit 2233538

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 2233538.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/11097523059
📝 Reported issues:

Please sign in to comment.