From d9bf3af9c024b6cd82578197c6b43a7c80f54d3b Mon Sep 17 00:00:00 2001 From: Daniel Bulant Date: Sat, 10 Dec 2022 00:02:23 +0100 Subject: [PATCH] improved styles for manga page --- src/lib/components/artList.svelte | 8 +- src/lib/components/tabs/tabs.svelte | 22 +- src/routes/[manga]/+page.svelte | 190 ++++++++++-------- .../[manga]/expandableDescription.svelte | 66 ++++++ src/routes/[manga]/header.svelte | 4 + src/routes/[manga]/navbar.svelte | 56 ++++++ 6 files changed, 250 insertions(+), 96 deletions(-) create mode 100644 src/routes/[manga]/expandableDescription.svelte create mode 100644 src/routes/[manga]/header.svelte create mode 100644 src/routes/[manga]/navbar.svelte diff --git a/src/lib/components/artList.svelte b/src/lib/components/artList.svelte index 6030214..760adca 100644 --- a/src/lib/components/artList.svelte +++ b/src/lib/components/artList.svelte @@ -21,15 +21,21 @@ \ No newline at end of file diff --git a/src/lib/components/tabs/tabs.svelte b/src/lib/components/tabs/tabs.svelte index d6d9a29..2b2c80e 100644 --- a/src/lib/components/tabs/tabs.svelte +++ b/src/lib/components/tabs/tabs.svelte @@ -3,7 +3,7 @@ export var selected = list[0]; -
+
{#each list as item} {/each} @@ -16,16 +16,24 @@ button { border-radius: 0; flex-grow: 1; + padding: 0.5rem; + border: none; + background: none; + color: white; + font-size: 1.2rem; + cursor: pointer; + + transition: background-color 0.2s, text-shadow 0.2s; } button:first-child { - border-top-left-radius: 5px; - border-bottom-left-radius: 5px; + border-radius: 0.5rem 0 0 0.5rem; } button:last-child { - border-top-right-radius: 5px; - border-bottom-right-radius: 5px; + border-radius: 0 0.5rem 0.5rem 0; } - button.active { - background: rgb(202, 202, 202); + button:hover, button:active, button:focus, button.active { + background: rgba(255,255,255,0.1); + outline: none; + text-shadow: 0 0 0.1rem white; } \ No newline at end of file diff --git a/src/routes/[manga]/+page.svelte b/src/routes/[manga]/+page.svelte index adfc52d..19a9a64 100644 --- a/src/routes/[manga]/+page.svelte +++ b/src/routes/[manga]/+page.svelte @@ -13,6 +13,8 @@ import SvelteMarkdown from 'svelte-markdown'; import ArtDialog from "$lib/components/artDialog.svelte"; import streamSaver from "streamsaver"; + import Navbar from "./navbar.svelte"; + import ExpandableDescription from "./expandableDescription.svelte"; export var data; @@ -287,73 +289,81 @@ var width; - var smallScreenMode = width < 660; - $: smallScreenMode = width < 660; + var smallScreenMode = width < 700; + $: smallScreenMode = width < 700; + + var scrollY, innerHeight; - + - Chapters of {title} - + {title} - Chapter list + -{#if anilistData} {#await anilistData then data} - {#if data.bannerImage} - selectedImage = data.bannerImage} alt=""> - {/if} -{/await} {/if} + +{#if anilistData} {#await anilistData then data} + {#if data.bannerImage} + + {/if} +{/await} {/if} +
-

{title}

- -

- {#if manga.altTitles.find(t => t.en)} - {manga.altTitles.find(t => t.en)?.en} · - {/if} - {#if manga.year} - {manga.year} · - {/if} - {#if anilistData} {#await anilistData then data} {data.status} · {/await} {/if} - {manga.contentRating} - {#if smallScreenMode} -
- {#if relationships.find(t => t.type === "author")} - Author: {relationships.find(t => t.type === "author").attributes.name} - {#if relationships.find(t => t.type === "artist")} · {/if} - {/if} - {#if relationships.find(t => t.type === "artist")} - Artist: {relationships.find(t => t.type === "artist").attributes.name} - {/if} - {/if} -

- -
{#if relationships.find(t => t.type === "cover_art")} selectedImage = `https://uploads.mangadex.org/covers/${mangaId}/${relationships.find(t => t.type === "cover_art").attributes.fileName}.512.jpg`}> {/if} -
+
+

{title}

+ +

+ {#if manga.altTitles.find(t => t.en)} + {manga.altTitles.find(t => t.en)?.en} · + {/if} + {#if manga.year} + {manga.year} · + {/if} + {#if anilistData} {#await anilistData then data} {data.status} · {/await} {/if} + {manga.contentRating} +

{#if relationships.find(t => t.type === "author")} - Author: {relationships.find(t => t.type === "author").attributes.name} + Author: {relationships.find(t => t.type === "author").attributes.name} {/if} {#if relationships.find(t => t.type === "artist")} - Artist: {relationships.find(t => t.type === "artist").attributes.name} + Artist: {relationships.find(t => t.type === "artist").attributes.name} {/if} {#if relationships.find(t => t.related === "colored" && t.type === "manga")} Colored version {/if} - {#if manga.description.en} -

+ {#if !smallScreenMode && manga.description.en} +

{/if}
+ {#if smallScreenMode && manga.description.en} +
+ +
+ {/if} + + {#if manga.tags} +
+ {#each manga.tags as tag} + {tag.attributes.name.en || tag.attributes.name.jp || Object.values(tag.attributes.name)[0]} + {/each} +
+ {/if} +
@@ -446,19 +456,6 @@ AL score: {data.averageScore}
Also known as: {data.synonyms.join(", ")} {Object.values(manga.title).filter(t => t !== title).join(", ")} - {#if smallScreenMode} - {#if relationships.find(t => t.type === "author")} - Author: {relationships.find(t => t.type === "author").attributes.name} - {/if} - {#if relationships.find(t => t.type === "artist")} - Artist: {relationships.find(t => t.type === "artist").attributes.name} - {/if} - - {#if manga.description.en} -

- {/if} - {/if} -

{/await} {/if} @@ -510,28 +507,30 @@ {/if}
{/if} - {#if manga.tags} -
-

Tags

- {#each manga.tags as tag} - {tag.attributes.name.en || tag.attributes.name.jp || Object.values(tag.attributes.name)[0]} - {/each} -
- {/if}
- \ No newline at end of file diff --git a/src/routes/[manga]/header.svelte b/src/routes/[manga]/header.svelte new file mode 100644 index 0000000..67ae89f --- /dev/null +++ b/src/routes/[manga]/header.svelte @@ -0,0 +1,4 @@ + + diff --git a/src/routes/[manga]/navbar.svelte b/src/routes/[manga]/navbar.svelte new file mode 100644 index 0000000..8afbcb2 --- /dev/null +++ b/src/routes/[manga]/navbar.svelte @@ -0,0 +1,56 @@ + + + + + \ No newline at end of file