From 74c6577f606c2a69e26f6641b24c7ddc0a07ed80 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 8 May 2023 10:16:50 +0100 Subject: [PATCH 1/3] Command center: Add a button to open it from the site editor view mode --- .../src/components/layout/style.scss | 2 +- .../src/components/site-hub/index.js | 111 ++++++++++-------- .../src/components/site-hub/style.scss | 4 + 3 files changed, 69 insertions(+), 48 deletions(-) diff --git a/packages/edit-site/src/components/layout/style.scss b/packages/edit-site/src/components/layout/style.scss index 4bcab85d80062..6e8a7fb42eb9b 100644 --- a/packages/edit-site/src/components/layout/style.scss +++ b/packages/edit-site/src/components/layout/style.scss @@ -20,7 +20,7 @@ } @include break-medium { - width: calc(#{$nav-sidebar-width} - #{$canvas-padding * 2}); + width: calc(#{$nav-sidebar-width} - #{$canvas-padding}); } .edit-site-layout.is-full-canvas & { diff --git a/packages/edit-site/src/components/site-hub/index.js b/packages/edit-site/src/components/site-hub/index.js index 5419317bdac4d..bfc6304b9c147 100644 --- a/packages/edit-site/src/components/site-hub/index.js +++ b/packages/edit-site/src/components/site-hub/index.js @@ -19,6 +19,8 @@ import { store as blockEditorStore } from '@wordpress/block-editor'; import { store as coreStore } from '@wordpress/core-data'; import { decodeEntities } from '@wordpress/html-entities'; import { forwardRef } from '@wordpress/element'; +import { search } from '@wordpress/icons'; +import { privateApis as commandsPrivateApis } from '@wordpress/commands'; /** * Internal dependencies @@ -27,6 +29,8 @@ import { store as editSiteStore } from '../../store'; import SiteIcon from '../site-icon'; import { unlock } from '../../private-apis'; +const { store: commandsStore } = unlock( commandsPrivateApis ); + const HUB_ANIMATION_DURATION = 0.3; const SiteHub = forwardRef( ( props, ref ) => { @@ -41,6 +45,7 @@ const SiteHub = forwardRef( ( props, ref ) => { getSettings().__experimentalDashboardLink || 'index.php', }; }, [] ); + const { open: openCommandCenter } = useDispatch( commandsStore ); const disableMotion = useReducedMotion(); const { setCanvasMode } = unlock( useDispatch( editSiteStore ) ); @@ -82,65 +87,77 @@ const SiteHub = forwardRef( ( props, ref ) => { ease: 'easeOut', } } > - - + - + + + - + { decodeEntities( siteTitle ) } - - - - - - { decodeEntities( siteTitle ) } - - + + + { window?.__experimentalEnableCommandCenter && + canvasMode === 'view' && ( +