ramadanproject/resources/js/components/UploadModal.vue
Ahmed Darrazi 45a147253c
Some checks failed
tests / ci (push) Failing after 6m13s
linter / quality (pull_request) Failing after 58s
linter / quality (push) Failing after 1m19s
tests / ci (pull_request) Failing after 5m28s
feat(public-grid): add QA, quickstart, decision docs; scheduler docs; ignore files; tasks updates; run pint
2026-01-03 04:56:12 +01:00

56 lines
1.2 KiB
Vue

<template>
<div class="upload-modal">
<div class="backdrop" @click="$emit('close')"></div>
<div class="dialog">
<h3>Upload Preview</h3>
<input type="file" accept="image/*" @change="onFile" />
<div v-if="preview" class="preview">
<img :src="preview" alt="preview" />
</div>
<div class="actions">
<button @click="$emit('close')">Close</button>
</div>
</div>
</div>
</template>
<script setup>
import { ref } from 'vue';
const props = defineProps({ selection: { type: Object, default: null } });
const preview = ref(null);
function onFile(e) {
const file = e.target.files && e.target.files[0];
if (!file) return;
const reader = new FileReader();
reader.onload = (ev) => {
preview.value = ev.target.result;
};
reader.readAsDataURL(file);
}
</script>
<style scoped>
.upload-modal .backdrop {
position: fixed;
inset: 0;
background: rgba(0,0,0,0.4);
}
.upload-modal .dialog {
position: fixed;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
background: white;
padding: 1rem;
border-radius: 8px;
width: 90%;
max-width: 560px;
}
.preview img {
max-width: 100%;
height: auto;
display: block;
}
</style>