-
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.
Trying to fix site editor side bar navigation: putting the mobile sid…
…ebar in sitecontent to get the context, also rendering edit mode.
- Loading branch information
Showing
3 changed files
with
28 additions
and
22 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
26 changes: 25 additions & 1 deletion
26
packages/edit-site/src/components/site-editor-routes/patterns.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 |
---|---|---|
@@ -1,15 +1,39 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { privateApis as routerPrivateApis } from '@wordpress/router'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import Editor from '../editor'; | ||
import { unlock } from '../../lock-unlock'; | ||
import SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns'; | ||
import PagePatterns from '../page-patterns'; | ||
|
||
const { useLocation } = unlock( routerPrivateApis ); | ||
|
||
function MobilePatternsView() { | ||
const { query = {} } = useLocation(); | ||
const { canvas = 'view', postType, categoryId } = query; | ||
|
||
if ( canvas === 'edit' ) { | ||
return <Editor />; | ||
} | ||
|
||
if ( postType === 'wp_block' && !! categoryId ) { | ||
return <PagePatterns />; | ||
} | ||
|
||
return <SidebarNavigationScreenPatterns backPath="/" />; | ||
} | ||
|
||
export const patternsRoute = { | ||
name: 'patterns', | ||
path: '/pattern', | ||
areas: { | ||
sidebar: <SidebarNavigationScreenPatterns backPath="/" />, | ||
content: <PagePatterns />, | ||
mobile: <PagePatterns />, | ||
mobile: <MobilePatternsView />, | ||
}, | ||
}; |
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