diff --git a/packages/edit-site/src/components/editor/index.js b/packages/edit-site/src/components/editor/index.js
index 9d2bb47d17a905..f9b2f996e87920 100644
--- a/packages/edit-site/src/components/editor/index.js
+++ b/packages/edit-site/src/components/editor/index.js
@@ -17,6 +17,7 @@ import {
BlockBreadcrumb,
__unstableEditorStyles as EditorStyles,
__experimentalUseResizeCanvas as useResizeCanvas,
+ __experimentalLibrary as Library,
} from '@wordpress/block-editor';
import {
FullscreenMode,
@@ -26,6 +27,8 @@ import {
import { EntitiesSavedStates, UnsavedChangesWarning } from '@wordpress/editor';
import { __ } from '@wordpress/i18n';
import { PluginArea } from '@wordpress/plugins';
+import { close } from '@wordpress/icons';
+import { useViewportMatch } from '@wordpress/compose';
/**
* Internal dependencies
@@ -36,7 +39,6 @@ import { SidebarComplementaryAreaFills } from '../sidebar';
import BlockEditor from '../block-editor';
import KeyboardShortcuts from '../keyboard-shortcuts';
import GlobalStylesProvider from './global-styles-provider';
-import LeftSidebar from '../left-sidebar';
import NavigationSidebar from '../navigation-sidebar';
const interfaceLabels = {
@@ -47,6 +49,7 @@ const interfaceLabels = {
function Editor() {
const {
isFullscreenActive,
+ isInserterOpen,
deviceType,
sidebarIsOpened,
settings,
@@ -59,6 +62,7 @@ function Editor() {
} = useSelect( ( _select ) => {
const {
isFeatureActive,
+ isInserterOpened,
__experimentalGetPreviewDeviceType,
getSettings,
getTemplateId,
@@ -79,6 +83,7 @@ function Editor() {
}
return {
+ isInserterOpen: isInserterOpened(),
isFullscreenActive: isFeatureActive( 'fullscreenMode' ),
deviceType: __experimentalGetPreviewDeviceType(),
sidebarIsOpened: !! _select(
@@ -164,6 +169,8 @@ function Editor() {
}
}, [ isNavigationOpen ] );
+ const isMobile = useViewportMatch( 'medium', '<' );
+
return (
<>
@@ -215,7 +222,36 @@ function Editor() {
}
leftSidebar={
-
+ isInserterOpen ? (
+
+
+
+
+ {
+ if (
+ isMobile
+ ) {
+ setIsInserterOpened(
+ false
+ );
+ }
+ } }
+ />
+
+
+ ) : null
}
sidebar={
sidebarIsOpened && (
diff --git a/packages/edit-site/src/components/editor/style.scss b/packages/edit-site/src/components/editor/style.scss
index ca94a01191267c..66c0a582f5760f 100644
--- a/packages/edit-site/src/components/editor/style.scss
+++ b/packages/edit-site/src/components/editor/style.scss
@@ -23,3 +23,29 @@
.edit-site-visual-editor {
background-color: $white;
}
+
+.edit-site-editor__inserter-panel {
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+}
+
+.edit-site-editor__inserter-panel-header {
+ padding-top: $grid-unit-10;
+ padding-right: $grid-unit-10;
+ display: flex;
+ justify-content: flex-end;
+
+ @include break-medium() {
+ display: none;
+ }
+}
+
+.edit-site-editor__inserter-panel-content {
+ // Leave space for the close button
+ height: calc(100% - #{$button-size} - #{$grid-unit-10});
+
+ @include break-medium() {
+ height: 100%;
+ }
+}
diff --git a/packages/edit-site/src/components/header/index.js b/packages/edit-site/src/components/header/index.js
index 35a218feecad90..00c26276700f32 100644
--- a/packages/edit-site/src/components/header/index.js
+++ b/packages/edit-site/src/components/header/index.js
@@ -92,10 +92,14 @@ export default function Header( { openEntitiesSavedStates } ) {
'Generic label for block inserter button'
) }
/>
-
-
-
-
+ { isLargeViewport && (
+ <>
+
+
+
+
+ >
+ ) }
{ displayBlockToolbar && (
diff --git a/packages/edit-site/src/components/header/style.scss b/packages/edit-site/src/components/header/style.scss
index 07976094393db0..8d08537805bb50 100644
--- a/packages/edit-site/src/components/header/style.scss
+++ b/packages/edit-site/src/components/header/style.scss
@@ -6,10 +6,12 @@
box-sizing: border-box;
width: 100%;
- padding-left: 60px;
- transition: padding-left 20ms linear;
- transition-delay: 80ms;
- @include reduce-motion("transition");
+ @include break-medium() {
+ padding-left: 60px;
+ transition: padding-left 20ms linear;
+ transition-delay: 80ms;
+ @include reduce-motion("transition");
+ }
.edit-site-header_start,
.edit-site-header_end {
@@ -17,10 +19,18 @@
display: flex;
}
- .edit-site-header_start {
- // Flex basis prevents the header_start toolbar
- // from collapsing when shrinking the viewport.
- flex-basis: calc(#{$header-toolbar-min-width} - #{$header-height});
+ @include break-medium() {
+ .edit-site-header_start {
+ // Flex basis prevents the header_start toolbar
+ // from collapsing when shrinking the viewport.
+ flex-basis: calc(#{$header-toolbar-min-width} - #{$header-height});
+ }
+
+ .edit-site-header_end {
+ // Flex basis prevents the header_end toolbar
+ // from collapsing when shrinking the viewport
+ flex-basis: $header-toolbar-min-width;
+ }
}
.edit-site-header_center {
@@ -36,9 +46,6 @@
}
.edit-site-header_end {
- // Flex basis prevents the header_end toolbar
- // from collapsing when shrinking the viewport
- flex-basis: $header-toolbar-min-width;
justify-content: flex-end;
}
}
@@ -58,8 +65,16 @@ body.is-navigation-sidebar-open {
.edit-site-header__toolbar {
display: flex;
- padding-left: $grid-unit-30;
align-items: center;
+ padding-left: $grid-unit-10;
+
+ @include break-small() {
+ padding-left: $grid-unit-30;
+ }
+
+ @include break-wide() {
+ padding-right: $grid-unit-10;
+ }
.edit-site-header-toolbar__inserter-toggle {
margin-right: $grid-unit-10;
@@ -89,6 +104,14 @@ body.is-navigation-sidebar-open {
flex-wrap: wrap;
padding-right: $grid-unit-05;
+ .interface-pinned-items {
+ display: none;
+
+ @include break-medium() {
+ display: block;
+ }
+ }
+
// Adjust button paddings to scale better to mobile.
.editor-post-saved-state,
.components-button.components-button {
@@ -101,7 +124,7 @@ body.is-navigation-sidebar-open {
.editor-post-saved-state,
.components-button.is-tertiary {
- padding: 0 #{ $grid-unit-15 / 2 };
+ padding: 0 #{$grid-unit-15 / 2};
}
.edit-site-more-menu .components-button,
@@ -109,7 +132,7 @@ body.is-navigation-sidebar-open {
margin-right: 0;
}
- @include break-small () {
+ @include break-small() {
padding-right: $grid-unit-20;
}
}
diff --git a/packages/edit-site/src/components/left-sidebar/index.js b/packages/edit-site/src/components/left-sidebar/index.js
deleted file mode 100644
index bb5ed6a0cb5332..00000000000000
--- a/packages/edit-site/src/components/left-sidebar/index.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * WordPress dependencies
- */
-import { useSelect, useDispatch } from '@wordpress/data';
-
-/**
- * Internal dependencies
- */
-import InserterPanel from './inserter-panel';
-
-const LeftSidebar = () => {
- const { isInserterOpen } = useSelect( ( select ) => {
- const { isInserterOpened } = select( 'core/edit-site' );
- return {
- isInserterOpen: isInserterOpened(),
- };
- } );
-
- const { setIsInserterOpened } = useDispatch( 'core/edit-site' );
-
- if ( isInserterOpen ) {
- return (
-
setIsInserterOpened( false ) }
- />
- );
- }
-
- return null;
-};
-
-export default LeftSidebar;
diff --git a/packages/edit-site/src/components/left-sidebar/inserter-panel/index.js b/packages/edit-site/src/components/left-sidebar/inserter-panel/index.js
deleted file mode 100644
index 5fb427f19f0a7f..00000000000000
--- a/packages/edit-site/src/components/left-sidebar/inserter-panel/index.js
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * WordPress dependencies
- */
-import { __experimentalLibrary as Library } from '@wordpress/block-editor';
-import { Button } from '@wordpress/components';
-import { useViewportMatch } from '@wordpress/compose';
-import { close } from '@wordpress/icons';
-
-const InserterPanel = ( { closeInserter } ) => {
- const isMobile = useViewportMatch( 'medium', '<' );
-
- return (
-
-
-
-
-
- {
- if ( isMobile ) {
- closeInserter();
- }
- } }
- />
-
-
- );
-};
-
-export default InserterPanel;
diff --git a/packages/edit-site/src/components/left-sidebar/inserter-panel/style.scss b/packages/edit-site/src/components/left-sidebar/inserter-panel/style.scss
deleted file mode 100644
index 6a3f030c4bd3d3..00000000000000
--- a/packages/edit-site/src/components/left-sidebar/inserter-panel/style.scss
+++ /dev/null
@@ -1,25 +0,0 @@
-.edit-site-inserter-panel {
- height: 100%;
- display: flex;
- flex-direction: column;
-}
-
-.edit-site-inserter-panel__header {
- padding-top: $grid-unit-10;
- padding-right: $grid-unit-10;
- display: flex;
- justify-content: flex-end;
-
- @include break-medium() {
- display: none;
- }
-}
-
-.edit-site-inserter-panel__content {
- // Leave space for the close button
- height: calc(100% - #{$button-size} - #{$grid-unit-10});
-
- @include break-medium() {
- height: 100%;
- }
-}
diff --git a/packages/edit-site/src/components/save-button/index.js b/packages/edit-site/src/components/save-button/index.js
index 38dd4467d689e6..4c8b4038ea3ca1 100644
--- a/packages/edit-site/src/components/save-button/index.js
+++ b/packages/edit-site/src/components/save-button/index.js
@@ -9,6 +9,7 @@ import { some } from 'lodash';
import { useSelect } from '@wordpress/data';
import { Button } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
+import { useViewportMatch } from '@wordpress/compose';
export default function SaveButton( { openEntitiesSavedStates } ) {
const { isDirty, isSaving } = useSelect( ( select ) => {
@@ -26,6 +27,8 @@ export default function SaveButton( { openEntitiesSavedStates } ) {
} );
const disabled = ! isDirty || isSaving;
+ const isMobile = useViewportMatch( 'medium', '<' );
+
return (
<>
>
);
diff --git a/packages/edit-site/src/style.scss b/packages/edit-site/src/style.scss
index 8350c69c9942df..59eb3fb4f4dde4 100644
--- a/packages/edit-site/src/style.scss
+++ b/packages/edit-site/src/style.scss
@@ -5,7 +5,6 @@
@import "./components/header/document-actions/style.scss";
@import "./components/header/fullscreen-mode-close/style.scss";
@import "./components/header/more-menu/style.scss";
-@import "./components/left-sidebar/inserter-panel/style.scss";
@import "./components/navigation-sidebar/navigation-toggle/style.scss";
@import "./components/navigation-sidebar/navigation-panel/style.scss";
@import "./components/notices/style.scss";
diff --git a/packages/interface/src/components/interface-skeleton/style.scss b/packages/interface/src/components/interface-skeleton/style.scss
index a4c56e5a09d818..319b9cc9661a3d 100644
--- a/packages/interface/src/components/interface-skeleton/style.scss
+++ b/packages/interface/src/components/interface-skeleton/style.scss
@@ -88,7 +88,6 @@ html.interface-interface-skeleton__html-container {
.interface-interface-skeleton__left-sidebar,
.interface-interface-skeleton__sidebar {
display: block;
- width: auto; // Keep the sidebar width flexible.
flex-shrink: 0;
position: absolute;
z-index: z-index(".interface-interface-skeleton__sidebar");
@@ -103,6 +102,7 @@ html.interface-interface-skeleton__html-container {
@include break-medium() {
position: relative !important;
z-index: z-index(".interface-interface-skeleton__sidebar {greater than small}");
+ width: auto; // Keep the sidebar width flexible.
}
}