-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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] Breadcrumbs #17471
Merged
Merged
[rnmobile] Breadcrumbs #17471
Changes from all commits
Commits
Show all changes
59 commits
Select commit
Hold shift + click to select a range
635108e
[RNMobile] Native mobile release v1.11.0 (#17181)
etoledom 643c1b2
Activate Travis CI on rnmobile/master branch (#17229)
etoledom a78f204
Add native support for the MediaText block (#16305)
Tug 3db95b7
MediaUpload and MediaPlaceholder unify props (#17145)
dratwas 7aa44a2
Unify media placeholder and upload props within media-text (#17268)
lukewalczak f9fa455
[RNMobile] Fix dismiss keyboard button for the post title (#17260)
geriux 7b12673
Recover border colors (#17269)
etoledom 14d482b
[RNMobile] Insure tapping at end of post inserts at end
mchowning 89664eb
Support group block on mobile (#17251)
lukewalczak fc8c3da
Remove redundant bg color within button appender (#17325)
lukewalczak 264b178
[RNMobile] DarkMode improvements (#17309)
etoledom 654e162
Add FloatingToolbar component
lukewalczak 111059c
Add visible overflow to flat list wrapper
lukewalczak 89ed4d7
Remove useless codelines
lukewalczak 900233d
Update test
lukewalczak 2deb517
Trigger CI
lukewalczak 6106f27
Remove redundant conditions
lukewalczak 67c5cca
Trigger CI
lukewalczak 6cd7f52
add breadcrumbs
dratwas 648a1b9
[RNMobile] Add autosave to mobile apps (#17329)
daniloercoli d0c4b3c
styles tweaks
dratwas 92b527e
add icon and some tweaks
dratwas e9d0ade
fix typo
dratwas b4a2a77
add subdirectory icon
dratwas 6147e47
use subdirectory icon
dratwas 9659a73
Trigger CI
lukewalczak e99d365
Add isAppender functionality on mobile (#17195)
lukewalczak 69da85e
Autosave monitor - Make the mobile editor ping the native at each key…
daniloercoli ae6d2ce
[RNMobile] Refactor Dark Mode HOC (#17552)
Tug 1c9b133
Add missing heading levels to the UI (H4, H5, H6) (#17533)
SergioEstevao 8752302
Fix FloatingToolbar for the first item in FlatList
lukewalczak e3a4f1a
Small cleanup
lukewalczak df025a6
Fix lint issue (#17598)
lukewalczak d8b0d83
Fix list filter on paste for RN mobile. (#17550)
SergioEstevao 59f0d5f
Merge branch 'rnmobile/master' into rnmobile/floating-toolbar
lukewalczak f3085c1
[RNMobile] Move MediaUploadPorgress to its own component folder (#17392)
geriux 636bf83
Working on Android toolbar behaviour
lukewalczak b6e9627
style fix
dratwas e51a87c
update toolbar background
dratwas 95acf23
Rnmobile/fix link editing on start (#17631)
SergioEstevao 47cd600
Small code refactor
lukewalczak 6449038
Use temporary solution for first item in group
lukewalczak d0ba0fe
Merge branch 'rnmobile/master' into rnmobile/floating-toolbar
lukewalczak c70edc5
Merge branch 'master' into rnmobile/floating-toolbar
lukewalczak 300a8a5
Merge fix
lukewalczak a9d7489
Merge fix
lukewalczak 2695248
Make FloatingToolbar conditional to show flag
lukewalczak d2a07ec
Fix after merging
lukewalczak e911f5d
Add check for Media&Text block
lukewalczak 89e0790
Merge branch 'rnmobile/master' into rnmobile/breadcrumbs
dratwas e3b3b59
Merge branch 'rnmobile/floating-toolbar' into rnmobile/breadcrumbs
dratwas 98ad647
Merge branch 'master' into rnmobile/breadcrumbs
dratwas addee65
move icon to separate file
dratwas 4d4850a
fix icon
dratwas 60a77f2
fix padding
dratwas 72d41ef
remove incorrect comment
dratwas 171fb82
Merge branch 'master' into rnmobile/breadcrumbs
dratwas 5646a15
remove unused props and change colors
dratwas 7e5bab0
add dark mode
dratwas 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
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
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
68 changes: 68 additions & 0 deletions
68
packages/block-editor/src/components/block-list/breadcrumb.native.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,68 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { Icon } from '@wordpress/components'; | ||
import { withSelect } from '@wordpress/data'; | ||
import { compose } from '@wordpress/compose'; | ||
import { getBlockType } from '@wordpress/blocks'; | ||
|
||
/** | ||
* External dependencies | ||
*/ | ||
import { View, Text, TouchableOpacity } from 'react-native'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import BlockTitle from '../block-title'; | ||
import SubdirectorSVG from './subdirectory-icon'; | ||
|
||
import styles from './breadcrumb.scss'; | ||
|
||
const BlockBreadcrumb = ( { clientId, blockIcon, rootClientId, rootBlockIcon } ) => { | ||
return ( | ||
<View style={ styles.breadcrumbContainer }> | ||
<TouchableOpacity style={ styles.button } onPress={ () => {/* Open BottomSheet with markup */} }> | ||
{ rootClientId && rootBlockIcon && ( | ||
[ <Icon key="parent-icon" size={ 20 } icon={ rootBlockIcon.src } fill={ styles.icon.color } />, | ||
<View key="subdirectory-icon" style={ styles.arrow }><SubdirectorSVG fill={ styles.arrow.color } /></View>, | ||
] | ||
) } | ||
<Icon size={ 24 } icon={ blockIcon.src } fill={ styles.icon.color } /> | ||
<Text style={ styles.breadcrumbTitle }><BlockTitle clientId={ clientId } /></Text> | ||
</TouchableOpacity> | ||
</View> | ||
); | ||
}; | ||
|
||
export default compose( [ | ||
withSelect( ( select, { clientId } ) => { | ||
const { | ||
getBlockRootClientId, | ||
getBlockName, | ||
} = select( 'core/block-editor' ); | ||
|
||
const blockName = getBlockName( clientId ); | ||
const blockType = getBlockType( blockName ); | ||
const blockIcon = blockType.icon; | ||
|
||
const rootClientId = getBlockRootClientId( clientId ); | ||
|
||
if ( ! rootClientId ) { | ||
return { | ||
clientId, | ||
blockIcon, | ||
}; | ||
} | ||
const rootBlockName = getBlockName( rootClientId ); | ||
const rootBlockType = getBlockType( rootBlockName ); | ||
const rootBlockIcon = rootBlockType.icon; | ||
|
||
return { | ||
clientId, | ||
blockIcon, | ||
rootClientId, | ||
rootBlockIcon, | ||
}; | ||
} ), | ||
] )( BlockBreadcrumb ); |
28 changes: 28 additions & 0 deletions
28
packages/block-editor/src/components/block-list/breadcrumb.native.scss
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,28 @@ | ||
.breadcrumbContainer { | ||
flex-direction: row; | ||
align-items: center; | ||
justify-content: flex-start; | ||
padding-left: 5; | ||
padding-right: 15; | ||
} | ||
|
||
.breadcrumbTitle { | ||
color: $white; | ||
margin-left: 4; | ||
} | ||
|
||
.icon { | ||
color: $white; | ||
} | ||
|
||
.button { | ||
flex-direction: row; | ||
align-items: center; | ||
} | ||
|
||
.arrow { | ||
color: $light-opacity-light-700; | ||
margin-top: -4px; | ||
margin-left: 4; | ||
margin-right: 4; | ||
} |
18 changes: 18 additions & 0 deletions
18
packages/block-editor/src/components/block-list/subdirectory-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,18 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { SVG, Path } from '@wordpress/components'; | ||
|
||
const Subdirectory = ( { ...extraProps } ) => ( | ||
<SVG | ||
xmlns="http://www.w3.org/2000/svg" | ||
width={ 14 } | ||
height={ 14 } | ||
viewBox="0 0 20 20" | ||
{ ...extraProps } | ||
> | ||
<Path d="M19 15l-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z" /> | ||
</SVG> ) | ||
; | ||
|
||
export default Subdirectory; |
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.
Note that there is also a
usePreferredColorScheme
hook. I'm fine with either option, but the hook seemed like a better fit for a functional component, so just raising awareness of it 😁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.
You're right that there is a hook called
usePreferredColorScheme
but I would need to duplicate logic from here since the hook provides only 'dark' or 'light' string.https://github.com/WordPress/gutenberg/blob/master/packages/compose/src/higher-order/with-preferred-color-scheme/index.native.js#L9-L18
Maybe we could extract that logic somewhere which will allow us to easily use with
usePreferredColorScheme
hook w/o duplication.