From 2af83afef495ff205342875af36cef154a46a9ad Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Wed, 18 Dec 2024 13:38:46 +1100 Subject: [PATCH] Give style book its own route so it can be linked to directly. (#67811) * Give style book its own route so it can be linked to directly. * Fix paths to and from global styles. * Use query instead of path * Fix path * Effect for editor settings update --- .../sidebar-global-styles-wrapper/index.js | 73 +++++++------------ .../site-editor-routes/stylebook.js | 4 +- .../components/site-editor-routes/styles.js | 6 +- .../src/components/style-book/index.js | 63 ++++++++++++---- 4 files changed, 81 insertions(+), 65 deletions(-) diff --git a/packages/edit-site/src/components/sidebar-global-styles-wrapper/index.js b/packages/edit-site/src/components/sidebar-global-styles-wrapper/index.js index 030512a38fab3..de12bbe466bf3 100644 --- a/packages/edit-site/src/components/sidebar-global-styles-wrapper/index.js +++ b/packages/edit-site/src/components/sidebar-global-styles-wrapper/index.js @@ -6,7 +6,7 @@ import { useMemo, useState } from '@wordpress/element'; import { privateApis as routerPrivateApis } from '@wordpress/router'; import { useViewportMatch } from '@wordpress/compose'; import { Button } from '@wordpress/components'; -import { addQueryArgs } from '@wordpress/url'; +import { addQueryArgs, removeQueryArgs } from '@wordpress/url'; import { seen } from '@wordpress/icons'; /** @@ -15,15 +15,15 @@ import { seen } from '@wordpress/icons'; import GlobalStylesUI from '../global-styles/ui'; import Page from '../page'; import { unlock } from '../../lock-unlock'; -import StyleBook from '../style-book'; -import { STYLE_BOOK_COLOR_GROUPS } from '../style-book/constants'; const { useLocation, useHistory } = unlock( routerPrivateApis ); const GlobalStylesPageActions = ( { isStyleBookOpened, setIsStyleBookOpened, + path, } ) => { + const history = useHistory(); return (