Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notices: Fix snackbar placement #60912

Merged
merged 3 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ function Layout( { initialPost } ) {
showMetaBoxes,
documentLabel,
hasHistory,
hasBlockBreadcrumbs,
} = useSelect( ( select ) => {
const { get } = select( preferencesStore );
const { getEditorSettings, getPostTypeLabel } = select( editorStore );
Expand Down Expand Up @@ -192,6 +193,7 @@ function Layout( { initialPost } ) {
hasBlockSelected:
!! select( blockEditorStore ).getBlockSelectionStart(),
hasHistory: !! getEditorSettings().onNavigateToPreviousEntityRecord,
hasBlockBreadcrumbs: get( 'core', 'showBlockBreadcrumbs' ),
};
}, [] );

Expand Down Expand Up @@ -242,6 +244,7 @@ function Layout( { initialPost } ) {
'has-metaboxes': hasActiveMetaboxes,
'is-distraction-free': isDistractionFree && isWideViewport,
'is-entity-save-view-open': !! entitiesSavedStatesCallback,
'has-block-breadcrumbs': hasBlockBreadcrumbs,
} );

const secondarySidebarLabel = isListViewOpened
Expand Down
11 changes: 9 additions & 2 deletions packages/edit-post/src/components/layout/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@
.edit-post-layout .components-editor-notices__snackbar {
position: fixed;
right: 0;
bottom: 40px;
bottom: 16px;
padding-left: 16px;
padding-right: 16px;
}

.is-distraction-free {
.components-editor-notices__snackbar {
bottom: 20px;
bottom: 16px;
}
}

// Adjust the position of the notices when breadcrumbs are present
.has-block-breadcrumbs:not(.is-distraction-free) {
.components-editor-notices__snackbar {
bottom: 40px;
}
}

Expand Down
7 changes: 6 additions & 1 deletion packages/edit-site/src/components/editor/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@
justify-content: center;
}

// Adjust the position of the notices when breadcrumbs are present
.edit-site .has-block-breadcrumbs.is-full-canvas:not(.is-distraction-free) .components-editor-notices__snackbar {
bottom: 40px;
}

// Adjust the position of the notices
.edit-site .components-editor-notices__snackbar {
position: absolute;
right: 0;
bottom: 40px;
bottom: 16px;
padding-left: 16px;
padding-right: 16px;
}
Expand Down
6 changes: 6 additions & 0 deletions packages/edit-site/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default function Layout() {
canvasMode,
previousShortcut,
nextShortcut,
hasBlockBreadcrumbs,
} = useSelect( ( select ) => {
const { getAllShortcutKeyCombinations } = select(
keyboardShortcutsStore
Expand All @@ -99,6 +100,10 @@ export default function Layout() {
'core',
'distractionFree'
),
hasBlockBreadcrumbs: select( preferencesStore ).get(
'core',
'showBlockBreadcrumbs'
),
isZoomOutMode:
select( blockEditorStore ).__unstableGetEditorMode() ===
'zoom-out',
Expand Down Expand Up @@ -182,6 +187,7 @@ export default function Layout() {
'has-fixed-toolbar': hasFixedToolbar,
'is-block-toolbar-visible': hasBlockSelected,
'is-zoom-out': isZoomOutMode,
'has-block-breadcrumbs': hasBlockBreadcrumbs,
}
) }
>
Expand Down
Loading