Skip to content

Commit

Permalink
Site Editor: Fix the templates route on mobile (WordPress#67547)
Browse files Browse the repository at this point in the history
Co-authored-by: ramonjd <[email protected]>
Co-authored-by: tellthemachines <[email protected]>
  • Loading branch information
3 people authored and im3dabasia committed Dec 4, 2024
1 parent 83f25b1 commit eca357e
Showing 1 changed file with 1 addition and 20 deletions.
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
/**
* WordPress dependencies
*/
import { privateApis as routerPrivateApis } from '@wordpress/router';

/**
* Internal dependencies
*/
import Editor from '../editor';
import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse';
import { unlock } from '../../lock-unlock';
import PageTemplates from '../page-templates';

const { useLocation } = unlock( routerPrivateApis );

function MobileTemplatesView() {
const { query = {} } = useLocation();
const { canvas = 'view' } = query;

return canvas === 'edit' ? (
<Editor />
) : (
<SidebarNavigationScreenTemplatesBrowse backPath="/" />
);
}

export const templatesRoute = {
name: 'templates',
path: '/template',
Expand All @@ -34,7 +15,7 @@ export const templatesRoute = {
const isListView = query.layout === 'list';
return isListView ? <Editor /> : undefined;
},
mobile: <MobileTemplatesView />,
mobile: <PageTemplates />,
},
widths: {
content( { query } ) {
Expand Down

0 comments on commit eca357e

Please sign in to comment.