Skip to content

Commit

Permalink
Try dark toolbar for the write mode (#66116)
Browse files Browse the repository at this point in the history
Co-authored-by: dhruvang21 <[email protected]>
Co-authored-by: richtabor <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: draganescu <[email protected]>
Co-authored-by: jameskoster <[email protected]>
Co-authored-by: getdave <[email protected]>
Co-authored-by: jasmussen <[email protected]>
Co-authored-by: hanneslsm <[email protected]>
  • Loading branch information
9 people authored Nov 27, 2024
1 parent ee17975 commit 0f6ab5d
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
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

1 comment on commit 0f6ab5d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 0f6ab5d.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/12046511633
📝 Reported issues:

Please sign in to comment.