summaryrefslogtreecommitdiff
path: root/src/components/jet/item/MediumLockupItem.svelte
blob: be70acbbc4754d4482a0bb50df903d24d24c5867 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<script lang="ts">
    import {
        type FlowAction,
        type Lockup,
        isFlowAction,
    } from '@jet-app/app-store/api/models';

    import LineClamp from '@amp/web-app-components/src/components/LineClamp/LineClamp.svelte';
    import AppIcon from '~/components/AppIcon.svelte';
    import LinkWrapper from '~/components/LinkWrapper.svelte';
    import { getI18n } from '~/stores/i18n';
    import type { Opt } from '@jet/environment';

    export let item: Lockup;

    const i18n = getI18n();

    const { clickAction } = item;
    const destination: Opt<FlowAction> = isFlowAction(clickAction)
        ? clickAction
        : undefined;
</script>

<LinkWrapper action={destination}>
    <article>
        <div class="app-icon-container">
            <AppIcon
                icon={item.icon}
                profile="app-icon-medium"
                fixedWidth={false}
            />
        </div>

        <div class="metadata-container">
            {#if item.heading}
                <span class="heading">{item.heading}</span>
            {/if}

            {#if item.title}
                <LineClamp clamp={1}>
                    <h3>{item.title}</h3>
                </LineClamp>
            {/if}

            {#if item.subtitle}
                <LineClamp clamp={1}>
                    <p>{item.subtitle}</p>
                </LineClamp>
            {/if}

            {#if destination}
                <div class="button-container">
                    <span class="get-button gray">
                        {$i18n.t('ASE.Web.AppStore.View')}
                    </span>
                </div>
            {/if}
        </div>
    </article>
</LinkWrapper>

<style>
    article {
        display: flex;
        align-items: center;
    }

    .app-icon-container {
        flex-shrink: 0;
        width: 85px;
        margin-inline-end: 16px;
    }

    .metadata-container {
        margin-inline-end: 16px;
    }

    h3 {
        font: var(--title-3);
        margin-bottom: 2px;
    }

    p {
        font: var(--callout);
        color: var(--systemSecondary);
    }

    .heading {
        font: var(--callout-emphasized);
    }

    .button-container {
        margin-inline-start: auto;
        margin-top: 8px;
    }
</style>