summaryrefslogtreecommitdiff
path: root/src/components/jet/shelf/MediumLockupShelf.svelte
blob: 186acb23ebe3a60f9a87b249b9b780646957828b (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 { Lockup, Shelf } from '@jet-app/app-store/api/models';

    interface MediumLockupShelf extends Shelf {
        items: Lockup[];
    }

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

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

    export let shelf: MediumLockupShelf;

    $: isArticleContext = shelf.presentationHints?.isArticleContext;
    $: gridType = isArticleContext ? 'Spotlight' : 'MediumLockup';
</script>

<ShelfWrapper {shelf}>
    <ShelfItemLayout {shelf} {gridType} rowsPerColumnOverride={2} let:item>
        <MediumLockupItem {item} />
    </ShelfItemLayout>
</ShelfWrapper>