summaryrefslogtreecommitdiff
path: root/src/components/jet/shelf/MediumStoryCardShelf.svelte
blob: 35c3ec32d9395c6fb1691b4fc3328007604ce009 (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 } from '@jet-app/app-store/api/models';

    import MediumStoryCardItem, {
        type Item as MediumStoryCardItemModel,
    } from '~/components/jet/item/MediumStoryCardItem.svelte';

    interface MediumStoryCardShelf extends Shelf {
        items: MediumStoryCardItemModel[];
    }

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

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

    export let shelf: MediumStoryCardShelf;
</script>

<ShelfWrapper {shelf}>
    <ShelfItemLayout {shelf} gridType="B" let:item>
        <MediumStoryCardItem {item} />
    </ShelfItemLayout>
</ShelfWrapper>