From afe1634d58b042d91fa3991cacfbbce3a34aac2d Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Tue, 21 May 2024 12:59:27 +0200 Subject: [PATCH 1/4] First pass at wrapper component for Show button text labels. --- .../src/components/document-tools/index.js | 7 ++-- .../src/components/editor-history/redo.js | 4 +-- .../src/components/editor-history/undo.js | 4 +-- .../editor/src/components/header/style.scss | 8 ----- .../preferences-aware-button/index.js | 34 +++++++++++++++++++ 5 files changed, 42 insertions(+), 15 deletions(-) create mode 100644 packages/editor/src/components/preferences-aware-button/index.js diff --git a/packages/editor/src/components/document-tools/index.js b/packages/editor/src/components/document-tools/index.js index 6952fa34e31ae9..8887a26194d7f0 100644 --- a/packages/editor/src/components/document-tools/index.js +++ b/packages/editor/src/components/document-tools/index.js @@ -14,7 +14,7 @@ import { ToolSelector, store as blockEditorStore, } from '@wordpress/block-editor'; -import { Button, ToolbarItem } from '@wordpress/components'; +import { ToolbarItem } from '@wordpress/components'; import { listView, plus } from '@wordpress/icons'; import { useCallback } from '@wordpress/element'; import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts'; @@ -27,6 +27,7 @@ import { unlock } from '../../lock-unlock'; import { store as editorStore } from '../../store'; import EditorHistoryRedo from '../editor-history/redo'; import EditorHistoryUndo from '../editor-history/undo'; +import PreferencesAwareButton from '../preferences-aware-button'; const preventDefault = ( event ) => { event.preventDefault(); @@ -118,7 +119,7 @@ function DocumentTools( { { ! isDistractionFree && ( { ! isDistractionFree && ( { + const { get } = select( preferencesStore ); + + return { + showIconLabels: get( 'core', 'showIconLabels' ), + }; + }, [] ); + + const { icon, label, text, ...restProps } = props; + + return ( +