From d538f429f018aba34814b360c5adf37eb6013427 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Fri, 17 May 2024 11:56:56 +0100 Subject: [PATCH] Site Editor: Use a consistent snackbar position (#61756) Co-authored-by: youknowriad Co-authored-by: jasmussen Co-authored-by: jameskoster Co-authored-by: ntsekouras --- packages/edit-site/src/components/editor/index.js | 2 -- .../edit-site/src/components/editor/style.scss | 15 --------------- packages/edit-site/src/components/layout/index.js | 7 ++++++- .../edit-site/src/components/layout/style.scss | 8 ++++++++ packages/edit-site/src/components/page/index.js | 6 +----- 5 files changed, 15 insertions(+), 23 deletions(-) diff --git a/packages/edit-site/src/components/editor/index.js b/packages/edit-site/src/components/editor/index.js index b7e9655919cf6..7a215fdd9421e 100644 --- a/packages/edit-site/src/components/editor/index.js +++ b/packages/edit-site/src/components/editor/index.js @@ -27,7 +27,6 @@ import { EditorKeyboardShortcutsRegister, EditorKeyboardShortcuts, EditorNotices, - EditorSnackbars, privateApis as editorPrivateApis, store as editorStore, } from '@wordpress/editor'; @@ -345,7 +344,6 @@ export default function Editor( { isLoading, onClick } ) { } /> } - notices={ } content={ <> diff --git a/packages/edit-site/src/components/editor/style.scss b/packages/edit-site/src/components/editor/style.scss index 000c64fd8ae03..92c7727be6be0 100644 --- a/packages/edit-site/src/components/editor/style.scss +++ b/packages/edit-site/src/components/editor/style.scss @@ -17,18 +17,3 @@ display: flex; justify-content: center; } - -// Adjust the position of the notices when breadcrumbs are present -.edit-site .has-block-breadcrumbs.is-full-canvas .components-editor-notices__snackbar { - bottom: 40px; -} - -// Adjust the position of the notices -.edit-site .components-editor-notices__snackbar { - position: absolute; - right: 0; - bottom: 16px; - padding-left: 16px; - padding-right: 16px; -} -@include editor-left(".edit-site .components-editor-notices__snackbar") diff --git a/packages/edit-site/src/components/layout/index.js b/packages/edit-site/src/components/layout/index.js index d8b0d85e484ed..83beee41642d3 100644 --- a/packages/edit-site/src/components/layout/index.js +++ b/packages/edit-site/src/components/layout/index.js @@ -30,7 +30,10 @@ import { store as blockEditorStore, } from '@wordpress/block-editor'; import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands'; -import { privateApis as editorPrivateApis } from '@wordpress/editor'; +import { + EditorSnackbars, + privateApis as editorPrivateApis, +} from '@wordpress/editor'; /** * Internal dependencies @@ -262,6 +265,8 @@ export default function Layout() { ) } + + { isMobileViewport && areas.mobile && (
{ areas.mobile } diff --git a/packages/edit-site/src/components/layout/style.scss b/packages/edit-site/src/components/layout/style.scss index fda34feeb2832..fdbf6b184aa21 100644 --- a/packages/edit-site/src/components/layout/style.scss +++ b/packages/edit-site/src/components/layout/style.scss @@ -277,3 +277,11 @@ margin: $canvas-padding $canvas-padding $canvas-padding 0; } } + +.edit-site .components-editor-notices__snackbar { + position: fixed; + right: 0; + bottom: 16px; + padding-left: 16px; + padding-right: 16px; +} diff --git a/packages/edit-site/src/components/page/index.js b/packages/edit-site/src/components/page/index.js index 7ed4e9d2c2c92..6609abb8f5244 100644 --- a/packages/edit-site/src/components/page/index.js +++ b/packages/edit-site/src/components/page/index.js @@ -6,10 +6,7 @@ import clsx from 'clsx'; /** * WordPress dependencies */ -import { - EditorSnackbars, - privateApis as editorPrivateApis, -} from '@wordpress/editor'; +import { privateApis as editorPrivateApis } from '@wordpress/editor'; /** * Internal dependencies @@ -41,7 +38,6 @@ export default function Page( { ) } { children }
- ); }