Skip to content

Commit

Permalink
move shadow into newly created effects panel
Browse files Browse the repository at this point in the history
  • Loading branch information
madhusudhand committed Feb 1, 2023
1 parent d9da125 commit abffa6e
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 7 deletions.
15 changes: 13 additions & 2 deletions packages/edit-site/src/components/global-styles/context-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ import { useHasVariationsPanel } from './variations-panel';
import { NavigationButtonAsItem } from './navigation-button';
import { IconWithCurrentColor } from './icon-with-current-color';
import { ScreenVariations } from './screen-variations';
import { useHasShadowControl } from './shadow-panel';

function ContextMenu( { name, parentMenu = '' } ) {
const hasTypographyPanel = useHasTypographyPanel( name );
const hasColorPanel = useHasColorPanel( name );
const hasBorderPanel = useHasBorderPanel( name );
const hasEffectsPanel = useHasShadowControl( name );
const hasDimensionsPanel = useHasDimensionsPanel( name );
const hasLayoutPanel = hasDimensionsPanel;
const hasVariationsPanel = useHasVariationsPanel( name, parentMenu );
Expand Down Expand Up @@ -85,9 +87,18 @@ function ContextMenu( { name, parentMenu = '' } ) {
<NavigationButtonAsItem
icon={ border }
path={ parentMenu + '/border' }
aria-label={ __( 'Border & shadow styles' ) }
aria-label={ __( 'Border' ) }
>
{ __( 'Border & Shadow' ) }
{ __( 'Border' ) }
</NavigationButtonAsItem>
) }
{ hasEffectsPanel && (
<NavigationButtonAsItem
icon={ border }
path={ parentMenu + '/effects' }
aria-label={ __( 'Effects' ) }
>
{ __( 'Effects' ) }
</NavigationButtonAsItem>
) }
{ hasLayoutPanel && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,17 @@ import ScreenHeader from './header';
import BorderPanel, { useHasBorderPanel } from './border-panel';
import BlockPreviewPanel from './block-preview-panel';
import { getVariationClassName } from './utils';
import ShadowPanel, { useHasShadowControl } from './shadow-panel';

function ScreenBorder( { name, variation = '' } ) {
const hasBorderPanel = useHasBorderPanel( name );
const variationClassName = getVariationClassName( variation );
const hasShadowPanel = useHasShadowControl( name );
return (
<>
<ScreenHeader title={ __( 'Border & Shadow' ) } />
<BlockPreviewPanel name={ name } variation={ variationClassName } />
{ hasBorderPanel && (
<BorderPanel name={ name } variation={ variation } />
) }
{ hasShadowPanel && (
<ShadowPanel name={ name } variation={ variation } />
) }
</>
);
}
Expand Down
28 changes: 28 additions & 0 deletions packages/edit-site/src/components/global-styles/screen-effects.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* WordPress dependencies
*/
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import ScreenHeader from './header';
import BlockPreviewPanel from './block-preview-panel';
import { getVariationClassName } from './utils';
import ShadowPanel, { useHasShadowControl } from './shadow-panel';

function ScreenEffects( { name, variation = '' } ) {
const variationClassName = getVariationClassName( variation );
const hasShadowPanel = useHasShadowControl( name );
return (
<>
<ScreenHeader title={ __( 'Effects' ) } />
<BlockPreviewPanel name={ name } variation={ variationClassName } />
{ hasShadowPanel && (
<ShadowPanel name={ name } variation={ variation } />
) }
</>
);
}

export default ScreenEffects;
5 changes: 5 additions & 0 deletions packages/edit-site/src/components/global-styles/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import ScreenBorder from './screen-border';
import StyleBook from '../style-book';
import ScreenCSS from './screen-css';
import { unlock } from '../../experiments';
import ScreenEffects from './screen-effects';

const SLOT_FILL_NAME = 'GlobalStylesMenu';
const { Slot: GlobalStylesMenuSlot, Fill: GlobalStylesMenuFill } =
Expand Down Expand Up @@ -209,6 +210,10 @@ function ContextScreens( { name, parentMenu = '', variation = '' } ) {
<ScreenBorder name={ name } variation={ variation } />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen path={ parentMenu + '/effects' }>
<ScreenEffects name={ name } variation={ variation } />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen path={ parentMenu + '/layout' }>
<ScreenLayout name={ name } variation={ variation } />
</GlobalStylesNavigationScreen>
Expand Down

0 comments on commit abffa6e

Please sign in to comment.