-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat(ui): latestCodeList now remembers scroll position before swap
- Loading branch information
1 parent
d308e27
commit 57667d1
Showing
8 changed files
with
84 additions
and
91 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
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
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 |
---|---|---|
@@ -1,32 +1,32 @@ | ||
<script lang="ts"> | ||
import { onMount } from "svelte"; | ||
import { onMount } from "svelte"; | ||
export let slug: string = ""; | ||
export let slug = ""; | ||
let loading: boolean = false; | ||
let views: number = 0; | ||
let loading = false; | ||
let views: number | null = null; | ||
onMount(async () => { | ||
if (slug && slug.trim() !== "") { | ||
try { | ||
loading = true; | ||
const resp = await fetch(`/api/blog/views/${slug}.json?increment=true`); | ||
const stats = await resp.json(); | ||
views = stats.views; | ||
} catch (e) { | ||
console.error("PostStats", e); | ||
} finally { | ||
loading = false; | ||
} | ||
onMount(async () => { | ||
if (slug && slug.trim() !== "") { | ||
try { | ||
loading = true; | ||
const resp = await fetch(`/api/blog/views/${slug}.json?increment=true`); | ||
const stats = await resp.json(); | ||
views = stats.views; | ||
} catch (e) { | ||
console.error("PostStats", e); | ||
} finally { | ||
loading = false; | ||
} | ||
}); | ||
} | ||
}); | ||
</script> | ||
|
||
<span class="emdash">—</span> | ||
<span class="post-stats__views">{views} views</span> | ||
<span class="post-stats__views">{views || "~"} views</span> | ||
|
||
<style> | ||
.post-stats__views { | ||
@apply mx-1 pr-1 italic text-accent-gray-mid; | ||
} | ||
.post-stats__views { | ||
@apply mx-1 pr-1 italic text-accent-gray-mid; | ||
} | ||
</style> |
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
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