Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add repository node to json #438

Merged
merged 3 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/actions/update-stars/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ function gatherUrls() {
let templates = JSON.parse(readFileSync('src/routes/templates/templates.json'));

return [
...components.map((component) => component.url),
...tools.map((tool) => tool.url),
...templates.map((template) => template.url)
...components.map((component) => component.repository ?? component.url),
...tools.map((tool) => tool.repository ?? tool.url),
...templates.map((template) => template.repository ?? template.url)
MacFJA marked this conversation as resolved.
Show resolved Hide resolved
];
}

Expand Down
55 changes: 38 additions & 17 deletions src/lib/components/ComponentIndex/Card.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
export let stars;
export let url = '';
export let npm = '';
export let repo = '';
export let repository = undefined;

let clipboardCopy = false;

Expand All @@ -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 @@ -49,24 +50,28 @@
{/each}
</div>
{/if}
{#if typeof stars !== 'undefined'}
<div class="card__bottom">
<div>
{#if (repo || url).includes('github')}
<img style="display:inline" src="/images/github_logo.svg" alt="github logo" />
{:else if (repo || url).includes('gitlab')}
<img style="display:inline" src="/images/gitlab_logo.svg" alt="gitlab logo" />
<!-- {:else} -->
{/if}
</div>
<div>
<div class="card__bottom">
<div>
{#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')}
<a title="Go to the source code" href={repository || url}
><img style="display:inline" src="/images/gitlab_logo.svg" alt="gitlab logo" /></a
>
<!-- {:else} -->
{/if}
</div>
<div>
{#if typeof stars !== 'undefined'}
&#9733;
<code>{stars}</code>
</div>
<!-- commenting out dates just cause it is not very updated yet - all the cards show same date. put back in when we have better scraping -->
<!-- <datetime value={addedOn}>{new Intl.DateTimeFormat('en-Us').format(Date.parse(addedOn))}</datetime> -->
{/if}
</div>
{/if}
<!-- commenting out dates just cause it is not very updated yet - all the cards show same date. put back in when we have better scraping -->
<!-- <datetime value={addedOn}>{new Intl.DateTimeFormat('en-Us').format(Date.parse(addedOn))}</datetime> -->
</div>
</div>

<style>
Expand Down Expand Up @@ -95,10 +100,26 @@
.card__bottom {
display: flex;
justify-content: space-between;
align-items: end;
}
.card__bottom > * {
white-space: nowrap;
}
.card__bottom a {
border-bottom: none;
aspect-ratio: 1/1;
display: flex;
min-height: 26px;
padding: 4px;
border-radius: 50%;
margin: -4px;
box-sizing: border-box;
background-color: rgba(0, 0, 0, 0);
transition: background-color 200ms ease-out;
}
.card__bottom a:hover {
background-color: rgba(0, 0, 0, 0.25);
}

.flex-grow {
flex-grow: 1;
Expand Down
Loading