/ src / components / jet / shelf / EditorialCardShelf.svelte
EditorialCardShelf.svelte
 1  <script lang="ts" context="module">
 2      import type { Shelf, EditorialCard } from '@jet-app/app-store/api/models';
 3  
 4      interface EditorialCardShelf extends Shelf {
 5          items: EditorialCard[];
 6      }
 7  
 8      export function isEditorialCardShelf(
 9          shelf: Shelf,
10      ): shelf is EditorialCardShelf {
11          const { contentType, items } = shelf;
12  
13          return contentType === 'editorialCard' && Array.isArray(items);
14      }
15  </script>
16  
17  <script lang="ts">
18      import HeroCarousel from '~/components/hero/Carousel.svelte';
19      import EditorialCardItem from '~/components/jet/item/EditorialCardItem.svelte';
20  
21      export let shelf: EditorialCardShelf;
22  
23      $: items = shelf.items;
24  
25      function deriveBackgroundArtworkFromItem(item: EditorialCard) {
26          return item.artwork;
27      }
28  </script>
29  
30  <HeroCarousel {shelf} {items} {deriveBackgroundArtworkFromItem} let:item>
31      <EditorialCardItem {item} />
32  </HeroCarousel>