aboutsummaryrefslogtreecommitdiff
path: root/src/routes/language.svelte
diff options
context:
space:
mode:
authorFuwn <[email protected]>2022-03-08 05:56:17 +0000
committerFuwn <[email protected]>2022-03-08 05:56:17 +0000
commit1073d1ac02a36477cd3bd26798e35c26d5b5b01f (patch)
tree194ecdc7f671521536a021ae63f0d717159e2d53 /src/routes/language.svelte
downloadfrontend-next-1073d1ac02a36477cd3bd26798e35c26d5b5b01f.tar.xz
frontend-next-1073d1ac02a36477cd3bd26798e35c26d5b5b01f.zip
feat(frontend-next): 0.1.0 :star:
Diffstat (limited to 'src/routes/language.svelte')
-rw-r--r--src/routes/language.svelte58
1 files changed, 58 insertions, 0 deletions
diff --git a/src/routes/language.svelte b/src/routes/language.svelte
new file mode 100644
index 0000000..dacbf72
--- /dev/null
+++ b/src/routes/language.svelte
@@ -0,0 +1,58 @@
+<!-- This file is part of api-worker <https://github.com/senpy-club/api-worker>.
+Copyright (C) 2022-2022 Fuwn <[email protected]>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, version 3.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Copyright (C) 2022-2022 Fuwn <[email protected]>
+SPDX-License-Identifier: GPL-3.0-only -->
+<script>
+ import { onMount } from "svelte";
+ import { fetchImages } from "$lib/api";
+ import { page } from "$app/stores";
+
+ let language = $page.url.searchParams.get("language");
+ let images;
+ let complete = false;
+
+ onMount(async () => {
+ images = await fetchImages(language);
+ complete = true;
+ });
+</script>
+
+<svelte:head>
+ <title>{language} | senpy-club</title>
+</svelte:head>
+
+<div class="content">
+ <h1>{language}</h1>
+
+ {#if !complete}
+ <p>Fetching images...</p>
+ {:else if images.length === 0}
+ <p>Sorry, no images were found for this language.</p>
+ {:else}
+ <ul class="image-rack">
+ {#each images as image}
+ <li id="image-rack-item">
+ <a href={image}>
+ <img
+ src={image}
+ alt="Image of an anime girl holding a programming book"
+ />
+ </a>
+ </li>
+ {/each}
+ </ul>
+ {/if}
+</div>