Skip to content

Commit

Permalink
Add HelpSectionTitle component
Browse files Browse the repository at this point in the history
  • Loading branch information
fluiddot committed May 13, 2022
1 parent d6f5639 commit 61bb555
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* External dependencies
*/
import { Text, View } from 'react-native';

/**
* WordPress dependencies
*/
import { usePreferredColorSchemeStyle } from '@wordpress/compose';

/**
* Internal dependencies
*/
import styles from './style.scss';

const HelpSectionTitle = ( { children } ) => {
const helpSectionTitle = usePreferredColorSchemeStyle(
styles.helpSectionTitle,
styles.helpSectionTitleDark
);

return (
<View style={ styles.helpSectionTitleContainer }>
<Text style={ helpSectionTitle }>{ children }</Text>
</View>
);
};

export default HelpSectionTitle;
21 changes: 7 additions & 14 deletions packages/editor/src/components/editor-help/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
import { kebabCase } from 'lodash';
import { Text, SafeAreaView, ScrollView, StyleSheet, View } from 'react-native';
import { SafeAreaView, ScrollView, StyleSheet, View } from 'react-native';
import { TransitionPresets } from '@react-navigation/stack';

/**
Expand All @@ -17,7 +17,6 @@ import { __ } from '@wordpress/i18n';
import { helpFilled, plusCircleFilled, trash, cog } from '@wordpress/icons';
import { useSelect } from '@wordpress/data';
import { store as editorStore } from '@wordpress/editor';
import { usePreferredColorSchemeStyle } from '@wordpress/compose';
import {
requestContactCustomerSupport,
requestGotoCustomerSupportOptions,
Expand All @@ -35,7 +34,8 @@ import AddBlocks from './add-blocks';
import MoveBlocks from './move-blocks';
import RemoveBlocks from './remove-blocks';
import CustomizeBlocks from './customize-blocks';
import moveBlocksIcon from './icon-move-blocks.native';
import moveBlocksIcon from './icon-move-blocks';
import HelpSectionTitle from './help-section-title';

const HELP_TOPICS = [
{
Expand All @@ -62,11 +62,6 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
postType: select( editorStore ).getEditedPostAttribute( 'type' ),
} ) );

const sectionTitle = usePreferredColorSchemeStyle(
styles.helpDetailSectionHeading,
styles.helpDetailSectionHeadingDark
);

const title =
postType === 'page'
? __( 'How to edit your page' )
Expand Down Expand Up @@ -125,9 +120,9 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
} }
>
<PanelBody>
<Text style={ sectionTitle }>
<HelpSectionTitle>
{ __( 'The basics' ) }
</Text>
</HelpSectionTitle>
{ /* Print out help topics. */ }
{ HELP_TOPICS.map(
( { label, icon } ) => {
Expand All @@ -149,11 +144,9 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
}
) }
{
<Text
style={ sectionTitle }
>
<HelpSectionTitle>
{ __( 'Get support' ) }
</Text>
</HelpSectionTitle>
}
{
<HelpGetSupportButton
Expand Down
15 changes: 15 additions & 0 deletions packages/editor/src/components/editor-help/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@
padding: 0;
}

.helpSectionTitleContainer {
margin-top: 24px;
margin-bottom: 16px;
}

.helpSectionTitle {
color: $light-primary;
font-weight: 600;
font-size: 16px;
}

.helpSectionTitleDark {
color: $dark-secondary;
}

.helpDetailContainer {
padding: 0 16px;
}
Expand Down

0 comments on commit 61bb555

Please sign in to comment.