(repoLink: HTMLElement, stargazerCount: number, viewerHasStarred: boolean)
| 64 | } |
| 65 | |
| 66 | function addStars(repoLink: HTMLElement, stargazerCount: number, viewerHasStarred: boolean): void { |
| 67 | if (stargazerCount <= 1) { |
| 68 | return; |
| 69 | } |
| 70 | |
| 71 | let tooltip = `Repository starred by ${stargazerCount.toLocaleString('us')} people`; |
| 72 | if (viewerHasStarred) { |
| 73 | tooltip += ', including you'; |
| 74 | } |
| 75 | |
| 76 | prepareForAddition(repoLink); |
| 77 | |
| 78 | repoLink.after( |
| 79 | <a |
| 80 | href={buildRepoUrl('stargazers')} |
| 81 | title={tooltip} |
| 82 | // Hide in small viewports |
| 83 | className="d-none d-sm-flex flex-items-center flex-justify-center gap-1 p-1 tmp-p-1 color-fg-muted Button Button--invisible" |
| 84 | > |
| 85 | {viewerHasStarred |
| 86 | // Use `color` because `fill` is overridden with `currentColor` |
| 87 | ? <StarFillIcon width={12} height={12} color="var(--button-star-iconColor)" /> |
| 88 | : <StarIcon width={12} height={12} />} |
| 89 | <span className="f5">{abbreviateNumber(stargazerCount)}</span> |
| 90 | </a>, |
| 91 | ); |
| 92 | } |
| 93 | |
| 94 | function markForked(repoLink: HTMLElement, forked?: {url: string}): void { |
| 95 | if (!forked) { |
no test coverage detected