Skip to content

Commit

Permalink
feat(comments): Add number of comments to search result (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
tianlangwu committed Oct 17, 2020
1 parent 02930f3 commit 33ccada
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/search/SearchResult.jsx
Expand Up @@ -11,6 +11,7 @@ export const SearchResult = ({
userName,
repoName,
issueAge,
comments,
labels,
}) => {
const [hasBeenClicked, setClicked] = useState(false);
Expand Down Expand Up @@ -40,6 +41,7 @@ export const SearchResult = ({
<div className="metadata">
<div>{`${userName}/${repoName}`}</div>
<div className="issue-age">{issueAge}</div>
<div className="comments">{`Comments ${comments}`}</div>
</div>

<div className="label-chips">{labelChips}</div>
Expand Down
7 changes: 7 additions & 0 deletions src/components/search/SearchResult.scss
Expand Up @@ -51,5 +51,12 @@
.label-chips {
margin: 5px 0 5px;
}

.comments{
font-size: 0.7rem;
margin-top: -8px;
display: inline;
float: right;
}
}
}
2 changes: 2 additions & 0 deletions src/components/search/SearchResultsContainer.jsx
Expand Up @@ -22,6 +22,7 @@ const SearchResultsContainer = ({ currentPage, onPageChange, results }) => {
results.items[0] &&
results.items.map(item => {
const htmlUrl = item.html_url.split('/');
const comments = item.comments;
const userName = htmlUrl[3];
const repoName = htmlUrl[4];
const issueAge = moment(item.created_at).fromNow();
Expand All @@ -46,6 +47,7 @@ const SearchResultsContainer = ({ currentPage, onPageChange, results }) => {
bodyText={bodyText}
userName={userName}
repoName={repoName}
comments={comments}
issueAge={issueAge}
labels={item.labels}
/>
Expand Down

0 comments on commit 33ccada

Please sign in to comment.