diff options
author | Notkea | 2020-01-31 18:09:33 +0100 |
---|---|---|
committer | GitHub | 2020-01-31 18:09:33 +0100 |
commit | 245fee3fe5abdc6ad14513ef6522446aba4c905a (patch) | |
tree | 749ec466c404499f19d571834262b87c14f0d0af /viewer/src/components/LdThumbnail.vue | |
parent | d94b987463169b254ab69a79ddb58e5beccb0941 (diff) | |
parent | be8ec3edaed843f08dac3d2bf2f10f7247ef3d3a (diff) | |
download | ldgallery-245fee3fe5abdc6ad14513ef6522446aba4c905a.tar.gz |
Merge pull request #68 from pacien/oz-viewer
Diffstat (limited to 'viewer/src/components/LdThumbnail.vue')
-rw-r--r-- | viewer/src/components/LdThumbnail.vue | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/viewer/src/components/LdThumbnail.vue b/viewer/src/components/LdThumbnail.vue new file mode 100644 index 0000000..44a4c00 --- /dev/null +++ b/viewer/src/components/LdThumbnail.vue | |||
@@ -0,0 +1,81 @@ | |||
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="forcedsize" :class="{'preload': loading}"> | ||
22 | <v-lazy-image | ||
23 | v-if="item.thumbnail" | ||
24 | class="thumbnail" | ||
25 | :src="pictureSrc()" | ||
26 | :title="item.path" | ||
27 | @intersect="loading=true" | ||
28 | @load="loading=false" | ||
29 | /> | ||
30 | <div v-else class="flex-column flex-center"> | ||
31 | <fa-icon :icon="getIcon()" size="4x" /> | ||
32 | {{item.title}} | ||
33 | </div> | ||
34 | </div> | ||
35 | </template> | ||
36 | |||
37 | <script lang="ts"> | ||
38 | import { Component, Vue, Prop } from "vue-property-decorator"; | ||
39 | import Tools from "@/tools"; | ||
40 | |||
41 | @Component | ||
42 | export default class LdThumbnail extends Vue { | ||
43 | @Prop({ required: true }) readonly item!: Gallery.Item; | ||
44 | |||
45 | loading: boolean = false; | ||
46 | |||
47 | pictureSrc() { | ||
48 | return `${process.env.VUE_APP_DATA_URL}${this.item.thumbnail}`; | ||
49 | } | ||
50 | |||
51 | getIcon() { | ||
52 | return Tools.getIcon(this.item); | ||
53 | } | ||
54 | } | ||
55 | </script> | ||
56 | |||
57 | <style lang="scss"> | ||
58 | @import "@/assets/scss/theme.scss"; | ||
59 | |||
60 | .thumbnail { | ||
61 | max-width: 250px; | ||
62 | max-height: 250px; | ||
63 | } | ||
64 | .preload { | ||
65 | animation: preloadAnimation 1s infinite ease-in-out alternate; | ||
66 | } | ||
67 | @keyframes preloadAnimation { | ||
68 | from { | ||
69 | background-color: $content-bgcolor; | ||
70 | } | ||
71 | to { | ||
72 | background-color: $loader-color; | ||
73 | } | ||
74 | } | ||
75 | // Temporary size until we get the true thumbnail size | ||
76 | .forcedsize { | ||
77 | width: 250px; | ||
78 | height: 250px; | ||
79 | text-align: center; | ||
80 | } | ||
81 | </style> | ||