diff --git a/packages/edit-site/src/components/layout/index.js b/packages/edit-site/src/components/layout/index.js
index 21fd12e71219b3..3bbfce706365c1 100644
--- a/packages/edit-site/src/components/layout/index.js
+++ b/packages/edit-site/src/components/layout/index.js
@@ -42,7 +42,7 @@ import {
import ErrorBoundary from '../error-boundary';
import { store as editSiteStore } from '../../store';
import useInitEditedEntityFromURL from '../sync-state-with-url/use-init-edited-entity-from-url';
-import SiteHub from '../site-hub';
+import { default as SiteHub, SiteHubMobile } from '../site-hub';
import ResizableFrame from '../resizable-frame';
import useSyncCanvasModeWithURL from '../sync-state-with-url/use-sync-canvas-mode-with-url';
import { unlock } from '../../lock-unlock';
@@ -220,6 +220,16 @@ export default function Layout() {
{ isMobileViewport && areas.mobile && (
+ { canvasMode !== 'edit' && (
+
+
+
+ ) }
{ areas.mobile }
) }
diff --git a/packages/edit-site/src/components/layout/style.scss b/packages/edit-site/src/components/layout/style.scss
index 01c31de0d65d6c..a7539ccdca79b2 100644
--- a/packages/edit-site/src/components/layout/style.scss
+++ b/packages/edit-site/src/components/layout/style.scss
@@ -56,6 +56,18 @@
position: relative;
width: 100%;
z-index: z-index(".edit-site-layout__canvas-container");
+
+ /*
+ * The SiteHubMobile component is displayed
+ * for pages that do not have a sidebar,
+ * yet it needs the Sidebar component for the React context.
+ *
+ * This removes the padding in this scenario.
+ * See https://github.com/WordPress/gutenberg/pull/63118
+ */
+ .edit-site-sidebar__screen-wrapper {
+ padding: 0;
+ }
}
.edit-site-layout__canvas-container {
diff --git a/packages/edit-site/src/components/site-hub/index.js b/packages/edit-site/src/components/site-hub/index.js
index b53fed2d7a94f4..301f7165d59354 100644
--- a/packages/edit-site/src/components/site-hub/index.js
+++ b/packages/edit-site/src/components/site-hub/index.js
@@ -11,11 +11,12 @@ import { Button, __experimentalHStack as HStack } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { store as coreStore } from '@wordpress/core-data';
import { decodeEntities } from '@wordpress/html-entities';
-import { memo, forwardRef } from '@wordpress/element';
+import { memo, forwardRef, useContext } from '@wordpress/element';
import { search } from '@wordpress/icons';
import { store as commandsStore } from '@wordpress/commands';
import { displayShortcut } from '@wordpress/keycodes';
import { filterURLForDisplay } from '@wordpress/url';
+import { privateApis as routerPrivateApis } from '@wordpress/router';
/**
* Internal dependencies
@@ -23,6 +24,8 @@ import { filterURLForDisplay } from '@wordpress/url';
import { store as editSiteStore } from '../../store';
import SiteIcon from '../site-icon';
import { unlock } from '../../lock-unlock';
+const { useHistory } = unlock( routerPrivateApis );
+import { SidebarNavigationContext } from '../sidebar';
const SiteHub = memo(
forwardRef( ( { isTransparent }, ref ) => {
@@ -103,3 +106,83 @@ const SiteHub = memo(
);
export default SiteHub;
+
+export const SiteHubMobile = memo(
+ forwardRef( ( { isTransparent }, ref ) => {
+ const history = useHistory();
+ const { navigate } = useContext( SidebarNavigationContext );
+
+ const { homeUrl, siteTitle } = useSelect( ( select ) => {
+ const {
+ getSite,
+ getUnstableBase, // Site index.
+ } = select( coreStore );
+ const _site = getSite();
+ return {
+ homeUrl: getUnstableBase()?.home,
+ siteTitle:
+ ! _site?.title && !! _site?.url
+ ? filterURLForDisplay( _site?.url )
+ : _site?.title,
+ };
+ }, [] );
+ const { open: openCommandCenter } = useDispatch( commandsStore );
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+ } )
+);