wip bsky client for the web & android bbell.vt3e.cat
at main 108 lines 2.2 kB view raw
1<script setup lang="ts"> 2import { ref } from 'vue' 3 4import { useModalStore } from '@/stores/modal' 5import BaseModal from '@/components/UI/BaseModal.vue' 6import BaseButton from '@/components/UI/BaseButton.vue' 7import TextArea from '@/components/UI/TextArea.vue' 8 9const props = defineProps<{ initialText: string; imageSrc: string }>() 10const text = ref(props.initialText) 11 12function handleSave() { 13 const modals = useModalStore() 14 modals.close(text.value) 15} 16</script> 17 18<template> 19 <BaseModal title="Add Image Description" @close="$emit('close')"> 20 <div class="alt-editor"> 21 <div class="image-preview"> 22 <img :src="imageSrc" alt="Preview" /> 23 </div> 24 <div class="input-area"> 25 <p class="helper-text"> 26 Alt text describes images for people with various disabilities and helps give context to 27 everyone! Good alt text is concise, descriptive, and communicates the purpose of the 28 image. 29 </p> 30 <TextArea 31 v-model="text" 32 placeholder="Describe this image..." 33 :rows="4" 34 autoresize 35 class="alt-input" 36 /> 37 </div> 38 </div> 39 40 <template #footer> 41 <BaseButton @click="$emit('close')">Cancel</BaseButton> 42 <BaseButton @click="handleSave">Save</BaseButton> 43 </template> 44 </BaseModal> 45</template> 46 47<style scoped lang="scss"> 48.alt-editor { 49 display: flex; 50 flex-direction: column; 51 gap: 1rem; 52 53 @media (min-width: 768px) { 54 flex-direction: row; 55 align-items: flex-start; 56 } 57} 58 59.image-preview { 60 flex-shrink: 0; 61 width: 100%; 62 max-height: 200px; 63 border-radius: var(--radius-md); 64 overflow: hidden; 65 background: hsl(var(--surface0)); 66 border: 1px solid hsla(var(--surface2) / 0.5); 67 display: flex; 68 align-items: center; 69 justify-content: center; 70 71 @media (min-width: 768px) { 72 width: 200px; 73 height: 200px; 74 } 75 76 img { 77 max-width: 100%; 78 max-height: 100%; 79 object-fit: contain; 80 } 81} 82 83.input-area { 84 flex: 1; 85 display: flex; 86 flex-direction: column; 87 gap: 0.5rem; 88 89 .helper-text { 90 font-size: 0.85rem; 91 color: hsl(var(--subtext0)); 92 margin: 0; 93 } 94 95 .alt-input { 96 width: 100%; 97 font-size: 0.95rem; 98 99 :deep(textarea) { 100 padding: 0.5rem; 101 } 102 103 &:focus { 104 background: hsla(var(--surface1) / 0.5); 105 } 106 } 107} 108</style>