Refactor catalog
This commit is contained in:
@@ -1,23 +1,22 @@
|
||||
<script lang="ts">
|
||||
import { currentManga } from '$lib/catalog';
|
||||
import type { Volume } from '$lib/types';
|
||||
export let manga: Volume[];
|
||||
const { volumeName, files, mokuroData } = manga[0];
|
||||
import { catalog } from '$lib/catalog';
|
||||
|
||||
function onClick() {
|
||||
currentManga.set(manga);
|
||||
}
|
||||
export let id: string;
|
||||
|
||||
$: manga = $catalog?.find((item) => item.id === id)?.manga[0];
|
||||
</script>
|
||||
|
||||
<a href={volumeName} on:click={onClick}>
|
||||
<div class="flex flex-col gap-[5px] text-center items-center">
|
||||
{mokuroData.title}
|
||||
{#if files}
|
||||
<img
|
||||
src={URL.createObjectURL(Object.values(files)[0])}
|
||||
alt="img"
|
||||
class="object-contain w-[250px] h-[350px] bg-black border-gray-900 border"
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
</a>
|
||||
{#if manga}
|
||||
<a href={id}>
|
||||
<div class="flex flex-col gap-[5px] text-center items-center">
|
||||
{manga.mokuroData.title}
|
||||
{#if manga.files}
|
||||
<img
|
||||
src={URL.createObjectURL(Object.values(manga.files)[0])}
|
||||
alt="img"
|
||||
class="object-contain w-[250px] h-[350px] bg-black border-gray-900 border"
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
</a>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user