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

Try dark toolbar for the write mode #66116

Merged
merged 8 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 8 additions & 0 deletions packages/block-editor/src/components/block-toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ export function PrivateBlockToolbar( {
showGroupButtons,
showLockButtons,
showSwitchSectionStyleButton,
hasFixedToolbar,
isNavigationMode,
} = useSelect( ( select ) => {
const {
getBlockName,
Expand All @@ -85,8 +87,10 @@ export function PrivateBlockToolbar( {
getBlockAttributes,
getBlockParentsByBlockName,
getTemplateLock,
getSettings,
getParentSectionBlock,
isZoomOut,
isNavigationMode: _isNavigationMode,
} = unlock( select( blockEditorStore ) );
const selectedBlockClientIds = getSelectedBlockClientIds();
const selectedBlockClientId = selectedBlockClientIds[ 0 ];
Expand Down Expand Up @@ -119,6 +123,7 @@ export function PrivateBlockToolbar( {
const _hasTemplateLock = selectedBlockClientIds.some(
( id ) => getTemplateLock( id ) === 'contentOnly'
);

return {
blockClientId: selectedBlockClientId,
blockClientIds: selectedBlockClientIds,
Expand All @@ -144,6 +149,8 @@ export function PrivateBlockToolbar( {
showGroupButtons: ! isZoomOut(),
showLockButtons: ! isZoomOut(),
showSwitchSectionStyleButton: isZoomOut(),
hasFixedToolbar: getSettings().hasFixedToolbar,
isNavigationMode: _isNavigationMode(),
};
}, [] );

Expand All @@ -170,6 +177,7 @@ export function PrivateBlockToolbar( {
// Shifts the toolbar to make room for the parent block selector.
const classes = clsx( 'block-editor-block-contextual-toolbar', {
'has-parent': showParentSelector,
'is-inverted-toolbar': isNavigationMode && ! hasFixedToolbar,
} );

const innerClasses = clsx( 'block-editor-block-toolbar', {
Expand Down
39 changes: 39 additions & 0 deletions packages/block-editor/src/components/block-tools/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,45 @@
border-right-color: $gray-900;
}

.is-inverted-toolbar {
background-color: $gray-900;
color: $gray-100;

&.block-editor-block-contextual-toolbar {
border-color: $gray-800;
}

button {
color: $gray-300;

&:hover {
color: $white;
}

&:focus::before {
box-shadow: inset 0 0 0 1px $gray-900, 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
}
}

.block-editor-block-parent-selector .block-editor-block-parent-selector__button {
border-color: $gray-800;
background-color: $gray-900;
}

.block-editor-block-switcher__toggle {
color: $gray-100;
}

.components-toolbar-group,
.components-toolbar {
border-right-color: $gray-800 !important;
}

.is-pressed {
color: var(--wp-admin-theme-color);
}
}

// Hide the block toolbar if the insertion point is shown.
&.is-insertion-point-visible {
visibility: hidden;
Expand Down
Loading