summaryrefslogtreecommitdiff
path: root/src/components/jet/shelf/BannerShelf.svelte
blob: 84289c949e0d2ec1b7b2e7cf9fca451d85675721 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<script lang="ts" context="module">
    import type { Shelf, Banner } from '@jet-app/app-store/api/models';

    interface BannerShelf extends Shelf {
        contentType: 'banner';
        items: Banner[];
    }

    export function isBannerShelf(shelf: Shelf): shelf is BannerShelf {
        return shelf.contentType === 'banner' && Array.isArray(shelf.items);
    }
</script>

<script lang="ts">
    import BannerItem from '~/components/jet/item/BannerItem.svelte';
    import ShelfWrapper from '~/components/Shelf/Wrapper.svelte';

    export let shelf: BannerShelf;
</script>

<ShelfWrapper {shelf}>
    <div class="banner-items-container">
        {#each shelf.items as item}
            <BannerItem {item} />
        {/each}
    </div>
</ShelfWrapper>

<style>
    .banner-items-container {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
</style>