diff --git a/src/components/ComicCard.astro b/src/components/ComicCard.astro index 03ba864..28a0ff0 100644 --- a/src/components/ComicCard.astro +++ b/src/components/ComicCard.astro @@ -1,4 +1,5 @@ --- +// Import the necessary types and assets import type { Comic } from '../lib/types'; import { Image } from 'astro:assets'; @@ -7,14 +8,29 @@ interface Props { } const { comic } = Astro.props; -const coverUrl = comic.md_comics.md_covers[0] + +// Determine if the file is AVIF based on the URL +const isAvif = comic.md_comics.md_covers[0]?.b2key.endsWith('.avif'); + +const coverUrl = comic.md_comics.md_covers[0] ? `https://meo.comick.pictures/${comic.md_comics.md_covers[0].b2key}` : '/placeholder.png'; --- -
- {comic.md_comics.title} + {!isAvif ? ( + // Infer size only for non-AVIF files + {comic.md_comics.title} + ) : ( + // Provide fallback handling for AVIF files + {comic.md_comics.title} + )}

{comic.md_comics.title}

Chapter {comic.chap}

@@ -66,4 +82,4 @@ const coverUrl = comic.md_comics.md_covers[0] margin-top: 0.5rem; font-size: 0.8rem !important; } - \ No newline at end of file +