-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Give style book its own route so it can be linked to directly.
- Loading branch information
1 parent
13cd621
commit 1572726
Showing
3 changed files
with
59 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
packages/edit-site/src/components/site-editor-routes/styles-stylebook.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { privateApis as routerPrivateApis } from '@wordpress/router'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Editor from '../editor'; | ||
import { unlock } from '../../lock-unlock'; | ||
import SidebarNavigationScreenGlobalStyles from '../sidebar-navigation-screen-global-styles'; | ||
import GlobalStylesUIWrapper from '../sidebar-global-styles-wrapper'; | ||
import { StyleBookPreview } from '../style-book'; | ||
|
||
const { useLocation } = unlock( routerPrivateApis ); | ||
|
||
function MobileGlobalStylesUI() { | ||
const { query = {} } = useLocation(); | ||
const { canvas } = query; | ||
|
||
if ( canvas === 'edit' ) { | ||
return <Editor />; | ||
} | ||
|
||
return <GlobalStylesUIWrapper />; | ||
} | ||
|
||
export const stylesStylebookRoute = { | ||
name: 'styles-stylebook', | ||
path: '/styles-stylebook', | ||
areas: { | ||
content: <GlobalStylesUIWrapper />, | ||
sidebar: <SidebarNavigationScreenGlobalStyles backPath="/" />, | ||
preview: <StyleBookPreview />, | ||
mobile: <MobileGlobalStylesUI />, | ||
}, | ||
widths: { | ||
content: 380, | ||
}, | ||
}; |