Skip to content

Commit

Permalink
Global styles: (#61886)
Browse files Browse the repository at this point in the history
- remove Background image top-level navigation item
- relocate background panel to sit next to Layout controls

Co-authored-by: ramonjd <[email protected]>
Co-authored-by: jasmussen <[email protected]>
  • Loading branch information
3 people authored May 24, 2024
1 parent de9a53a commit f9df151
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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' ] }
Expand Down
12 changes: 0 additions & 12 deletions packages/edit-site/src/components/global-styles/root-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
typography,
color,
layout,
image,
shadow as shadowIcon,
} from '@wordpress/icons';
import { __ } from '@wordpress/i18n';
Expand All @@ -24,7 +23,6 @@ const {
useHasColorPanel,
useGlobalSetting,
useSettingsForBlockElement,
useHasBackgroundPanel,
} = unlock( blockEditorPrivateApis );

function RootMenu() {
Expand All @@ -35,7 +33,6 @@ function RootMenu() {
const hasShadowPanel = true; // useHasShadowPanel( settings );
const hasDimensionsPanel = useHasDimensionsPanel( settings );
const hasLayoutPanel = hasDimensionsPanel;
const hasBackgroundPanel = useHasBackgroundPanel( settings );

return (
<>
Expand Down Expand Up @@ -76,15 +73,6 @@ function RootMenu() {
{ __( 'Layout' ) }
</NavigationButtonAsItem>
) }
{ hasBackgroundPanel && (
<NavigationButtonAsItem
icon={ image }
path="/background"
aria-label={ __( 'Background image styles' ) }
>
{ __( 'Background image' ) }
</NavigationButtonAsItem>
) }
</ItemGroup>
</>
);
Expand Down
11 changes: 9 additions & 2 deletions packages/edit-site/src/components/global-styles/screen-layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<>
<ScreenHeader title={ __( 'Layout' ) } />
{ hasDimensionsPanel && <DimensionsPanel /> }
{ hasBackgroundPanel && <BackgroundPanel /> }
</>
);
}
Expand Down
5 changes: 0 additions & 5 deletions packages/edit-site/src/components/global-styles/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -358,10 +357,6 @@ function GlobalStylesUI() {
<ScreenRevisions />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen path={ '/background' }>
<ScreenBackground />
</GlobalStylesNavigationScreen>

{ blocks.map( ( block ) => (
<GlobalStylesNavigationScreen
key={ 'menu-block-' + block.name }
Expand Down

1 comment on commit f9df151

@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 f9df151.
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/9218317604
📝 Reported issues:

Please sign in to comment.