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

Inserter: Move the inserter at the bottom of the editor to the right #777

Merged
merged 1 commit into from
May 15, 2017
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
5 changes: 4 additions & 1 deletion editor/inserter/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import { connect } from 'react-redux';
import { flow, groupBy, sortBy, findIndex, filter } from 'lodash';
import classnames from 'classnames';

/**
* WordPress dependencies
Expand Down Expand Up @@ -224,9 +225,11 @@ class InserterMenu extends wp.element.Component {
render() {
const { position = 'top' } = this.props;
const visibleBlocksByCategory = this.getVisibleBlocksByCategory( wp.blocks.getBlocks() );
const positionClasses = position.split( ' ' ).map( ( pos ) => `is-${ pos }` );
const className = classnames( 'editor-inserter__menu', positionClasses );

return (
<div className={ `editor-inserter__menu is-${ position }` } tabIndex="0">
<div className={ className } tabIndex="0">
<div className="editor-inserter__arrow" />
<div role="menu" className="editor-inserter__content">
{ wp.blocks.getCategories()
Expand Down
10 changes: 10 additions & 0 deletions editor/inserter/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@
}
}
}

&.is-right {
left: -32px;
.editor-inserter__arrow {
left: 49px;
&:before {
left: 0;
}
}
}
}

.editor-inserter__arrow {
Expand Down
2 changes: 1 addition & 1 deletion editor/modes/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function VisualEditor( { blocks } ) {
{ blocks.map( ( uid ) => (
<VisualEditorBlock key={ uid } uid={ uid } />
) ) }
<Inserter />
<Inserter position="top right" />
</div>
);
}
Expand Down