From 83ec97929ce7c1b7f6adc0081b6f5a503a90ddc5 Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Mon, 3 Jul 2023 01:02:17 +0900 Subject: [PATCH 1/2] Style Book: Show tabs and make blocks clickable when entering edit mode from the Styles menu --- .../index.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) 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 1e2e7aac159ef7..e08f155c53d0dc 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 @@ -170,13 +170,15 @@ export default function SidebarNavigationScreenGlobalStyles() { const { setCanvasMode, setEditorCanvasContainerView } = unlock( useDispatch( editSiteStore ) ); - - const isStyleBookOpened = useSelect( - ( select ) => - 'style-book' === - unlock( select( editSiteStore ) ).getEditorCanvasContainerView(), - [] - ); + const { isViewMode, isStyleBookOpened } = useSelect( ( select ) => { + const { getCanvasMode, getEditorCanvasContainerView } = unlock( + select( editSiteStore ) + ); + return { + isViewMode: getCanvasMode() === 'view', + isStyleBookOpened: 'style-book' === getEditorCanvasContainerView(), + }; + }, [] ); const openGlobalStyles = useCallback( async () => @@ -246,7 +248,7 @@ export default function SidebarNavigationScreenGlobalStyles() { } /> - { isStyleBookOpened && ! isMobileViewport && ( + { isStyleBookOpened && ! isMobileViewport && isViewMode && ( false } From d9340594906fe48e5690d9becad821e2a856242a Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Tue, 4 Jul 2023 21:21:35 +0900 Subject: [PATCH 2/2] Move lines --- .../sidebar-navigation-screen-global-styles/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 393125771df0a6..1e9200bf0af019 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 @@ -168,6 +168,9 @@ export default function SidebarNavigationScreenGlobalStyles() { const { setCanvasMode, setEditorCanvasContainerView } = unlock( useDispatch( editSiteStore ) ); + const { createNotice } = useDispatch( noticesStore ); + const { set: setPreference } = useDispatch( preferencesStore ); + const { get: getPrefference } = useSelect( preferencesStore ); const { isViewMode, isStyleBookOpened } = useSelect( ( select ) => { const { getCanvasMode, getEditorCanvasContainerView } = unlock( select( editSiteStore ) @@ -177,9 +180,6 @@ export default function SidebarNavigationScreenGlobalStyles() { isStyleBookOpened: 'style-book' === getEditorCanvasContainerView(), }; }, [] ); - const { createNotice } = useDispatch( noticesStore ); - const { set: setPreference } = useDispatch( preferencesStore ); - const { get: getPrefference } = useSelect( preferencesStore ); const turnOffDistractionFreeMode = useCallback( () => { const isDistractionFree = getPrefference(