-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
113 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
export const config = { | ||
isr: { | ||
expiration: 60 * 60 * 4, | ||
}, | ||
}; | ||
|
||
export async function load({ fetch }) { | ||
const headers = new Headers({ | ||
Accept: "application/vnd.github+json", | ||
"X-GitHub-Api-Version": "2022-11-28", | ||
}); | ||
const options = { | ||
headers: headers, | ||
}; | ||
const endpoint = "https://api.github.com/repos/tconbeer/harlequin"; | ||
const request = new Request(endpoint, options); | ||
const response = await fetch(request); | ||
const body = await response.json(); | ||
const data = (({ forks_count, stargazers_count }) => ({ | ||
forks_count, | ||
stargazers_count, | ||
}))(body); | ||
return data; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<script lang="ts"> | ||
import octocat from "$lib/assets/icons/icons8-github-30.png"; | ||
import star from "$lib/assets/icons/icons8-star-16.png"; | ||
import fork from "$lib/assets/icons/icons8-code-fork-16.png"; | ||
export let data; | ||
</script> | ||
|
||
<div | ||
class="rounded-full py-1 transition-transform duration-200 hover:scale-105 hover:bg-green hover:shadow-lg active:translate-x-1 active:translate-y-1 sm:py-3 sm:pl-3 sm:pr-4" | ||
> | ||
<a | ||
href="https://github.com/tconbeer/harlequin" | ||
target="_blank" | ||
title="Go to repository" | ||
class="text-inherit no-underline" | ||
> | ||
<div class="flex"> | ||
<img src={octocat} alt="GitHub icon" class="my-auto h-[30px] w-[30px]" /> | ||
<div> | ||
<div class="text-sm">tconbeer/harlequin</div> | ||
<div class="flex text-xs"> | ||
<img | ||
src={star} | ||
alt="GitHub stars" | ||
class="h-[16px] w-[16px]" | ||
/>{data.stargazers_count.toLocaleString()} <img | ||
src={fork} | ||
alt="GitHub forks" | ||
class="h-[16px] w-[16px]" | ||
/>{data.forks_count.toLocaleString()} | ||
</div> | ||
</div> | ||
</div> | ||
</a> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters