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

Block library: Refactor Heading block to use class names for text align #16035

Merged
merged 5 commits into from
Jun 14, 2019
Merged
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
Prev Previous commit
Next Next commit
Fix Heading icon in the collapsed mode
  • Loading branch information
gziolo committed Jun 14, 2019
commit 3aee04bd56f73d4a98a31683095a79be6f8350ac
11 changes: 8 additions & 3 deletions packages/block-library/src/heading/heading-toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { range } from 'lodash';
import { __, sprintf } from '@wordpress/i18n';
import { Component } from '@wordpress/element';
import { Toolbar } from '@wordpress/components';
import { withViewportMatch } from '@wordpress/viewport';

class HeadingToolbar extends Component {
createLevelControl( targetLevel, selectedLevel, onChange ) {
Expand All @@ -23,11 +24,15 @@ class HeadingToolbar extends Component {
}

render() {
const { minLevel, maxLevel, selectedLevel, onChange } = this.props;
const { isLargeViewport, minLevel, maxLevel, onChange, selectedLevel } = this.props;
return (
<Toolbar controls={ range( minLevel, maxLevel ).map( ( index ) => this.createLevelControl( index, selectedLevel, onChange ) ) } />
<Toolbar
controls={ range( minLevel, maxLevel ).map( ( index ) => this.createLevelControl( index, selectedLevel, onChange ) ) }
icon="heading"
isCollapsed={ ! isLargeViewport }
/>
);
}
}

export default HeadingToolbar;
export default withViewportMatch( { isLargeViewport: 'medium' } )( HeadingToolbar );