Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Cleanup
  • Loading branch information
youknowriad committed May 2, 2023
commit c0511a688aaac006997d0c4aa1d8a753033c3f82
12 changes: 6 additions & 6 deletions packages/edit-site/src/components/global-styles/root-menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function RootMenu() {
{ hasTypographyPanel && (
<NavigationButtonAsItem
icon={ typography }
path={ '/typography' }
path="/typography"
aria-label={ __( 'Typography styles' ) }
>
{ __( 'Typography' ) }
Expand All @@ -56,7 +56,7 @@ function RootMenu() {
{ hasColorPanel && (
<NavigationButtonAsItem
icon={ color }
path={ '/colors' }
path="/colors"
aria-label={ __( 'Colors styles' ) }
>
{ __( 'Colors' ) }
Expand All @@ -65,7 +65,7 @@ function RootMenu() {
{ hasBorderPanel && (
<NavigationButtonAsItem
icon={ border }
path={ '/border' }
path="/border"
aria-label={ __( 'Border' ) }
>
{ __( 'Border' ) }
Expand All @@ -74,7 +74,7 @@ function RootMenu() {
{ hasEffectsPanel && (
<NavigationButtonAsItem
icon={ shadow }
path={ '/effects' }
path="/effects"
aria-label={ __( 'Effects' ) }
>
{ __( 'Effects' ) }
Expand All @@ -83,7 +83,7 @@ function RootMenu() {
{ hasFilterPanel && (
<NavigationButtonAsItem
icon={ filter }
path={ '/filters' }
path="/filters"
aria-label={ __( 'Filters styles' ) }
>
{ __( 'Filters' ) }
Expand All @@ -92,7 +92,7 @@ function RootMenu() {
{ hasLayoutPanel && (
<NavigationButtonAsItem
icon={ layout }
path={ '/layout' }
path="/layout"
aria-label={ __( 'Layout styles' ) }
>
{ __( 'Layout' ) }
Expand Down
128 changes: 38 additions & 90 deletions packages/edit-site/src/components/global-styles/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,33 +108,6 @@ function GlobalStylesNavigationScreen( { className, ...props } ) {
);
}

function BlockStyleVariationsScreens( { name } ) {
const blockStyleVariations = useSelect(
( select ) => {
const { getBlockStyles } = select( blocksStore );
return getBlockStyles( name );
},
[ name ]
);
if ( ! blockStyleVariations?.length ) {
return null;
}

return blockStyleVariations.map( ( variation ) => (
<ContextScreens
key={ variation.name + name }
name={ name }
parentMenu={
'/blocks/' +
encodeURIComponent( name ) +
'/variations/' +
encodeURIComponent( variation.name )
}
variation={ variation.name }
/>
) );
}

function BlockStylesNavigationScreens( {
parentMenu,
blockStyles,
Expand All @@ -150,7 +123,7 @@ function BlockStylesNavigationScreens( {
) );
}

function ContextScreens( { name, parentMenu = '', variation = '' } ) {
function ContextScreens( { name, parentMenu = '' } ) {
const blockStyleVariations = useSelect(
( select ) => {
const { getBlockStyles } = select( blocksStore );
Expand All @@ -161,66 +134,12 @@ function ContextScreens( { name, parentMenu = '', variation = '' } ) {

return (
<>
{ ! name && ! variation && (
<>
<GlobalStylesNavigationScreen
path={ parentMenu + '/typography' }
>
<ScreenTypography />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen
path={ parentMenu + '/typography/text' }
>
<ScreenTypographyElement element="text" />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen
path={ parentMenu + '/typography/link' }
>
<ScreenTypographyElement element="link" />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen
path={ parentMenu + '/typography/heading' }
>
<ScreenTypographyElement element="heading" />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen
path={ parentMenu + '/typography/caption' }
>
<ScreenTypographyElement element="caption" />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen
path={ parentMenu + '/typography/button' }
>
<ScreenTypographyElement element="button" />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen
path={ parentMenu + '/colors' }
>
<ScreenColors />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen path={ parentMenu + '/css' }>
<ScreenCSS />
</GlobalStylesNavigationScreen>
</>
) }

<GlobalStylesNavigationScreen
path={ parentMenu + '/colors/palette' }
>
<ScreenColorPalette name={ name } />
</GlobalStylesNavigationScreen>

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

{ !! blockStyleVariations?.length && (
<BlockStylesNavigationScreens
parentMenu={ parentMenu }
Expand Down Expand Up @@ -312,6 +231,43 @@ function GlobalStylesUI() {
<ScreenBlockList />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen path="/typography">
<ScreenTypography />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen path="/typography/text">
<ScreenTypographyElement element="text" />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen path="/typography/link">
<ScreenTypographyElement element="link" />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen path="/typography/heading">
<ScreenTypographyElement element="heading" />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen path="/typography/caption">
<ScreenTypographyElement element="caption" />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen path="/typography/button">
<ScreenTypographyElement element="button" />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen path="/colors">
<ScreenColors />
``
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen path="/layout">
<ScreenLayout />
</GlobalStylesNavigationScreen>

<GlobalStylesNavigationScreen path="/css">
<ScreenCSS />
</GlobalStylesNavigationScreen>

{ blocks.map( ( block ) => (
<GlobalStylesNavigationScreen
key={ 'menu-block-' + block.name }
Expand All @@ -331,14 +287,6 @@ function GlobalStylesUI() {
/>
) ) }

{ blocks.map( ( block, index ) => {
return (
<BlockStyleVariationsScreens
key={ 'screens-block-styles-' + block.name + index }
name={ block.name }
/>
);
} ) }
{ 'style-book' === editorCanvasContainerView && (
<GlobalStylesStyleBook />
) }
Expand Down