Skip to content

Commit

Permalink
Make repository the main URL
Browse files Browse the repository at this point in the history
  • Loading branch information
MacFJA committed Aug 16, 2023
1 parent 2d251ee commit 1d295e3
Show file tree
Hide file tree
Showing 5 changed files with 329 additions and 328 deletions.
7 changes: 4 additions & 3 deletions src/lib/components/ComponentIndex/Card.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@

<div class="card" class:active id="component-{title}">
<h3>
<a href="#component-{title}">#</a> <a href={url}>{title}</a>
<a href="#component-{title}">#</a>
{#if url || repository}<a href={url || repository}>{title}</a>{:else}<span>{title}</span>{/if}
{#if npm}<Tag
click={() => copy()}
variant="copy"
Expand All @@ -51,11 +52,11 @@
{/if}
<div class="card__bottom">
<div>
{#if (repository || url).includes('github')}
{#if (repository || url || '').includes('github')}
<a title="Go to the source code" href={repository || url}
><img style="display:inline" src="/images/github_logo.svg" alt="github logo" /></a
>
{:else if (repository || url).includes('gitlab')}
{:else if (repository || url || '').includes('gitlab')}
<a title="Go to the source code" href={repository || url}
><img style="display:inline" src="/images/gitlab_logo.svg" alt="gitlab logo" /></a
>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/utils/stars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ function getType(repositoryUrl: string): RepoInfo | null {
return null;
}

export function injectStars<T extends { repository?: string; url: string; stars?: number }>(
export function injectStars<T extends { repository?: string; url?: string; stars?: number }>(
data: Array<T>
): Array<T> {
data.forEach((item) => (item.stars = getStarsCount(item.repository ?? item.url)));
data.forEach((item) => (item.stars = getStarsCount(item.repository ?? item.url ?? '')));
return data;
}
Loading

0 comments on commit 1d295e3

Please sign in to comment.