From bce557cc2dc767628bed6aac87301a1be7c5431b Mon Sep 17 00:00:00 2001
From: rxliuli <rxliuli@gmail.com>
Date: Tue, 4 Nov 2025 05:03:50 +0800
Subject: init commit

---
 src/components/jet/shelf/HeroCarouselShelf.svelte | 38 +++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 src/components/jet/shelf/HeroCarouselShelf.svelte

(limited to 'src/components/jet/shelf/HeroCarouselShelf.svelte')

diff --git a/src/components/jet/shelf/HeroCarouselShelf.svelte b/src/components/jet/shelf/HeroCarouselShelf.svelte
new file mode 100644
index 0000000..31a0287
--- /dev/null
+++ b/src/components/jet/shelf/HeroCarouselShelf.svelte
@@ -0,0 +1,38 @@
+<script lang="ts" context="module">
+    import type {
+        Shelf,
+        HeroCarousel as HeroCarouselModel,
+        HeroCarouselItem as HeroCarouselItemModel,
+    } from '@jet-app/app-store/api/models';
+
+    interface HeroCarouselShelf extends Shelf {
+        items: [HeroCarouselModel];
+    }
+
+    export function isHeroCarouselShelf(
+        shelf: Shelf,
+    ): shelf is HeroCarouselShelf {
+        const { contentType, items } = shelf;
+
+        return contentType === 'heroCarousel' && Array.isArray(items);
+    }
+</script>
+
+<script lang="ts">
+    import HeroCarousel from '~/components/hero/Carousel.svelte';
+    import HeroCarouselItem from '~/components/jet/item/HeroCarouselItem.svelte';
+    import { isRtl } from '~/utils/locale';
+
+    export let shelf: HeroCarouselShelf;
+
+    $: ({ items: ltrItems, rtlItems } = shelf.items[0]);
+    $: items = isRtl() && rtlItems.length ? rtlItems : ltrItems;
+
+    function deriveBackgroundArtworkFromItem(item: HeroCarouselItemModel) {
+        return item.artwork || item.video?.preview;
+    }
+</script>
+
+<HeroCarousel {shelf} {items} {deriveBackgroundArtworkFromItem} let:item>
+    <HeroCarouselItem {item} />
+</HeroCarousel>
-- 
cgit v1.2.3

