1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-19 04:49:37 +02:00

feat: Remove image functionality from ImageModal component

This commit is contained in:
Sean Morley 2024-06-16 16:40:07 +00:00
parent b6dcb8e438
commit 563e9d2b4d

View file

@ -106,6 +106,12 @@
// Handle the error
}
}
function removeImage() {
existingImageKey = undefined;
imageUrl = "";
dispatch("submit", "");
}
</script>
<dialog id="my_modal_1" class="modal">
@ -114,7 +120,14 @@
<div class="modal-box" role="dialog" on:keydown={handleKeydown} tabindex="0">
{#if existingImageKey}
<h2 class="text-center font-bold text-xl mb-2">Existing Image</h2>
<img src="/cdn/{bucket}/{existingImageKey}" alt="Existing" class="mb-2" />
<div class="flex items-center justify-center">
<button class="btn btn-warning" on:click={removeImage}
>Remove Image<iconify-icon icon="mdi:delete" class="text-xl -ml-1"
></iconify-icon></button
>
</div>
{/if}
<h3 class="font-bold text-lg">Image Upload</h3>
@ -169,7 +182,10 @@
</form>
{/if}
<button class="btn btn-primary" on:click={submit}>Submit</button>
<button class="btn btn-primary" on:click={submit}
>Submit <iconify-icon icon="mdi:upload" class="text-xl"
></iconify-icon></button
>
<button class="btn btn-neutral" on:click={close}>Close</button>
</div>
</dialog>