summaryrefslogtreecommitdiff
path: root/src/components/jet/item/LargeLockupItem.svelte
blob: 93adc6e31c9c174974d1465ee513157acccdc1fb (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<script lang="ts">
    import {
        isFlowAction,
        type FlowAction,
        type Lockup,
    } from '@jet-app/app-store/api/models';
    import type { Opt } from '@jet/environment';

    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';

    export let item: Lockup;
    const i18n = getI18n();
    const { clickAction } = item;
    const destination: Opt<FlowAction> = isFlowAction(clickAction)
        ? clickAction
        : undefined;

    $: secondaryLine = item.editorialTagline || item.subtitle;
</script>

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

        <div class="metadata-container">
            {#if item.heading}
                <LineClamp clamp={2}>
                    <h4>{item.heading}</h4>
                </LineClamp>
            {/if}

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

            {#if !item.heading && secondaryLine}
                <LineClamp clamp={1}>
                    <p>{secondaryLine}</p>
                </LineClamp>
            {/if}

            {#if item.tertiaryTitle}
                <LineClamp clamp={1}>
                    <p class="tertiary-text">{item.tertiaryTitle}</p>
                </LineClamp>
            {/if}
        </div>

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

<style>
    article {
        display: flex;
        flex-direction: column;
        min-height: 290px;
        padding: 20px;
        border-radius: var(--global-border-radius-large);
        background: var(--systemPrimary-onDark);
        box-shadow: var(--shadow-small);
    }

    @media (prefers-color-scheme: dark) {
        article {
            background: var(--systemQuaternary);
        }
    }

    .app-icon-container {
        --artwork-override-height: 100px;
        --artwork-override-width: auto;
        display: flex;
        margin-bottom: 10px;
    }

    .metadata-container {
        flex-grow: 1;
    }

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

    h4 {
        margin-bottom: 3px;
        color: var(--systemSecondary);
        font: var(--subhead-emphasized);
        text-transform: uppercase;
    }

    p {
        margin: 3px 0;
        font: var(--body);
        color: var(--systemSecondary);
        text-wrap: pretty;
    }

    .tertiary-text {
        font: var(--callout);
        color: var(--systemTertiary);
    }
</style>