diff --git a/components/toolbar/style.scss b/components/toolbar/style.scss index 024ed169a7eae..432d8975cb560 100644 --- a/components/toolbar/style.scss +++ b/components/toolbar/style.scss @@ -38,12 +38,15 @@ div.components-toolbar { display: inline-flex; align-items: flex-end; margin: 0; - padding: 3px; outline: none; cursor: pointer; position: relative; - width: $icon-button-size; height: $icon-button-size; + padding: 3px 1px; + + @include break-small() { + padding: 3px; + } // unset icon button styles &:active, diff --git a/core-blocks/heading/edit.js b/core-blocks/heading/edit.js index 60869aca35e3f..fc2abd68c035f 100644 --- a/core-blocks/heading/edit.js +++ b/core-blocks/heading/edit.js @@ -1,17 +1,16 @@ /** * WordPress dependencies */ - -import { __, sprintf } from '@wordpress/i18n'; +import { __ } from '@wordpress/i18n'; import { Fragment } from '@wordpress/element'; -import { PanelBody, Toolbar } from '@wordpress/components'; import { createBlock } from '@wordpress/blocks'; -import { RichText, BlockControls, InspectorControls, AlignmentToolbar } from '@wordpress/editor'; +import { RichText, BlockControls, AlignmentToolbar } from '@wordpress/editor'; /** * Internal dependencies */ import './editor.scss'; +import HeadingStylesToolbar from './styles-toolbar'; export default function HeadingEdit( { attributes, @@ -26,37 +25,19 @@ export default function HeadingEdit( { return ( - ( { - icon: 'heading', - title: sprintf( __( 'Heading %s' ), level ), - isActive: 'H' + level === nodeName, - onClick: () => setAttributes( { nodeName: 'H' + level } ), - subscript: level, - } ) ) } + { + setAttributes( { nodeName: nextNodeName } ); + } } + /> + { + setAttributes( { align: nextAlign } ); + } } /> - - -

{ __( 'Level' ) }

- ( { - icon: 'heading', - title: sprintf( __( 'Heading %s' ), level ), - isActive: 'H' + level === nodeName, - onClick: () => setAttributes( { nodeName: 'H' + level } ), - subscript: level, - } ) ) } - /> -

{ __( 'Text Alignment' ) }

- { - setAttributes( { align: nextAlign } ); - } } - /> -
-
( + + + +); + +const HeadingStylesToolbar = ( { value, onChange } ) => ( + { + const openOnArrowDown = ( event ) => { + if ( ! isOpen && event.keyCode === keycodes.DOWN ) { + event.preventDefault(); + event.stopPropagation(); + onToggle(); + } + }; + const label = __( 'Change heading style' ); + + return ( + + } + onClick={ onToggle } + aria-haspopup="true" + aria-expanded={ isOpen } + label={ label } + tooltip={ label } + onKeyDown={ openOnArrowDown } + > + + + + ); + } } + renderContent={ ( { onClose } ) => ( +
+ + { __( 'Heading style:' ) } + + + { '123456'.split( '' ).map( ( level ) => ( + } + subscript={ level } + className={ classnames( + 'core-blocks-heading__styles-toolbar-menu-item', { + 'is-active': value === 'H' + level, + } + ) } + onClick={ () => { + onChange( 'H' + level ); + onClose(); + } } + role="menuitem" + > + { sprintf( __( 'Heading %s' ), level ) } + + ) ) } + +
+ ) } + /> +); + +export default HeadingStylesToolbar; diff --git a/editor/components/block-switcher/style.scss b/editor/components/block-switcher/style.scss index 8a0936e267ca1..2912fc288f097 100644 --- a/editor/components/block-switcher/style.scss +++ b/editor/components/block-switcher/style.scss @@ -9,8 +9,12 @@ .editor-block-switcher__toggle { width: auto; margin: 0; - padding: 8px; border-radius: 0; + padding: 8px 4px; + + @include break-small() { + padding: 8px; + } &:focus:before { top: -3px;