summaryrefslogtreecommitdiff
path: root/src/components/jet/shelf/MarkerShelf.svelte
blob: c7192358d834e73ec82c6c795d47bc404804e43a (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
36
<script lang="ts" context="module">
    import type { ShelfBasedProductPage } from '@jet-app/app-store/api/models';
    import type {
        Lockup,
        Shelf,
        ShelfMarker,
    } from '@jet-app/app-store/api/models';

    export interface MarkerShelf extends Shelf {
        contentType: 'marker';
        marker: ShelfMarker;
        items: Lockup[];
    }

    export function isMarkerShelf(shelf: Shelf): shelf is MarkerShelf {
        const { contentType, marker, items } = shelf;

        return (
            contentType === 'marker' &&
            typeof marker === 'string' &&
            Array.isArray(items)
        );
    }
</script>

<script lang="ts">
    import ProductTopLockup from '~/components/jet/marker-shelf/ProductTopLockup.svelte';

    export let shelf: MarkerShelf;

    export let page: ShelfBasedProductPage;
</script>

{#if shelf.marker === 'productTopLockup'}
    <ProductTopLockup {page} />
{/if}