aboutsummaryrefslogtreecommitdiff
path: root/viewer/src/components/LdThumbnail.vue
diff options
context:
space:
mode:
Diffstat (limited to 'viewer/src/components/LdThumbnail.vue')
-rw-r--r--viewer/src/components/LdThumbnail.vue91
1 files changed, 0 insertions, 91 deletions
diff --git a/viewer/src/components/LdThumbnail.vue b/viewer/src/components/LdThumbnail.vue
deleted file mode 100644
index 4623b44..0000000
--- a/viewer/src/components/LdThumbnail.vue
+++ /dev/null
@@ -1,91 +0,0 @@
1<!-- ldgallery - A static generator which turns a collection of tagged
2-- pictures into a searchable web gallery.
3--
4-- Copyright (C) 2019-2020 Guillaume FOUET
5--
6-- This program is free software: you can redistribute it and/or modify
7-- it under the terms of the GNU Affero General Public License as
8-- published by the Free Software Foundation, either version 3 of the
9-- License, or (at your option) any later version.
10--
11-- This program is distributed in the hope that it will be useful,
12-- but WITHOUT ANY WARRANTY; without even the implied warranty of
13-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-- GNU Affero General Public License for more details.
15--
16-- You should have received a copy of the GNU Affero General Public License
17-- along with this program. If not, see <https://www.gnu.org/licenses/>.
18-->
19
20<template>
21 <div :class="{ [$style.preload]: loading }">
22 <v-lazy-image
23 v-if="item.thumbnail"
24 :src="pictureSrc(item.thumbnail.resource)"
25 :style="pictureStyle"
26 :title="item.title"
27 @intersect="loading = true"
28 @load="loading = false"
29 />
30 <div v-else class="flex-column flex-center" :class="$style.thumbnailOther">
31 <div>
32 <fa-icon :icon="icon" size="4x" />
33 </div>
34 {{ item.title }}
35 </div>
36 </div>
37</template>
38
39<script lang="ts">
40import { Item } from "@/@types/gallery";
41import Navigation from "@/services/navigation";
42import { Component, Prop, Vue } from "vue-property-decorator";
43
44@Component
45export default class LdThumbnail extends Vue {
46 @Prop({ required: true }) readonly item!: Item;
47
48 loading: boolean = false;
49
50 pictureSrc(resource: string) {
51 return this.$galleryStore.resourceRoot + resource;
52 }
53
54 get pictureStyle() {
55 const resolution = this.item.thumbnail!.resolution;
56 return { width: `${resolution.width}px`, height: `${resolution.height}px` };
57 }
58
59 get icon() {
60 return Navigation.getIcon(this.item);
61 }
62}
63</script>
64
65<style lang="scss" module>
66@import "~@/assets/scss/theme.scss";
67
68.thumbnailOther {
69 width: $thumbnail-other-size;
70 height: $thumbnail-other-size;
71 padding-top: $body-line-height * 1em;
72 text-align: center;
73 word-break: break-word;
74 overflow: hidden;
75 > div {
76 min-height: $body-line-height * 3em;
77 }
78}
79
80.preload {
81 animation: preloadAnimation 1s infinite ease-in-out alternate;
82}
83@keyframes preloadAnimation {
84 from {
85 background-color: $content-bgcolor;
86 }
87 to {
88 background-color: $loader-color;
89 }
90}
91</style>