From e2ea60e3d3b13e0660d9f76daf2e549563bc38d6 Mon Sep 17 00:00:00 2001 From: Wolfgang Müller Date: Thu, 20 Feb 2025 19:33:55 +0100 Subject: frontend: Introduce ComicCard and ArchiveCard Instead of repeatedly supplying Card content in all the places it is required, it makes more sense to create dedicated ComicCard and ArchiveCard components. These wrap around Card itself and can be used in a more straightforward and consistent fashion. Whilst we are here, simplify and streamline the display of Comic and Archive metadata by introducing a Card footer. The footer is used for information on page count, release date, and archive size. --- frontend/src/lib/components/ArchiveCard.svelte | 39 ++++++++++++++ frontend/src/lib/components/Card.svelte | 39 ++++++-------- frontend/src/lib/components/ComicCard.svelte | 75 ++++++++++++++++++++++++++ frontend/src/lib/pills/ComicPills.svelte | 37 ------------- frontend/src/lib/pills/FooterPill.svelte | 15 ++++++ frontend/src/lib/tabs/ArchiveDetails.svelte | 7 +-- frontend/src/lib/tabs/ArchiveEdit.svelte | 8 ++- 7 files changed, 150 insertions(+), 70 deletions(-) create mode 100644 frontend/src/lib/components/ArchiveCard.svelte create mode 100644 frontend/src/lib/components/ComicCard.svelte delete mode 100644 frontend/src/lib/pills/ComicPills.svelte create mode 100644 frontend/src/lib/pills/FooterPill.svelte (limited to 'frontend/src/lib') diff --git a/frontend/src/lib/components/ArchiveCard.svelte b/frontend/src/lib/components/ArchiveCard.svelte new file mode 100644 index 0000000..c9d283b --- /dev/null +++ b/frontend/src/lib/components/ArchiveCard.svelte @@ -0,0 +1,39 @@ + + + + {#snippet footer()} +
+ + {#snippet icon()} + + {/snippet} + +
+ + {#snippet icon()} + + {/snippet} + +
+ {/snippet} +
diff --git a/frontend/src/lib/components/Card.svelte b/frontend/src/lib/components/Card.svelte index b8e8ecf..8cfe34d 100644 --- a/frontend/src/lib/components/Card.svelte +++ b/frontend/src/lib/components/Card.svelte @@ -1,5 +1,8 @@ - - - @@ -66,8 +53,8 @@ /> {/if} {#if !coverOnly} -
-
+
+

{details.title}

@@ -86,9 +73,15 @@ {/if}
-
+
{@render children?.()}
+ + {#if footer} +
+ {@render footer()} +
+ {/if}
{/if} diff --git a/frontend/src/lib/components/ComicCard.svelte b/frontend/src/lib/components/ComicCard.svelte new file mode 100644 index 0000000..cb73e97 --- /dev/null +++ b/frontend/src/lib/components/ComicCard.svelte @@ -0,0 +1,75 @@ + + + +
+ {#if comic.artists.length || comic.circles.length} +
+ {#each comic.artists as { name } (name)} + + {/each} + {#each comic.circles as { name } (name)} + + {/each} +
+ {/if} + {#if comic.characters.length || comic.worlds.length} +
+ {#each comic.worlds as { name } (name)} + + {/each} + {#each comic.characters as { name } (name)} + + {/each} +
+ {/if} + {#if comic.tags.length} +
+ {#each comic.tags as { name, description } (name)} + + {/each} +
+ {/if} +
+ {#snippet footer()} +
+ + {#snippet icon()} + + {/snippet} + +
+ {#if comic.date} + + {#snippet icon()} + + {/snippet} + + {/if} +
+ {/snippet} +
diff --git a/frontend/src/lib/pills/ComicPills.svelte b/frontend/src/lib/pills/ComicPills.svelte deleted file mode 100644 index 45c42fd..0000000 --- a/frontend/src/lib/pills/ComicPills.svelte +++ /dev/null @@ -1,37 +0,0 @@ - - -
- {#if comic.artists.length || comic.circles.length} -
- {#each comic.artists as { name } (name)} - - {/each} - {#each comic.circles as { name } (name)} - - {/each} -
- {/if} - {#if comic.characters.length || comic.worlds.length} -
- {#each comic.worlds as { name } (name)} - - {/each} - {#each comic.characters as { name } (name)} - - {/each} -
- {/if} - {#if comic.tags.length} -
- {#each comic.tags as { name, description } (name)} - - {/each} -
- {/if} -
diff --git a/frontend/src/lib/pills/FooterPill.svelte b/frontend/src/lib/pills/FooterPill.svelte new file mode 100644 index 0000000..3da1811 --- /dev/null +++ b/frontend/src/lib/pills/FooterPill.svelte @@ -0,0 +1,15 @@ + + +
+ {@render icon?.()} + {text} +
diff --git a/frontend/src/lib/tabs/ArchiveDetails.svelte b/frontend/src/lib/tabs/ArchiveDetails.svelte index b3d570f..1243162 100644 --- a/frontend/src/lib/tabs/ArchiveDetails.svelte +++ b/frontend/src/lib/tabs/ArchiveDetails.svelte @@ -1,8 +1,7 @@