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

Replace PanelBody with ToolsPanel in columns block #67910

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
Replace PanelBody with ToolsPanel in columns block
  • Loading branch information
prasadkarmalkar committed Dec 13, 2024
commit bdd899a7af532a361e3ddadae32577d54c322f9e
47 changes: 36 additions & 11 deletions packages/block-library/src/columns/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import clsx from 'clsx';
import { __ } from '@wordpress/i18n';
import {
Notice,
PanelBody,
RangeControl,
ToggleControl,
__experimentalToolsPanel as ToolsPanel,
__experimentalToolsPanelItem as ToolsPanelItem,
} from '@wordpress/components';

import {
Expand Down Expand Up @@ -149,9 +150,22 @@ function ColumnInspectorControls( {
}

return (
<PanelBody title={ __( 'Settings' ) }>
<ToolsPanel
label={ __( 'Settings' ) }
resetAll={ () => {
updateColumns( count, minCount );
setAttributes( {
isStackedOnMobile: true,
} );
} }
>
{ canInsertColumnBlock && (
<>
<ToolsPanelItem
label={ __( 'Columns' ) }
isShownByDefault
hasValue={ () => count }
onDeselect={ () => updateColumns( count, minCount ) }
>
<RangeControl
__nextHasNoMarginBottom
__next40pxDefaultSize
Expand All @@ -170,19 +184,30 @@ function ColumnInspectorControls( {
) }
</Notice>
) }
</>
</ToolsPanelItem>
) }
<ToggleControl
__nextHasNoMarginBottom
<ToolsPanelItem
label={ __( 'Stack on mobile' ) }
checked={ isStackedOnMobile }
onChange={ () =>
isShownByDefault
hasValue={ () => isStackedOnMobile !== true }
onDeselect={ () =>
setAttributes( {
isStackedOnMobile: ! isStackedOnMobile,
isStackedOnMobile: true,
} )
}
/>
</PanelBody>
>
<ToggleControl
__nextHasNoMarginBottom
label={ __( 'Stack on mobile' ) }
checked={ isStackedOnMobile }
onChange={ () =>
setAttributes( {
isStackedOnMobile: ! isStackedOnMobile,
} )
}
/>
</ToolsPanelItem>
</ToolsPanel>
);
}

Expand Down
Loading