From fb01dc7ffc2a3a9a1218e01efe570c9dd1ab6dfd Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Fri, 27 Sep 2024 18:57:38 +0100 Subject: [PATCH] no styles drill down; disable style books click; --- .../edit-site/src/components/layout/index.js | 1 + .../edit-site/src/components/layout/router.js | 3 +- .../src/components/resizable-frame/index.js | 5 ++- .../index.js | 39 ++++++------------- .../sidebar-navigation-screen-main/index.js | 7 +--- 5 files changed, 18 insertions(+), 37 deletions(-) diff --git a/packages/edit-site/src/components/layout/index.js b/packages/edit-site/src/components/layout/index.js index c54b7efa382c66..acf56918fe1d24 100644 --- a/packages/edit-site/src/components/layout/index.js +++ b/packages/edit-site/src/components/layout/index.js @@ -247,6 +247,7 @@ export default function Layout( { route } ) { gradientValue ?? backgroundColor, } } + hasResize={ widths?.hasResize } > { areas.preview } diff --git a/packages/edit-site/src/components/layout/router.js b/packages/edit-site/src/components/layout/router.js index 9bccc718b5c2ae..f7ee9dd06fd4e9 100644 --- a/packages/edit-site/src/components/layout/router.js +++ b/packages/edit-site/src/components/layout/router.js @@ -152,7 +152,7 @@ export default function useLayoutAreas() { // Styles if ( path && path.startsWith( '/wp_global_styles' ) ) { return { - key: 'styles', + key: 'default', areas: { sidebar: ( @@ -167,6 +167,7 @@ export default function useLayoutAreas() { }, widths: { content: 380, + hasResize: false, }, }; } diff --git a/packages/edit-site/src/components/resizable-frame/index.js b/packages/edit-site/src/components/resizable-frame/index.js index b5aae01918e691..8f5f30bd5afa4f 100644 --- a/packages/edit-site/src/components/resizable-frame/index.js +++ b/packages/edit-site/src/components/resizable-frame/index.js @@ -81,6 +81,7 @@ function ResizableFrame( { isOversized, setIsOversized, isReady, + hasResize = true, children, /** The default (unresized) width/height of the frame, based on the space availalbe in the viewport. */ defaultSize, @@ -254,8 +255,8 @@ function ResizableFrame( { bottom: false, // Resizing will be disabled until the editor content is loaded. ...( isRTL() - ? { right: isReady, left: false } - : { left: isReady, right: false } ), + ? { right: isReady && hasResize, left: false } + : { left: isReady && hasResize, right: false } ), topRight: false, bottomRight: false, bottomLeft: false, diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js index d15d76c2b3140a..ef35db7c117d5e 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen-global-styles/index.js @@ -23,12 +23,10 @@ import SidebarNavigationScreenDetailsFooter from '../sidebar-navigation-screen-d import { MainSidebarNavigationContent } from '../sidebar-navigation-screen-main'; import SidebarButton from '../sidebar-button'; -const { useHistory } = unlock( routerPrivateApis ); +const { useLocation } = unlock( routerPrivateApis ); export function SidebarNavigationItemGlobalStyles( props ) { - const { openGeneralSidebar } = useDispatch( editSiteStore ); - const { setCanvasMode } = unlock( useDispatch( editSiteStore ) ); - + const { params } = useLocation(); const hasGlobalStyleVariations = useSelect( ( select ) => !! select( @@ -42,24 +40,16 @@ export function SidebarNavigationItemGlobalStyles( props ) { { ...props } params={ { path: '/wp_global_styles' } } uid="global-styles-navigation-item" + aria-current={ + params.path && params.path.startsWith( '/wp_global_styles' ) + } /> ); } - return ( - { - // Switch to edit mode. - setCanvasMode( 'edit' ); - // Open global styles sidebar. - openGeneralSidebar( 'edit-site/global-styles' ); - } } - /> - ); + return ; } -export default function SidebarNavigationScreenGlobalStyles( { backPath } ) { - const history = useHistory(); +export default function SidebarNavigationScreenGlobalStyles() { const { revisions, isLoading: isLoadingRevisions } = useGlobalStylesRevisions(); const { openGeneralSidebar } = useDispatch( editSiteStore ); @@ -106,15 +96,14 @@ export default function SidebarNavigationScreenGlobalStyles( { backPath } ) { const modifiedDateTime = revisions?.[ 0 ]?.modified; const shouldShowGlobalStylesFooter = hasRevisions && ! isLoadingRevisions && modifiedDateTime; - return ( <> } @@ -152,13 +141,7 @@ export default function SidebarNavigationScreenGlobalStyles( { backPath } ) { isSelected={ () => false } showCloseButton={ false } showTabs={ false } - onSelect={ ( blockName ) => { - history.push( { - path: `/wp_global_styles/blocks/${ encodeURIComponent( - blockName - ) }`, - } ); - } } + onClick={ () => {} } /> ) } diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js index dbc160f8fbb84a..4eee498c6eb0d5 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen-main/index.js @@ -21,7 +21,7 @@ import { PATTERN_TYPES, } from '../../utils/constants'; -export function MainSidebarNavigationContent( { activeItem } ) { +export function MainSidebarNavigationContent() { return ( { __( 'Navigation' ) } @@ -38,7 +37,6 @@ export function MainSidebarNavigationContent( { activeItem } ) { className="is-selected" withChevron icon={ styles } - aria-current={ activeItem === 'styles-navigation-item' } > { __( 'Styles' ) } @@ -47,7 +45,6 @@ export function MainSidebarNavigationContent( { activeItem } ) { params={ { postType: 'page' } } withChevron icon={ page } - aria-current={ activeItem === 'page-navigation-item' } > { __( 'Pages' ) } @@ -56,7 +53,6 @@ export function MainSidebarNavigationContent( { activeItem } ) { params={ { postType: TEMPLATE_POST_TYPE } } withChevron icon={ layout } - aria-current={ activeItem === 'template-navigation-item' } > { __( 'Templates' ) } @@ -65,7 +61,6 @@ export function MainSidebarNavigationContent( { activeItem } ) { params={ { postType: PATTERN_TYPES.user } } withChevron icon={ symbol } - aria-current={ activeItem === 'patterns-navigation-item' } > { __( 'Patterns' ) }