From 15da58e45fc3da90b771c022fa4b3eace35b23f7 Mon Sep 17 00:00:00 2001 From: ramon Date: Thu, 23 May 2024 10:44:24 +1000 Subject: [PATCH] Global styles: - remove Background image top-level navigation item - relocate background panel to sit next to Layout controls --- .../src/components/global-styles/background-panel.js | 2 +- .../src/components/global-styles/root-menu.js | 12 ------------ .../src/components/global-styles/screen-layout.js | 11 +++++++++-- .../edit-site/src/components/global-styles/ui.js | 5 ----- 4 files changed, 10 insertions(+), 20 deletions(-) diff --git a/packages/edit-site/src/components/global-styles/background-panel.js b/packages/edit-site/src/components/global-styles/background-panel.js index 44a9fccaa15ed..0ad74e0cd0bdd 100644 --- a/packages/edit-site/src/components/global-styles/background-panel.js +++ b/packages/edit-site/src/components/global-styles/background-panel.js @@ -59,7 +59,7 @@ export default function BackgroundPanel() { value={ style } onChange={ setStyle } settings={ settings } - headerLabel={ __( 'Image' ) } + headerLabel={ __( 'Background' ) } defaultValues={ BACKGROUND_DEFAULT_VALUES } defaultControls={ defaultControls } themeFileURIs={ _links?.[ 'wp:theme-file' ] } diff --git a/packages/edit-site/src/components/global-styles/root-menu.js b/packages/edit-site/src/components/global-styles/root-menu.js index 4959fc33c4973..6db4621299f1e 100644 --- a/packages/edit-site/src/components/global-styles/root-menu.js +++ b/packages/edit-site/src/components/global-styles/root-menu.js @@ -6,7 +6,6 @@ import { typography, color, layout, - image, shadow as shadowIcon, } from '@wordpress/icons'; import { __ } from '@wordpress/i18n'; @@ -24,7 +23,6 @@ const { useHasColorPanel, useGlobalSetting, useSettingsForBlockElement, - useHasBackgroundPanel, } = unlock( blockEditorPrivateApis ); function RootMenu() { @@ -35,7 +33,6 @@ function RootMenu() { const hasShadowPanel = true; // useHasShadowPanel( settings ); const hasDimensionsPanel = useHasDimensionsPanel( settings ); const hasLayoutPanel = hasDimensionsPanel; - const hasBackgroundPanel = useHasBackgroundPanel( settings ); return ( <> @@ -76,15 +73,6 @@ function RootMenu() { { __( 'Layout' ) } ) } - { hasBackgroundPanel && ( - - { __( 'Background image' ) } - - ) } ); diff --git a/packages/edit-site/src/components/global-styles/screen-layout.js b/packages/edit-site/src/components/global-styles/screen-layout.js index e7794985b7984..61c64b88f0e48 100644 --- a/packages/edit-site/src/components/global-styles/screen-layout.js +++ b/packages/edit-site/src/components/global-styles/screen-layout.js @@ -8,20 +8,27 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; * Internal dependencies */ import DimensionsPanel from './dimensions-panel'; +import BackgroundPanel from './background-panel'; import ScreenHeader from './header'; import { unlock } from '../../lock-unlock'; -const { useHasDimensionsPanel, useGlobalSetting, useSettingsForBlockElement } = - unlock( blockEditorPrivateApis ); +const { + useHasBackgroundPanel, + useHasDimensionsPanel, + useGlobalSetting, + useSettingsForBlockElement, +} = unlock( blockEditorPrivateApis ); function ScreenLayout() { const [ rawSettings ] = useGlobalSetting( '' ); const settings = useSettingsForBlockElement( rawSettings ); const hasDimensionsPanel = useHasDimensionsPanel( settings ); + const hasBackgroundPanel = useHasBackgroundPanel( settings ); return ( <> { hasDimensionsPanel && } + { hasBackgroundPanel && } ); } diff --git a/packages/edit-site/src/components/global-styles/ui.js b/packages/edit-site/src/components/global-styles/ui.js index a8bb6eed9f86a..3e306ba3232a0 100644 --- a/packages/edit-site/src/components/global-styles/ui.js +++ b/packages/edit-site/src/components/global-styles/ui.js @@ -41,7 +41,6 @@ import ScreenStyleVariations from './screen-style-variations'; import StyleBook from '../style-book'; import ScreenCSS from './screen-css'; import ScreenRevisions from './screen-revisions'; -import ScreenBackground from './screen-background'; import { unlock } from '../../lock-unlock'; import { store as editSiteStore } from '../../store'; @@ -358,10 +357,6 @@ function GlobalStylesUI() { - - - - { blocks.map( ( block ) => (