Skip to content

Commit

Permalink
Global styles: (WordPress#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 <ramonopoly@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
  • Loading branch information
3 people authored and patil-vipul committed Jun 17, 2024
1 parent 1acb487 commit b8fb7d1
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

0 comments on commit b8fb7d1

Please sign in to comment.