Remplace Tailwind par une feuille de style classique
style/main.css est désormais servi tel quel par cargo-leptos (style-file) : remise à zéro des styles du navigateur, couleurs en variables CSS et classes nommées par composant à la place des classes utilitaires. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
6b5eaa0ba6
commit
e47db8b070
8 files changed
+1060
-233
No files matched your search
+61
-85
@@ -30,11 +30,11 @@ pub fn Sheet(title: String, on_close: impl Fn() + Copy + Send + Sync + 'static,
|
||||
on_cleanup(move || handle.remove());
|
||||
|
||||
view! {
|
||||
<div class="fixed inset-0 z-20 flex items-end justify-center" role="dialog" aria-modal="true">
|
||||
<div class="absolute inset-0 bg-ink/50" on:click=move |_| on_close()></div>
|
||||
<div class="relative max-h-[90dvh] w-full max-w-md overflow-y-auto rounded-t-3xl border-2 border-b-0 border-ink bg-paper px-5 pt-3 pb-[max(1.5rem,env(safe-area-inset-bottom))]">
|
||||
<div class="mx-auto mb-4 h-1.5 w-12 rounded-full bg-ink/20"></div>
|
||||
<h2 class="font-display text-2xl font-bold">{title}</h2>
|
||||
<div class="sheet" role="dialog" aria-modal="true">
|
||||
<div class="sheet-backdrop" on:click=move |_| on_close()></div>
|
||||
<div class="sheet-panel">
|
||||
<div class="sheet-handle"></div>
|
||||
<h2 class="sheet-title">{title}</h2>
|
||||
{children()}
|
||||
</div>
|
||||
</div>
|
||||
@@ -124,7 +124,7 @@ fn AddForm(list_id: i64, items: Memo<Vec<Item>>) -> impl IntoView {
|
||||
|
||||
view! {
|
||||
<Sheet title="Ajouter".to_owned() on_close=close>
|
||||
<form class="mt-4 flex flex-col gap-4" on:submit=submit>
|
||||
<form class="form form-compact" on:submit=submit>
|
||||
<input
|
||||
class="field"
|
||||
type="search"
|
||||
@@ -137,7 +137,7 @@ fn AddForm(list_id: i64, items: Memo<Vec<Item>>) -> impl IntoView {
|
||||
/>
|
||||
|
||||
<Show when=move || !matches.with(Vec::is_empty)>
|
||||
<ul class="grid grid-cols-3 gap-3">
|
||||
<ul class="tiles">
|
||||
<For
|
||||
each=move || matches.get()
|
||||
key=|item| (item.id, item.checked, item.name.clone(), item.icon)
|
||||
@@ -151,7 +151,7 @@ fn AddForm(list_id: i64, items: Memo<Vec<Item>>) -> impl IntoView {
|
||||
<Show when=can_add>
|
||||
<button
|
||||
type="submit"
|
||||
class="tile-shadow rounded-2xl border-2 border-ink bg-pink px-4 py-3 text-left font-display text-lg font-bold active:translate-y-1 active:shadow-none"
|
||||
class="button button-primary button-add"
|
||||
>
|
||||
{move || format!("+ Ajouter « {} »", query.read().trim())}
|
||||
</button>
|
||||
@@ -167,21 +167,18 @@ fn SearchResult(item: Item, on_pick: impl Fn() + Copy + Send + Sync + 'static) -
|
||||
let ctx = expect_context::<Ctx>();
|
||||
let selected = !item.checked;
|
||||
let (id, icon, name) = (item.id, item.icon, item.name);
|
||||
// Same looks as the tiles of the list and of the basket.
|
||||
let (class, label_class) = if selected {
|
||||
(
|
||||
format!("tile-shadow border-ink active:translate-y-1 active:shadow-none {}", item.category.tile_class()),
|
||||
"font-semibold",
|
||||
)
|
||||
// Same looks as the tiles of the list and of the basket.
|
||||
let class = if selected {
|
||||
format!("tile tile-item {}", item.category.tile_class())
|
||||
} else {
|
||||
("border-transparent bg-mist text-ink/45 active:bg-ink/10".to_owned(), "font-medium line-through decoration-ink/30")
|
||||
"tile tile-off".to_owned()
|
||||
};
|
||||
let aria_label = format!("{name} : {}", if selected { "mettre dans le panier" } else { "remettre dans la liste" });
|
||||
view! {
|
||||
<li>
|
||||
<button
|
||||
type="button"
|
||||
class=format!("flex aspect-square w-full flex-col items-center gap-1 rounded-2xl border-2 p-2 pb-2.5 text-center {class}")
|
||||
class=class
|
||||
aria-label=aria_label
|
||||
aria-pressed=selected.to_string()
|
||||
on:click=move |_| {
|
||||
@@ -189,8 +186,8 @@ fn SearchResult(item: Item, on_pick: impl Fn() + Copy + Send + Sync + 'static) -
|
||||
on_pick();
|
||||
}
|
||||
>
|
||||
<IconSvg icon class="min-h-0 w-full flex-1" />
|
||||
<span class=format!("line-clamp-2 text-[0.95rem] leading-tight break-words hyphens-auto {label_class}")>
|
||||
<IconSvg icon />
|
||||
<span class="tile-label">
|
||||
{name}
|
||||
</span>
|
||||
</button>
|
||||
@@ -237,9 +234,9 @@ fn ItemForm(item: Item) -> impl IntoView {
|
||||
|
||||
view! {
|
||||
<Sheet title="Modifier l'article".to_owned() on_close=close>
|
||||
<form class="mt-4 flex flex-col gap-5" on:submit=submit>
|
||||
<label class="flex flex-col gap-1.5">
|
||||
<span class="font-mono text-xs tracking-[0.2em] text-ink/60 uppercase">"Nom"</span>
|
||||
<form class="form" on:submit=submit>
|
||||
<label class="field-group">
|
||||
<span class="label">"Nom"</span>
|
||||
<input
|
||||
class="field"
|
||||
required
|
||||
@@ -249,13 +246,13 @@ fn ItemForm(item: Item) -> impl IntoView {
|
||||
/>
|
||||
</label>
|
||||
|
||||
<div class="flex flex-col gap-1.5">
|
||||
<span class="font-mono text-xs tracking-[0.2em] text-ink/60 uppercase">
|
||||
<div class="field-group">
|
||||
<span class="label">
|
||||
"Quantité (facultatif)"
|
||||
</span>
|
||||
<div class="flex gap-2">
|
||||
<div class="quantity">
|
||||
<input
|
||||
class="field w-28"
|
||||
class="field"
|
||||
inputmode="decimal"
|
||||
placeholder="3"
|
||||
aria-label="Quantité"
|
||||
@@ -263,7 +260,7 @@ fn ItemForm(item: Item) -> impl IntoView {
|
||||
bind:value=amount
|
||||
/>
|
||||
<select
|
||||
class="field flex-1"
|
||||
class="field"
|
||||
aria-label="Unité"
|
||||
on:change=move |ev| {
|
||||
if let Some(u) = Unit::parse(&event_target_value(&ev)) {
|
||||
@@ -284,28 +281,22 @@ fn ItemForm(item: Item) -> impl IntoView {
|
||||
</select>
|
||||
</div>
|
||||
<Show when=move || invalid_amount.get()>
|
||||
<p class="text-sm text-red-700">"Quantité invalide."</p>
|
||||
<p class="field-error">"Quantité invalide."</p>
|
||||
</Show>
|
||||
</div>
|
||||
|
||||
<fieldset class="flex flex-col gap-1.5">
|
||||
<legend class="mb-1.5 font-mono text-xs tracking-[0.2em] text-ink/60 uppercase">
|
||||
<fieldset class="field-group">
|
||||
<legend class="label">
|
||||
"Rayon"
|
||||
</legend>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<div class="chips">
|
||||
{Category::ALL
|
||||
.iter()
|
||||
.map(|&c| {
|
||||
view! {
|
||||
<button
|
||||
type="button"
|
||||
class=move || {
|
||||
format!(
|
||||
"rounded-full border-2 px-3 py-1.5 text-sm font-semibold {} {}",
|
||||
c.tile_class(),
|
||||
if category.get() == c { "border-ink" } else { "border-transparent opacity-70" },
|
||||
)
|
||||
}
|
||||
class=format!("chip {}", c.tile_class())
|
||||
aria-pressed=move || (category.get() == c).to_string()
|
||||
on:click=move |_| category.set(c)
|
||||
>
|
||||
@@ -317,33 +308,24 @@ fn ItemForm(item: Item) -> 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">
|
||||
<fieldset class="field-group">
|
||||
<legend class="label">
|
||||
"Icône"
|
||||
</legend>
|
||||
<div class="grid grid-cols-6 gap-2">
|
||||
<div class="icon-grid">
|
||||
{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"
|
||||
},
|
||||
)
|
||||
}
|
||||
class="icon-choice"
|
||||
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" />
|
||||
<IconSvg icon=i />
|
||||
</button>
|
||||
}
|
||||
})
|
||||
@@ -351,17 +333,17 @@ fn ItemForm(item: Item) -> impl IntoView {
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="flex gap-3">
|
||||
<div class="actions">
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-2xl border-2 border-ink px-4 py-3 font-semibold"
|
||||
class="button"
|
||||
on:click=delete
|
||||
>
|
||||
"Supprimer"
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
class="tile-shadow flex-1 rounded-2xl border-2 border-ink bg-pink px-4 py-3 font-display text-lg font-bold active:translate-y-1 active:shadow-none"
|
||||
class="button button-primary"
|
||||
>
|
||||
"Enregistrer"
|
||||
</button>
|
||||
@@ -436,9 +418,9 @@ fn ListForm(editor: ListEditor) -> impl IntoView {
|
||||
|
||||
view! {
|
||||
<Sheet title=title.to_owned() on_close=close>
|
||||
<form class="mt-4 flex flex-col gap-5" on:submit=submit>
|
||||
<label class="flex flex-col gap-1.5">
|
||||
<span class="font-mono text-xs tracking-[0.2em] text-ink/60 uppercase">"Nom"</span>
|
||||
<form class="form" on:submit=submit>
|
||||
<label class="field-group">
|
||||
<span class="label">"Nom"</span>
|
||||
<input
|
||||
class="field"
|
||||
required
|
||||
@@ -451,23 +433,17 @@ fn ListForm(editor: ListEditor) -> impl IntoView {
|
||||
|
||||
<Show when=move || list_id.is_none()>
|
||||
<fieldset>
|
||||
<legend class="mb-1.5 font-mono text-xs tracking-[0.2em] text-ink/60 uppercase">
|
||||
<legend class="label">
|
||||
"Couleur"
|
||||
</legend>
|
||||
<div class="flex gap-3">
|
||||
</legend>
|
||||
<div class="swatches">
|
||||
{ListColor::ALL
|
||||
.iter()
|
||||
.map(|&c| {
|
||||
view! {
|
||||
<button
|
||||
type="button"
|
||||
class=move || {
|
||||
format!(
|
||||
"size-11 rounded-full border-2 {} {}",
|
||||
c.dot_class(),
|
||||
if color.get() == c { "border-ink ring-2 ring-ink ring-offset-2 ring-offset-paper" } else { "border-ink/40" },
|
||||
)
|
||||
}
|
||||
class=format!("swatch {}", c.dot_class())
|
||||
aria-label=c.as_str()
|
||||
aria-pressed=move || (color.get() == c).to_string()
|
||||
on:click=move |_| color.set(c)
|
||||
@@ -479,13 +455,13 @@ fn ListForm(editor: ListEditor) -> impl IntoView {
|
||||
</fieldset>
|
||||
</Show>
|
||||
|
||||
<div class="flex gap-3">
|
||||
<div class="actions">
|
||||
{list_id
|
||||
.map(|_| {
|
||||
view! {
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-2xl border-2 border-ink px-4 py-3 font-semibold"
|
||||
class="button"
|
||||
on:click=delete
|
||||
>
|
||||
"Supprimer"
|
||||
@@ -494,7 +470,7 @@ fn ListForm(editor: ListEditor) -> impl IntoView {
|
||||
})}
|
||||
<button
|
||||
type="submit"
|
||||
class="tile-shadow flex-1 rounded-2xl border-2 border-ink bg-pink px-4 py-3 font-display text-lg font-bold active:translate-y-1 active:shadow-none"
|
||||
class="button button-primary"
|
||||
>
|
||||
{if list_id.is_some() { "Enregistrer" } else { "Créer" }}
|
||||
</button>
|
||||
@@ -523,29 +499,29 @@ fn SharePanel(list_id: i64) -> impl IntoView {
|
||||
};
|
||||
|
||||
view! {
|
||||
<section class="mt-6 border-t-2 border-dashed border-ink/15 pt-5">
|
||||
<h3 class="font-mono text-xs tracking-[0.2em] text-ink/60 uppercase">"Partagée avec"</h3>
|
||||
<Transition fallback=|| view! { <p class="mt-2 text-ink/50">"…"</p> }>
|
||||
<section class="section">
|
||||
<h3 class="label">"Partagée avec"</h3>
|
||||
<Transition fallback=|| view! { <p class="section-text">"…"</p> }>
|
||||
{move || Suspend::new(async move {
|
||||
let members = members.await.unwrap_or_default();
|
||||
if members.is_empty() {
|
||||
return view! { <p class="mt-2 text-ink/60">"Personne pour l'instant."</p> }.into_any();
|
||||
return view! { <p class="section-text">"Personne pour l'instant."</p> }.into_any();
|
||||
}
|
||||
view! {
|
||||
<ul class="mt-2 flex flex-col gap-2">
|
||||
<ul class="people">
|
||||
{members
|
||||
.into_iter()
|
||||
.map(|member| {
|
||||
let user_id = member.user_id;
|
||||
view! {
|
||||
<li class="flex items-center justify-between gap-3 rounded-xl bg-mist px-3 py-2">
|
||||
<div class="min-w-0">
|
||||
<p class="truncate font-semibold">{member.name}</p>
|
||||
<p class="truncate text-sm text-ink/60">{member.email}</p>
|
||||
<li class="person">
|
||||
<div class="person-info">
|
||||
<p class="person-name">{member.name}</p>
|
||||
<p class="person-email">{member.email}</p>
|
||||
</div>
|
||||
<button
|
||||
type="button"
|
||||
class="shrink-0 rounded-lg px-2 py-1 text-sm font-semibold underline"
|
||||
class="link-button"
|
||||
on:click=move |_| {
|
||||
ctx.mutate(crate::api::remove_member(list_id, user_id), move |_| bump())
|
||||
}
|
||||
@@ -561,16 +537,16 @@ fn SharePanel(list_id: i64) -> impl IntoView {
|
||||
.into_any()
|
||||
})}
|
||||
</Transition>
|
||||
<form class="mt-3 flex gap-2" on:submit=share>
|
||||
<form class="share-form" on:submit=share>
|
||||
<input
|
||||
class="field min-w-0 flex-1"
|
||||
class="field"
|
||||
type="email"
|
||||
required
|
||||
placeholder="email@exemple.fr"
|
||||
aria-label="Email de la personne"
|
||||
bind:value=email
|
||||
/>
|
||||
<button type="submit" class="shrink-0 rounded-2xl border-2 border-ink bg-lime px-4 font-semibold">
|
||||
<button type="submit" class="button button-lime">
|
||||
"Partager"
|
||||
</button>
|
||||
</form>
|
||||
@@ -599,10 +575,10 @@ fn SharedListInfo(list: ShoppingList) -> impl IntoView {
|
||||
|
||||
view! {
|
||||
<Sheet title=list.name.clone() on_close=close>
|
||||
<p class="mt-1 text-ink/70">{format!("Liste de {}, partagée avec toi.", list.owner_name)}</p>
|
||||
<p class="sheet-text">{format!("Liste de {}, partagée avec toi.", list.owner_name)}</p>
|
||||
<button
|
||||
type="button"
|
||||
class="mt-6 w-full rounded-2xl border-2 border-ink px-4 py-3 font-semibold"
|
||||
class="button button-block"
|
||||
on:click=leave
|
||||
>
|
||||
"Quitter la liste"
|
||||
|
||||
Reference in new issue
Block a user