aboutsummaryrefslogtreecommitdiff
path: root/src/routes/categories
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-07-28 19:30:07 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-07-28 19:31:13 +0200
commit1e720925e2ef690d455927c2f9e802571304982a (patch)
treeb5bcd4dd6a49115bdaca904832cb6bd8e859a35a /src/routes/categories
parent0d100b83f8ba818c2f32663f415649db03534548 (diff)
fix: sticky form and navbar layout with consistent nav-height
Diffstat (limited to 'src/routes/categories')
-rw-r--r--src/routes/categories/+page.svelte88
1 files changed, 45 insertions, 43 deletions
diff --git a/src/routes/categories/+page.svelte b/src/routes/categories/+page.svelte
index 41b40c5..1060eaa 100644
--- a/src/routes/categories/+page.svelte
+++ b/src/routes/categories/+page.svelte
@@ -5,52 +5,54 @@
let name = $state('');
</script>
-<form
- class="form-card form-card--compact"
- method="POST"
- action="?/add"
- use:enhance
->
- <label>
- <span class="form-label">Nouvelle catégorie</span>
- <input
- class="form-input"
- type="text"
- name="name"
- bind:value={name}
- placeholder="ex. Boissons"
- autocomplete="off"
- />
- </label>
- <button class="btn-primary" type="submit">Ajouter</button>
-</form>
+<main>
+ <form
+ class="form-card form-card--compact"
+ method="POST"
+ action="?/add"
+ use:enhance
+ >
+ <label>
+ <span class="form-label">Nouvelle catégorie</span>
+ <input
+ class="form-input"
+ type="text"
+ name="name"
+ bind:value={name}
+ placeholder="ex. Boissons"
+ autocomplete="off"
+ />
+ </label>
+ <button class="btn-primary" type="submit">Ajouter</button>
+ </form>
-{#if form?.error}
- <p class="error">{form.error}</p>
-{/if}
+ {#if form?.error}
+ <p class="error">{form.error}</p>
+ {/if}
-<form method="POST" action="?/delete" use:enhance>
- <ul class="item-list">
- {#each data?.categories ?? [] as cat (cat.id)}
- <li class="item-row item-row--card">
- <span class="cat-name">{cat.name}</span>
- <button
- class="btn-ghost"
- name="id"
- value={cat.id}
- type="submit"
- aria-label="Supprimer"
- >
- &times;
- </button>
- </li>
- {/each}
- </ul>
-</form>
+ <form method="POST" action="?/delete" use:enhance>
+ <ul class="item-list">
+ {#each data?.categories ?? [] as cat (cat.id)}
+ <li class="item-row item-row--card">
+ <span class="cat-name">{cat.name}</span>
+ <button
+ class="btn-ghost"
+ name="id"
+ value={cat.id}
+ type="submit"
+ aria-label="Supprimer"
+ >
+ &times;
+ </button>
+ </li>
+ {/each}
+ </ul>
+ </form>
-{#if (data?.categories?.length ?? 0) === 0}
- <p class="empty">Aucune catégorie</p>
-{/if}
+ {#if (data?.categories?.length ?? 0) === 0}
+ <p class="empty">Aucune catégorie</p>
+ {/if}
+</main>
<style>
.cat-name {