Skip to content

Commit

Permalink
[RNMobile] Inner Block Navigate upward through hierarchy (#17496)
Browse files Browse the repository at this point in the history
* add navigate up button on floating toolbar
  • Loading branch information
jbinda authored Oct 8, 2019
1 parent 9de487d commit 7a393af
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/block-editor/src/components/block-list/block.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
* WordPress dependencies
*/
import { Component } from '@wordpress/element';
import { ToolbarButton, Toolbar } from '@wordpress/components';
import { withDispatch, withSelect } from '@wordpress/data';
import { compose } from '@wordpress/compose';
import { getBlockType } from '@wordpress/blocks';
Expand All @@ -24,6 +25,7 @@ import BlockEdit from '../block-edit';
import BlockInvalidWarning from './block-invalid-warning';
import BlockMobileToolbar from './block-mobile-toolbar';
import FloatingToolbar from './block-mobile-floating-toolbar';
import NavigateUpSVG from './nav-up-icon';

class BlockListBlock extends Component {
constructor() {
Expand Down Expand Up @@ -124,7 +126,18 @@ class BlockListBlock extends Component {
return (
<>
{ showFloatingToolbar && ( ! isFirstBlock || parentId === '' ) && <FloatingToolbar.Slot /> }
{ showFloatingToolbar && <FloatingToolbar /> }
{ showFloatingToolbar &&
( <FloatingToolbar>
<Toolbar passedStyle={ styles.toolbar }>
<ToolbarButton
title={ __( 'Navigate Up' ) }
onClick={ () => this.props.onSelect( parentId ) }
icon={ NavigateUpSVG }
/>
<View style={ styles.pipe } />
</Toolbar>
</FloatingToolbar>
) }
<TouchableWithoutFeedback
onPress={ this.onFocus }
accessible={ ! isSelected }
Expand Down
17 changes: 17 additions & 0 deletions packages/block-editor/src/components/block-list/block.native.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,20 @@
.blockText {
min-height: 50px;
}

.toolbar {
border-left-width: 0;
margin-right: auto;
padding-left: 2px;
height: 44px;
}

.pipe {
margin-top: auto;
margin-bottom: auto;
margin-left: 2px;
height: 28px;
width: 1px;
background-color: #e9eff3;
opacity: 0.4;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* WordPress dependencies
*/
import { SVG, Path } from '@wordpress/components';

const NavigateUp = <SVG width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><Path fill="none" d="M0 0h24v24H0V0z" /><Path fill="white" fillRule="evenodd" clipRule="evenodd" d="M17,11 z L15.58,12.42 L12,8.83 L12,18 L22,18 L22,20 L10,20 L10,8.83 L6.42,12.42 L5,11 L11,5 L17,11" /></SVG>;

export default NavigateUp;

0 comments on commit 7a393af

Please sign in to comment.