1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-09-06 20:29:08 +01:00
elk/components/status/StatusAttachment.vue
2022-11-21 21:21:53 +08:00

37 lines
838 B
Vue

<script setup lang="ts">
import type { Attachment } from 'masto'
const { attachment } = defineProps<{
attachment: Attachment
}>()
const aspectRatio = computed(() => {
if (attachment.meta?.original?.aspect)
return attachment.meta.original.aspect
if (attachment.meta?.small?.aspect)
return attachment.meta.small.aspect
return undefined
})
</script>
<template>
<template v-if="attachment.type === 'image' || attachment.type === 'gifv'">
<CommonBlurhash
:blurhash="attachment.blurhash"
class="status-attachment-image"
:src="attachment.previewUrl!"
:alt="attachment.description!"
border="~ border"
:style="{
aspectRatio,
}"
object-cover rounded-lg
/>
</template>
<template v-else>
TODO:
<pre>{{ attachment }}
</pre>
</template>
</template>