Skip to content

Commit

Permalink
Use Git (not Github) icon if package repository isn't on Github (#830)
Browse files Browse the repository at this point in the history
* Use Git (not Github) icon if package repository isn't on Github

* check for github.com

package could potentially be about github but not hosted on github (i.e. mygitforge.com/name/github-explorer)
  • Loading branch information
ThatOneCalculator authored Dec 1, 2023
1 parent 866cac3 commit 7647b62
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
11 changes: 11 additions & 0 deletions client/assets/git-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion client/components/SimilarPackageCard/SimilarPackageCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { sanitizeHTML } from '../../../utils/common.utils'
import TreeShakeIcon from '../../assets/tree-shake.svg'
import PlusIcon from '../../assets/plus.svg'
import GithubIcon from '../../assets/github-logo.svg'
import GitIcon from '../../assets/git-logo.svg'

type SimilarPackageCardProps = { category?: string } & (
| { pack: any; comparisonSizePercent: number }
Expand Down Expand Up @@ -124,7 +125,11 @@ export default class SimilarPackageCard extends Component<SimilarPackageCardProp
window.location = pack.repository
}}
>
<GithubIcon className="similar-package-card__github-icon" />
{pack.repository.includes('github.com') ? (
<GithubIcon className="similar-package-card__github-icon" />
) : (
<GitIcon className="similar-package-card__github-icon" />
)}
</a>
)}
</div>
Expand Down

0 comments on commit 7647b62

Please sign in to comment.