aboutsummaryrefslogtreecommitdiff
path: root/resources/vue/components/stock-images/SelectableImageCard.vue
blob: e6d4c73a3d8d119a16ce3bda87b83010a6399340 (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
<template>
    <div class="stock-images-selectable-image" tabindex="0">
        <Thumbnail :url="thumbnailUrl" contain class="stock-images-image-card__thumbnail" width="8rem" />
        <div>{{ stockImage.attributes?.title ?? '' }}</div>
    </div>
</template>

<script>
import Thumbnail from './Thumbnail.vue';

export default {
    props: {
        stockImage: {
            type: Object,
            required: true,
        },
    },
    components: { Thumbnail },
    computed: {
        thumbnailUrl() {
            return (
                this.stockImage.attributes['download-urls'].small ??
                this.stockImage.attributes['download-urls'].original
            );
        },
    },
};
</script>

<style scoped>
.stock-images-selectable-image {
    overflow: hidden;
    position: relative;
}
.stock-images-selectable-image > :last-child {
    background: var(--white);
    overflow: hidden;
    text-overflow: ellipsis;
    width: 8rem;
    min-height: 3em;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
}
.stock-images-image-card__thumbnail {
    background-image: url(../images/checkered-background.png);
}
</style>