2022-11-23 20:17:54 +03:00
|
|
|
<script setup lang="ts">
|
|
|
|
import type { Attachment } from 'masto'
|
|
|
|
|
2022-12-15 02:30:54 +03:00
|
|
|
const props = withDefaults(defineProps<{
|
2022-11-23 20:17:54 +03:00
|
|
|
attachment: Attachment
|
|
|
|
alt?: string
|
|
|
|
removable?: boolean
|
|
|
|
}>(), {
|
|
|
|
removable: true,
|
|
|
|
})
|
|
|
|
|
|
|
|
defineEmits<{
|
|
|
|
(evt: 'remove'): void
|
2022-12-15 02:30:54 +03:00
|
|
|
(evt: 'setDescription', description: string): void
|
2022-11-23 20:17:54 +03:00
|
|
|
}>()
|
2022-12-15 02:30:54 +03:00
|
|
|
|
|
|
|
const isEditDialogOpen = ref(false)
|
|
|
|
const description = ref(props.attachment.description)
|
2022-11-23 20:17:54 +03:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div relative group>
|
2022-11-25 17:31:33 +03:00
|
|
|
<StatusAttachment :attachment="attachment" w-full />
|
2022-11-24 07:05:13 +03:00
|
|
|
<div absolute right-2 top-2>
|
|
|
|
<div
|
|
|
|
v-if="removable"
|
2022-11-30 16:01:03 +03:00
|
|
|
aria-label="Remove attachment"
|
|
|
|
hover:bg="gray/40" transition-100 p-1 rounded-5 cursor-pointer
|
|
|
|
:class="[isSmallScreen ? '' : 'op-0 group-hover:op-100hover:']"
|
|
|
|
mix-blend-difference
|
2022-11-24 07:05:13 +03:00
|
|
|
@click="$emit('remove')"
|
|
|
|
>
|
2022-11-30 16:01:03 +03:00
|
|
|
<div i-ri:close-line text-3 :class="[isSmallScreen ? 'text-6' : 'text-3']" />
|
2022-11-24 07:05:13 +03:00
|
|
|
</div>
|
2022-11-23 20:17:54 +03:00
|
|
|
</div>
|
2022-12-15 02:30:54 +03:00
|
|
|
<div absolute right-2 bottom-2>
|
|
|
|
<button class="bg-black/75" text-white px2 py1 rounded-2 @click="isEditDialogOpen = true">
|
|
|
|
Edit
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<ModalDialog v-model="isEditDialogOpen" py-6 px-6 max-w-300>
|
|
|
|
<div flex gap-5>
|
|
|
|
<div flex flex-col gap-2 justify-between>
|
|
|
|
<h1 font-bold>
|
|
|
|
Description
|
|
|
|
</h1>
|
|
|
|
<div flex flex-col gap-2>
|
|
|
|
<textarea v-model="description" p-3 w-100 h-50 bg-base rounded-2 border-strong border-1 />
|
|
|
|
<button btn-outline @click="$emit('setDescription', description)">
|
|
|
|
Apply
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<button btn-outline @click="isEditDialogOpen = false">
|
|
|
|
Close
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
<StatusAttachment :attachment="attachment" w-full />
|
|
|
|
</div>
|
|
|
|
</ModalDialog>
|
2022-11-23 20:17:54 +03:00
|
|
|
</div>
|
|
|
|
</template>
|