From 3b5bf634bac53c5a75f5b0bc90676a66c8c8a853 Mon Sep 17 00:00:00 2001 From: Matias Benedetto Date: Fri, 22 Nov 2024 14:03:51 -0300 Subject: [PATCH] Add section styles switch button in block toolbar in zoom out mode (#67140) * Add section styles switch button in zoom out toolbar * add icon background color * tweak label and strokeWidth * 1.25 > 1.5 --------- Co-authored-by: matiasbenedetto Co-authored-by: richtabor Co-authored-by: aaronrobertshaw Co-authored-by: ntsekouras Co-authored-by: mtias Co-authored-by: jasmussen --- .../src/components/block-toolbar/index.js | 6 + .../block-toolbar/switch-section-style.js | 115 ++++++++++++++++++ 2 files changed, 121 insertions(+) create mode 100644 packages/block-editor/src/components/block-toolbar/switch-section-style.js diff --git a/packages/block-editor/src/components/block-toolbar/index.js b/packages/block-editor/src/components/block-toolbar/index.js index b3bf7e94accb08..ea068d8126526c 100644 --- a/packages/block-editor/src/components/block-toolbar/index.js +++ b/packages/block-editor/src/components/block-toolbar/index.js @@ -36,6 +36,7 @@ import __unstableBlockNameContext from './block-name-context'; import NavigableToolbar from '../navigable-toolbar'; import { useHasBlockToolbar } from './use-has-block-toolbar'; import ChangeDesign from './change-design'; +import SwitchSectionStyle from './switch-section-style'; import { unlock } from '../../lock-unlock'; /** @@ -72,6 +73,7 @@ export function PrivateBlockToolbar( { showSlots, showGroupButtons, showLockButtons, + showSwitchSectionStyleButton, } = useSelect( ( select ) => { const { getBlockName, @@ -141,6 +143,7 @@ export function PrivateBlockToolbar( { showSlots: ! isZoomOut(), showGroupButtons: ! isZoomOut(), showLockButtons: ! isZoomOut(), + showSwitchSectionStyleButton: isZoomOut(), }; }, [] ); @@ -222,6 +225,9 @@ export function PrivateBlockToolbar( { { showShuffleButton && ( ) } + { showSwitchSectionStyleButton && ( + + ) } { shouldShowVisualToolbar && showSlots && ( <>