Skip to content

Commit

Permalink
Help component: Avoid rendering link without text
Browse files Browse the repository at this point in the history
A conditional has been created to check that s link has text associated with it before rendering.
  • Loading branch information
SiobhyB committed Nov 2, 2022
1 parent 79ea8b5 commit 8ee995c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/components/src/help-text/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const HelpText = ( { moreLinkText, children, url, separatorType } ) => {
styles[ 'help-text__separator--dark' ]
);

const hasMoreLink = url && moreLinkText;

return (
<>
{ separatorType === 'topFullWidth' && (
Expand All @@ -46,8 +48,8 @@ const HelpText = ( { moreLinkText, children, url, separatorType } ) => {
style={ styles[ 'help-text__text' ] }
>
{ children }
{ children && url && ' ' }
{ url && (
{ children && hasMoreLink && ' ' }
{ hasMoreLink && (
<ExternalLink href={ url }>
{ moreLinkText }
</ExternalLink>
Expand Down

0 comments on commit 8ee995c

Please sign in to comment.