feat: preview multiple images

This commit is contained in:
Anthony Fu 2022-11-30 11:27:19 +08:00
parent 568a333d7c
commit cf7cd1fd6c
7 changed files with 92 additions and 23 deletions

View file

@ -4,6 +4,7 @@ import type { Attachment } from 'masto'
const { attachment } = defineProps<{
attachment: Attachment
attachments?: Attachment[]
}>()
const src = $computed(() => attachment.remoteUrl || attachment.url || attachment.previewUrl!)
@ -62,10 +63,7 @@ const aspectRatio = computed(() => {
focus:ring="2 primary inset"
rounded-lg
aria-label="Open image preview dialog"
@click="openImagePreviewDialog({
src,
alt: attachment.description!,
})"
@click="openMediaPreview(attachments ? attachments : [attachment], attachments?.indexOf(attachment) || 0)"
>
<CommonBlurhash
:blurhash="attachment.blurhash"