add delete to admin panel
All checks were successful
deploy / build-and-deploy (push) Successful in 21s

This commit is contained in:
2025-05-21 20:53:53 +02:00
parent e47268111a
commit 45f984e4da
16 changed files with 207 additions and 50 deletions

View File

@ -21,10 +21,11 @@
onClick?: (t: T) => void;
onEdit?: (t: T) => void;
onDelete?: (t: T) => void;
}
// input
let { data, count, keys, onClick, onEdit }: Props<any> = $props();
let { data, count, keys, onClick, onEdit, onDelete }: Props<any> = $props();
</script>
<div class="h-screen overflow-x-auto">
@ -39,7 +40,7 @@
>{key.label}</SortableTh
>
{/each}
{#if onEdit}
{#if onEdit || onDelete}
<SortableTh style="width: 5%"></SortableTh>
{/if}
</SortableTr>
@ -59,11 +60,18 @@
{/if}
</td>
{/each}
{#if onEdit}
{#if onEdit || onDelete}
<td>
<button class="cursor-pointer" onclick={() => onEdit(d)}>
<Icon icon="heroicons:pencil-square" />
</button>
{#if onEdit}
<button class="cursor-pointer" onclick={() => onEdit(d)}>
<Icon icon="heroicons:pencil-square" />
</button>
{/if}
{#if onDelete}
<button class="cursor-pointer" onclick={() => onDelete(d)}>
<Icon icon="heroicons:trash" />
</button>
{/if}
</td>
{/if}
</tr>