Skip to content

Commit

Permalink
Delete confirm
Browse files Browse the repository at this point in the history
  • Loading branch information
prokawsar committed Jul 15, 2024
1 parent 4e040fa commit e965a3c
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions src/routes/history/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
export let data
let isLoading = false
let deleteConfirm = false
$paperHistoryStore = data.histories
Expand Down Expand Up @@ -52,12 +53,29 @@
<p class="text-gray-500">
{final_price.toFixed(2)}
</p>
<button
class="border border-gray-400 rounded-md text-red-600 p-1 w-fit disabled:border-gray-200 disabled:cursor-not-allowed disabled:text-opacity-45"
on:click|stopPropagation|preventDefault={() => handleDelete(id)}
>
<Icon icon="ph:trash-light" width="16px" />
</button>
<div class="flex flex-row items-center gap-[2px]">
<button
class:hidden={deleteConfirm}
class="border border-gray-400 rounded-md text-red-600 p-1 w-fit disabled:border-gray-200 disabled:cursor-not-allowed disabled:text-opacity-45"
on:click|stopPropagation|preventDefault={() => (deleteConfirm = true)}
>
<Icon icon="ph:trash-light" width="16px" />
</button>
{#if deleteConfirm}
<button
class="border border-gray-400 p-1 rounded-md text-red-700 w-fit disabled:border-gray-200 disabled:cursor-not-allowed disabled:text-opacity-45"
on:click|stopPropagation|preventDefault={() => (deleteConfirm = false)}
>
<Icon icon="majesticons:multiply" width="16px" />
</button>
<button
class="border border-gray-400 p-1 rounded-md text-green-700 w-fit disabled:border-gray-200 disabled:cursor-not-allowed disabled:text-opacity-45"
on:click|stopPropagation|preventDefault={() => handleDelete(id)}
>
<Icon icon="teenyicons:tick-solid" width="15px" />
</button>
{/if}
</div>
</a>
</div>
{/each}
Expand Down

0 comments on commit e965a3c

Please sign in to comment.