-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Site Editor: show pattern category step in navigation for mobile (#69206
) Co-authored-by: t-hamano <[email protected]> Co-authored-by: stokesman <[email protected]>
- Loading branch information
1 parent
f017b64
commit 4ad117c
Showing
1 changed file
with
20 additions
and
1 deletion.
There are no files selected for viewing
21 changes: 20 additions & 1 deletion
21
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,34 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { privateApis as routerPrivateApis } from '@wordpress/router'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import SidebarNavigationScreenPatterns from '../sidebar-navigation-screen-patterns'; | ||
import PagePatterns from '../page-patterns'; | ||
import { unlock } from '../../lock-unlock'; | ||
|
||
const { useLocation } = unlock( routerPrivateApis ); | ||
|
||
function MobilePatternsView() { | ||
const { query = {} } = useLocation(); | ||
const { categoryId } = query; | ||
|
||
return !! categoryId ? ( | ||
<PagePatterns /> | ||
) : ( | ||
<SidebarNavigationScreenPatterns backPath="/" /> | ||
); | ||
} | ||
|
||
export const patternsRoute = { | ||
name: 'patterns', | ||
path: '/pattern', | ||
areas: { | ||
sidebar: <SidebarNavigationScreenPatterns backPath="/" />, | ||
content: <PagePatterns />, | ||
mobile: <PagePatterns />, | ||
mobile: <MobilePatternsView />, | ||
}, | ||
}; |