mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-04 20:55:19 +02:00
feat: Add existing image display to image upload modal
This commit is contained in:
parent
ea20f1a5a7
commit
a2de88aa6b
3 changed files with 11 additions and 0 deletions
|
@ -102,6 +102,8 @@
|
|||
name={newAdventure.name}
|
||||
on:submit={upload}
|
||||
on:close={() => (isImageModalOpen = false)}
|
||||
bucket="adventures"
|
||||
existingImageKey={newAdventure.imageUrl}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
|
|
|
@ -103,6 +103,8 @@
|
|||
name={adventureToEdit.name}
|
||||
on:submit={upload}
|
||||
on:close={() => (isImageModalOpen = false)}
|
||||
existingImageKey={adventureToEdit.imageUrl}
|
||||
bucket="adventures"
|
||||
/>
|
||||
{/if}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
import { onMount } from "svelte";
|
||||
let modal: HTMLDialogElement;
|
||||
export let name: string;
|
||||
export let existingImageKey: string | undefined;
|
||||
export let bucket: string;
|
||||
|
||||
let viewType: string = "upload";
|
||||
|
||||
|
@ -110,6 +112,11 @@
|
|||
<!-- svelte-ignore a11y-no-noninteractive-element-interactions -->
|
||||
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
||||
<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" />
|
||||
{/if}
|
||||
|
||||
<h3 class="font-bold text-lg">Image Upload</h3>
|
||||
<div class="join items-center justify-center flex mb-8">
|
||||
<input
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue