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

    interface AccessibilityDeveloperLinkShelf extends Shelf {
        items: [AccessibilityParagraph];
    }

    export function isAccessibilityDeveloperLinkShelf(
        shelf: Shelf,
    ): shelf is AccessibilityDeveloperLinkShelf {
        let { contentType, items, title } = shelf;

        return (
            contentType === 'accessibilityParagraph' &&
            !title &&
            Array.isArray(items)
        );
    }
</script>

<script lang="ts">
    import ShelfWrapper from '~/components/Shelf/Wrapper.svelte';
    import AccessibilityParagraphItem from '../item/AccessibilityParagraphItem.svelte';
    import { getAccessibilityLayoutConfiguration } from '~/context/accessibility-layout';

    export let shelf: AccessibilityDeveloperLinkShelf;

    $: ({ withBottomPadding } = getAccessibilityLayoutConfiguration(shelf));
</script>

<ShelfWrapper {shelf} centered {withBottomPadding}>
    <AccessibilityParagraphItem item={shelf.items[0]} />
</ShelfWrapper>