UI Fixes part III.

This commit is contained in:
Čarodej
2022-03-14 10:10:23 +01:00
parent 3c35ea9a4e
commit fe3fbe7db7
34 changed files with 137 additions and 121 deletions

View File

@@ -1,18 +1,37 @@
<template>
<img id="printable-file" class="file" :class="{ 'file-shadow': !$isMobile() }" :src="imageSource" />
<img id="printable-file" class="file" :class="{'file-shadow': !$isMobile()}" :src="src" @error="replaceByOriginal" />
</template>
<script>
export default {
name: 'ImageFile',
props: ['file'],
computed: {
imageSource() {
let windowWidth = window.innerWidth
watch: {
'file': function () {
this.getSrc()
}
},
data() {
return {
src: undefined,
}
},
methods: {
replaceByOriginal() {
this.src = this.file.data.attributes.file_url
},
getSrc() {
let windowWidth = window.innerWidth
if (windowWidth > 1280) return this.file.data.attributes.thumbnail.xl
else return this.file.data.attributes.thumbnail.lg
},
},
if (windowWidth > 1280) {
this.src = this.file.data.attributes.thumbnail.xl
} else {
this.src = this.file.data.attributes.thumbnail.lg
}
}
},
created() {
this.getSrc()
}
}
</script>