summaryrefslogtreecommitdiff
path: root/src/components/jet/shelf/EditorialCardShelf.svelte
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/jet/shelf/EditorialCardShelf.svelte')
-rw-r--r--src/components/jet/shelf/EditorialCardShelf.svelte32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/components/jet/shelf/EditorialCardShelf.svelte b/src/components/jet/shelf/EditorialCardShelf.svelte
new file mode 100644
index 0000000..efbd71d
--- /dev/null
+++ b/src/components/jet/shelf/EditorialCardShelf.svelte
@@ -0,0 +1,32 @@
+<script lang="ts" context="module">
+ import type { Shelf, EditorialCard } from '@jet-app/app-store/api/models';
+
+ interface EditorialCardShelf extends Shelf {
+ items: EditorialCard[];
+ }
+
+ export function isEditorialCardShelf(
+ shelf: Shelf,
+ ): shelf is EditorialCardShelf {
+ const { contentType, items } = shelf;
+
+ return contentType === 'editorialCard' && Array.isArray(items);
+ }
+</script>
+
+<script lang="ts">
+ import HeroCarousel from '~/components/hero/Carousel.svelte';
+ import EditorialCardItem from '~/components/jet/item/EditorialCardItem.svelte';
+
+ export let shelf: EditorialCardShelf;
+
+ $: items = shelf.items;
+
+ function deriveBackgroundArtworkFromItem(item: EditorialCard) {
+ return item.artwork;
+ }
+</script>
+
+<HeroCarousel {shelf} {items} {deriveBackgroundArtworkFromItem} let:item>
+ <EditorialCardItem {item} />
+</HeroCarousel>