Skip to content

Commit

Permalink
feat: affiche les champs boolean
Browse files Browse the repository at this point in the history
Fix #4
  • Loading branch information
jillro committed Jul 22, 2024
1 parent a2ddbba commit 8e60355
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/components/Photo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
export let required = false;
export let initialData: string | undefined;
let input: HTMLInputElement;
let previewURI: string | undefined;
function updatePreview(e: Event) {
Expand All @@ -25,6 +26,7 @@
class="form-control"
{required}
on:change={updatePreview}
bind:this={input}
/>
{#if initialData}
<img src={initialData} alt="Profil" style="width: 200px; height: auto;" />
Expand All @@ -34,11 +36,20 @@
{#if previewURI}
<div
style="
display: inline-block;
height: 200px;
background-size: cover;
width: 200px;
background-position: center;
background-image: url({previewURI});
"
/>
<button
on:click|capture|stopImmediatePropagation|stopPropagation|preventDefault={() => {
input.value = "";
previewURI = undefined;
}}
>
</button>
{/if}

0 comments on commit 8e60355

Please sign in to comment.