Skip to content

Commit

Permalink
Prevent rendering separator on last help topic item
Browse files Browse the repository at this point in the history
  • Loading branch information
fluiddot committed May 13, 2022
1 parent 61bb555 commit 12fe702
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { useNavigation } from '@react-navigation/native';
import { TextControl, Icon } from '@wordpress/components';
import { chevronRight } from '@wordpress/icons';

const HelpTopicRow = ( { label, icon, screenName } ) => {
const HelpTopicRow = ( { label, icon, screenName, isLastItem } ) => {
const navigation = useNavigation();

const openSubSheet = () => {
Expand All @@ -18,7 +18,7 @@ const HelpTopicRow = ( { label, icon, screenName } ) => {

return (
<TextControl
separatorType="leftMargin"
separatorType={ isLastItem ? 'none' : 'leftMargin' }
customActionButton
leftAlign
onPress={ openSubSheet }
Expand Down
12 changes: 11 additions & 1 deletion packages/editor/src/components/editor-help/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,17 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
</HelpSectionTitle>
{ /* Print out help topics. */ }
{ HELP_TOPICS.map(
( { label, icon } ) => {
(
{ label, icon },
index
) => {
const labelSlug = kebabCase(
label
);
const isLastItem =
index ===
HELP_TOPICS.length -
1;
return (
<HelpTopicRow
key={
Expand All @@ -139,6 +146,9 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
screenName={
labelSlug
}
isLastItem={
isLastItem
}
/>
);
}
Expand Down

0 comments on commit 12fe702

Please sign in to comment.