Masque le choix d'icône à la création d'un article

Un nouvel article prend le panier ; l'icône reste modifiable depuis
l'éditeur de l'article.

Closes #4

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Romulus21andClaude Opus 5.5 committed 2026-11-01 16:14:41 +01:00
1 parent a34e86dea6
commit 444319f9a5
1 file changed
+39 -33
+39 -33
View File
@@ -184,39 +184,45 @@ fn ItemForm(editor: ItemEditor, list_id: i64) -> impl IntoView {
</div>
</fieldset>
<fieldset class="flex flex-col gap-1.5">
<legend class="mb-1.5 font-mono text-xs tracking-[0.2em] text-ink/60 uppercase">
"Icône"
</legend>
<div class="grid grid-cols-6 gap-2">
{Icon::ALL
.iter()
.map(|&i| {
view! {
<button
type="button"
class=move || {
format!(
"grid aspect-square place-items-center rounded-xl border-2 {}",
if icon.get() == i {
"border-ink bg-lime"
} else {
"border-ink/10 bg-mist"
},
)
}
title=icon_label(i)
aria-label=icon_label(i)
aria-pressed=move || (icon.get() == i).to_string()
on:click=move |_| icon.set(i)
>
<IconSvg icon=i class="size-7" />
</button>
}
})
.collect_view()}
</div>
</fieldset>
// New items keep the basket: the icon can be changed when editing.
{item_id
.map(|_| {
view! {
<fieldset class="flex flex-col gap-1.5">
<legend class="mb-1.5 font-mono text-xs tracking-[0.2em] text-ink/60 uppercase">
"Icône"
</legend>
<div class="grid grid-cols-6 gap-2">
{Icon::ALL
.iter()
.map(|&i| {
view! {
<button
type="button"
class=move || {
format!(
"grid aspect-square place-items-center rounded-xl border-2 {}",
if icon.get() == i {
"border-ink bg-lime"
} else {
"border-ink/10 bg-mist"
},
)
}
title=icon_label(i)
aria-label=icon_label(i)
aria-pressed=move || (icon.get() == i).to_string()
on:click=move |_| icon.set(i)
>
<IconSvg icon=i class="size-7" />
</button>
}
})
.collect_view()}
</div>
</fieldset>
}
})}
<div class="flex gap-3">
{item_id