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

    interface ProductCapabilityShelf extends Shelf {
        items: ProductCapability[];
    }

    export function isProductCapabilityShelf(
        shelf: Shelf,
    ): shelf is ProductCapabilityShelf {
        const { contentType, items } = shelf;
        return contentType === 'productCapability' && Array.isArray(items);
    }
</script>

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

    export let shelf: ProductCapabilityShelf;
</script>

<ShelfWrapper {shelf}>
    <ShelfItemLayout {shelf} gridType="SearchLink" let:item>
        <ProductCapabilityItem {item} />
    </ShelfItemLayout>
</ShelfWrapper>