-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[RNMobile] Inner Block Navigate upward through hierarchy #17496
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1952fbf
WIP: add navigate up button on floating toolbar
jbinda f0bf3d3
EOD: change color of FloatingToolbar arrow to white
jbinda 89dae55
add nav-up icon
jbinda c97a42b
add and style floating-toolbar pipe
jbinda c046e79
review fix
jbinda f90aa6f
apply pipe opacity
jbinda 57b82d9
apply pipe opacity
jbinda 6395ff2
fix
jbinda 6e617fe
remove fill icon color prop
jbinda 1835ae6
fix lint
jbinda 9fd9828
adjust style
jbinda 0243f42
adjust tap area
jbinda File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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'; | ||
|
@@ -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() { | ||
|
@@ -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 } /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is fine for this one, but it should become the toolbar's border when we add the breadcrumbs |
||
</Toolbar> | ||
</FloatingToolbar> | ||
) } | ||
<TouchableWithoutFeedback | ||
onPress={ this.onFocus } | ||
accessible={ ! isSelected } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
packages/block-editor/src/components/block-list/nav-up-icon.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one is using a
ToolbarButton
while #17471 is using a custom component that replicates the functionality ofIconButton
. Can we make these two consistent?I think we could keep
FloatingToolbar
as the generic UI component and something likeBlockNavigationToolbar
that puts the up button and breadcrumbs in a floating toolbar.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that we could keep button and breadcrumbs in separate component and make buttons consistent.
I think the best way to achieve that is
merge
this PR if rest of the code is fine. Then sync breadcrumb branch and do the refactor you mentioned. WDYT ?