fix: add item form now syncs with its correstonding toggle button correctly

This commit is contained in:
2025-11-25 20:53:04 +01:00
parent 6a927d4045
commit 0c8dc087ca
2 changed files with 4 additions and 8 deletions

View File

@@ -5,19 +5,14 @@
let {
rearranging = $bindable(false),
showAddForm = false,
onToggleAddForm
}: {
rearranging: boolean;
showAddForm?: boolean;
onToggleAddForm: () => void;
} = $props();
let showAddForm = $state(false);
function toggleAddForm() {
showAddForm = !showAddForm;
onToggleAddForm();
}
function toggleRearranging() {
rearranging = !rearranging;
}
@@ -25,7 +20,7 @@
<div class="flex flex-col md:flex-row gap-4">
<Button
onclick={toggleAddForm}
onclick={onToggleAddForm}
class="w-full md:w-auto"
>
{showAddForm ? "Cancel" : "+ Add Item"}

View File

@@ -246,6 +246,7 @@
<WishlistActionButtons
bind:rearranging={rearranging}
showAddForm={showAddForm}
onToggleAddForm={handleToggleAddForm}
/>