Skip to content

Commit

Permalink
use react Conditional Rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
menghif committed Oct 21, 2021
1 parent c4ed6c8 commit 1b32de0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/web/src/components/Posts/GitHubInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ const GitHubInfo = ({ ghUrls }: Props) => {
return (
<ListSubheader className={classes.root}>
<div className={classes.GitHubInfoContainer}>
{repos.length > 0 && <Repos repoUrls={repos} />}
{issues.length > 0 && <Issues issueUrls={issues} />}
{pullRequests.length > 0 && <PullRequests prUrls={pullRequests} />}
{!!repos.length && <Repos repoUrls={repos} />}
{!!issues.length && <Issues issueUrls={issues} />}
{!!pullRequests.length && <PullRequests prUrls={pullRequests} />}
</div>
</ListSubheader>
);
Expand Down
2 changes: 1 addition & 1 deletion src/web/src/components/Posts/Post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ const PostComponent = ({ postUrl }: Props) => {
postDate={formatPublishedDate(post.updated)}
blogUrl={post.feed.link}
/>
{extractedGitHubUrls.length ? <GitHubInfo ghUrls={extractedGitHubUrls} /> : null}
{!!extractedGitHubUrls.length && <GitHubInfo ghUrls={extractedGitHubUrls} />}
</ListSubheader>
)}
<div className={classes.content}>
Expand Down

0 comments on commit 1b32de0

Please sign in to comment.