Skip to content

Commit

Permalink
chore: Hide star and fork stats in repo card if count of equals to ze…
Browse files Browse the repository at this point in the history
…ro (anuraghazra#97)

* add show_icons option to show/hide star and fork icon in repo cards

* resolve conflict

* resolve conflict

* hide star and fork stats in repo card if count of equals to zero

* HOTFIX

* HOTFIX
  • Loading branch information
omidnikrah authored Jul 18, 2020
1 parent f27daeb commit 06f0021
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/renderRepoCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,23 @@ const renderRepoCard = (repo, options = {}) => {
<text data-testid="lang" class="gray" x="15">${langName}</text>
</g>
<g transform="translate(${155 - shiftText}, 100)">
<svg class="icon" y="-12" viewBox="0 0 16 16" version="1.1" width="16" height="16">
${icons.star}
</svg>
<text data-testid="stargazers" class="gray" x="25">${totalStars}</text>
</g>
${(stargazers.totalCount > 0) ? `
<g transform="translate(${155 - shiftText}, 100)">
<svg class="icon" y="-12" viewBox="0 0 16 16" version="1.1" width="16" height="16">
${icons.star}
</svg>
<text data-testid="stargazers" class="gray" x="25">${totalStars}</text>
</g>
` : ''}
<g transform="translate(${220 - shiftText}, 100)">
<svg class="icon" y="-12" viewBox="0 0 16 16" version="1.1" width="16" height="16">
${icons.fork}
</svg>
<text data-testid="forkcount" class="gray" x="25">${totalForks}</text>
</g>
${(totalForks > 0) ? `
<g transform="translate(${stargazers.totalCount === 0 ? 155 - shiftText : 220 - shiftText}, 100)">
<svg class="icon" y="-12" viewBox="0 0 16 16" version="1.1" width="16" height="16">
${icons.fork}
</svg>
<text data-testid="forkcount" class="gray" x="25">${totalForks}</text>
</g>
` : ''}
</svg>
`;
};
Expand Down

0 comments on commit 06f0021

Please sign in to comment.