-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RNMobile] Page Template Picker UI Improvements (#19307)
* RNMobile - Page template picker: styles and icons, scroll and accessibility text * Update Page templates picker for web * RNMobile - Layout template picker: accessibility hint added * RNMobile - Layout template picker: style improvements, removed unneeded icons * Page layout picker: remove Icon dependency
- Loading branch information
Showing
8 changed files
with
110 additions
and
30 deletions.
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
40 changes: 30 additions & 10 deletions
40
packages/block-editor/src/components/page-template-picker/button.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 |
---|---|---|
@@ -1,20 +1,40 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { Button } from 'react-native'; | ||
import { TouchableOpacity, Text } from 'react-native'; | ||
|
||
const PickerButton = ( props ) => { | ||
const { | ||
label, | ||
onPress, | ||
} = props; | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __ } from '@wordpress/i18n'; | ||
import { withPreferredColorScheme } from '@wordpress/compose'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import styles from './styles.scss'; | ||
|
||
const PickerButton = ( { | ||
icon, | ||
label, | ||
onPress, | ||
getStylesFromColorScheme, | ||
} ) => { | ||
const butonStyles = getStylesFromColorScheme( styles.button, styles.buttonDark ); | ||
const butonTextStyles = getStylesFromColorScheme( styles.buttonText, styles.buttonTextDark ); | ||
|
||
return ( | ||
<Button | ||
<TouchableOpacity | ||
accessibilityLabel={ label } | ||
accessibilityHint={ __( 'Double tap to select layout' ) } | ||
activeOpacity={ 0.7 } | ||
onPress={ onPress } | ||
title={ label } | ||
/> | ||
style={ butonStyles } | ||
> | ||
<Text style={ styles.buttonIcon }>{ icon }</Text> | ||
<Text style={ butonTextStyles }>{ label }</Text> | ||
</TouchableOpacity> | ||
); | ||
}; | ||
|
||
export default PickerButton; | ||
export default withPreferredColorScheme( PickerButton ); |
9 changes: 7 additions & 2 deletions
9
packages/block-editor/src/components/page-template-picker/container.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
24 changes: 22 additions & 2 deletions
24
packages/block-editor/src/components/page-template-picker/container.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 |
---|---|---|
@@ -1,6 +1,26 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { View } from 'react-native'; | ||
import { ScrollView } from 'react-native'; | ||
|
||
export default View; | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import styles from './styles.scss'; | ||
|
||
const Container = ( { style, children } ) => { | ||
return ( | ||
<ScrollView | ||
alwaysBounceHorizontal={ false } | ||
contentContainerStyle={ styles.content } | ||
horizontal={ true } | ||
keyboardShouldPersistTaps="always" | ||
showsHorizontalScrollIndicator={ false } | ||
style={ [ styles.container, style ] } | ||
> | ||
{ children } | ||
</ScrollView > | ||
); | ||
}; | ||
|
||
export default Container; |
4 changes: 2 additions & 2 deletions
4
packages/block-editor/src/components/page-template-picker/default-templates.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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
const defaultTemplates = [ | ||
{ name: 'About', content: '<!-- wp:paragraph {"align":"left"} --><p class="has-text-align-left">Visitors will want to know who is on the other side of the page. Use this space to write about yourself, your site, your business, or anything you want. Use the testimonials below to quote others, talking about the same thing – in their own words.</p><!-- /wp:paragraph -->' }, | ||
{ name: 'Contact', content: '<!-- wp:paragraph {"align":"left"} --><p class="has-text-align-left">Let\'s talk 👋 Don\'t hesitate to reach out with the contact information below, or send a message using the form.</p><!-- /wp:paragraph -->' }, | ||
{ name: 'About', icon: '👋', content: '<!-- wp:paragraph {"align":"left"} --><p class="has-text-align-left">Visitors will want to know who is on the other side of the page. Use this space to write about yourself, your site, your business, or anything you want. Use the testimonials below to quote others, talking about the same thing – in their own words.</p><!-- /wp:paragraph -->' }, | ||
{ name: 'Contact', icon: '✉️', content: '<!-- wp:paragraph {"align":"left"} --><p class="has-text-align-left">Let\'s talk 👋 Don\'t hesitate to reach out with the contact information below, or send a message using the form.</p><!-- /wp:paragraph -->' }, | ||
]; | ||
|
||
export default defaultTemplates; |
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
36 changes: 36 additions & 0 deletions
36
packages/block-editor/src/components/page-template-picker/styles.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,36 @@ | ||
.container { | ||
margin: 10px 0; | ||
} | ||
|
||
.content { | ||
padding: 0 12px; | ||
} | ||
|
||
.button { | ||
background-color: rgba($black, 0.04); | ||
border-radius: 20px; | ||
flex-direction: row; | ||
margin-right: 8px; | ||
padding: 9px 18px 9px 14px; | ||
align-items: center; | ||
} | ||
|
||
.buttonDark { | ||
background-color: rgba($white, 0.08); | ||
} | ||
|
||
.buttonIcon { | ||
margin-right: 6px; | ||
font-size: 18px; | ||
} | ||
|
||
.buttonText { | ||
color: $dark-opacity-800; | ||
font-size: 14px; | ||
font-weight: 600; | ||
letter-spacing: 0.25px; | ||
} | ||
|
||
.buttonTextDark { | ||
color: $light-opacity-700; | ||
} |
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