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:
Romulus21andClaude Opus 5.5 committed 2026-11-05 22:39:42 +01:00
1 parent 6b5eaa0ba6
commit e47db8b070
8 files changed
+1060 -233

No files matched your search

+20 -20
View File
@@ -83,13 +83,13 @@ fn RedirectIfSignedIn() -> impl IntoView {
fn AuthLayout(title: &'static str, children: Children) -> impl IntoView {
view! {
<RedirectIfSignedIn />
<main class="mx-auto flex min-h-dvh max-w-md flex-col px-4 pt-[max(1.5rem,env(safe-area-inset-top))] pb-16">
<h1 class="font-display text-5xl leading-[0.9] font-extrabold tracking-tight">
<main class="page page-auth">
<h1 class="page-title">
"mes listes"
</h1>
<section class="ticket relative mt-8 bg-paper px-5 pt-6 pb-8">
<p class="font-mono text-sm tracking-[0.2em] text-ink/60 uppercase">"Lisette · Courses"</p>
<h2 class="mt-1 font-display text-[1.7rem] leading-tight font-bold tracking-tight">{title}</h2>
<section class="ticket">
<p class="eyebrow">"Lisette · Courses"</p>
<h2 class="ticket-title">{title}</h2>
{children()}
</section>
</main>
@@ -101,7 +101,7 @@ pub fn FormError(#[prop(into)] error: Signal<Option<String>>) -> impl IntoView {
move || {
error.get().map(|msg| {
view! {
<p role="alert" class="rounded-xl border-2 border-ink bg-pink px-3 py-2 font-medium">
<p role="alert" class="form-error">
{msg}
</p>
}
@@ -114,7 +114,7 @@ pub fn LoginPage() -> impl IntoView {
let auth = expect_context::<Auth>();
view! {
<AuthLayout title="Connexion">
<ActionForm action=auth.login attr:class="mt-5 flex flex-col gap-4">
<ActionForm action=auth.login attr:class="form form-compact">
<FormError error=Signal::derive(move || auth.login.value().get().and_then(Result::err).map(error_message)) />
<Field label="Email">
<input class="field" type="email" name="email" required autocomplete="email" />
@@ -135,9 +135,9 @@ pub fn LoginPage() -> impl IntoView {
matches!(auth.registration.await, Ok(true))
.then(|| {
view! {
<p class="mt-6 text-center text-ink/70">
<p class="footnote">
"Pas encore de compte ? "
<A href="/inscription" attr:class="font-semibold text-ink underline">
<A href="/inscription">
"Créer un compte"
</A>
</p>
@@ -158,14 +158,14 @@ pub fn RegisterPage() -> impl IntoView {
{move || Suspend::new(async move {
if !matches!(auth.registration.await, Ok(true)) {
return view! {
<p class="mt-4 text-lg text-ink/70">
<p class="lead">
"Les inscriptions sont fermées pour le moment."
</p>
}
.into_any();
}
view! {
<ActionForm action=auth.register attr:class="mt-5 flex flex-col gap-4">
<ActionForm action=auth.register attr:class="form form-compact">
<FormError error=Signal::derive(move || auth.register.value().get().and_then(Result::err).map(error_message)) />
<Field label="Prénom ou pseudo">
<input
@@ -196,9 +196,9 @@ pub fn RegisterPage() -> impl IntoView {
.into_any()
})}
</Suspense>
<p class="mt-6 text-center text-ink/70">
<p class="footnote">
"Déjà inscrit·e ? "
<A href="/connexion" attr:class="font-semibold text-ink underline">
<A href="/connexion">
"Se connecter"
</A>
</p>
@@ -209,8 +209,8 @@ pub fn RegisterPage() -> impl IntoView {
#[component]
pub fn Field(label: &'static str, children: Children) -> impl IntoView {
view! {
<label class="flex flex-col gap-1.5">
<span class="font-mono text-xs tracking-[0.2em] text-ink/60 uppercase">{label}</span>
<label class="field-group">
<span class="label">{label}</span>
{children()}
</label>
}
@@ -221,7 +221,7 @@ fn SubmitButton(#[prop(into)] pending: Signal<bool>, label: &'static str) -> imp
view! {
<button
type="submit"
class="tile-shadow mt-2 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 disabled:opacity-60"
class="button button-primary"
disabled=move || pending.get()
>
{label}
@@ -240,23 +240,23 @@ pub fn AccountSheet(user: User) -> impl IntoView {
view! {
<Show when=move || ctx.account_open.get()>
<Sheet title=user.with_value(|u| u.name.clone()) on_close=close>
<p class="mt-1 text-ink/70">{user.with_value(|u| u.email.clone())}</p>
<p class="sheet-text">{user.with_value(|u| u.email.clone())}</p>
{user
.with_value(|u| u.is_admin)
.then(|| {
view! {
<A
href="/admin"
attr:class="mt-6 block w-full rounded-2xl border-2 border-ink bg-lime px-4 py-3 text-center font-semibold"
attr:class="button button-lime button-block"
>
"Gérer les utilisateurs"
</A>
}
})}
<ActionForm action=auth.logout attr:class="mt-3">
<ActionForm action=auth.logout>
<button
type="submit"
class="w-full rounded-2xl border-2 border-ink px-4 py-3 font-semibold"
class="button button-block"
>
"Se déconnecter"
</button>
+25 -26
View File
@@ -25,8 +25,8 @@ fn AdminView(me: User) -> impl IntoView {
if !me.is_admin {
return view! {
<AdminLayout>
<section class="ticket relative mt-6 bg-paper px-5 pt-6 pb-8">
<p class="text-lg text-ink/70">"Cette page est réservée aux administrateurs."</p>
<section class="ticket">
<p class="lead">"Cette page est réservée aux administrateurs."</p>
</section>
</AdminLayout>
}
@@ -40,17 +40,17 @@ fn AdminView(me: User) -> impl IntoView {
view! {
<AdminLayout>
<section class="ticket relative mt-6 bg-paper px-5 pt-6 pb-8">
<p class="font-mono text-sm tracking-[0.2em] text-ink/60 uppercase">"Lisette · Comptes"</p>
<h2 class="mt-1 font-display text-[1.7rem] leading-tight font-bold tracking-tight">
<section class="ticket">
<p class="eyebrow">"Lisette · Comptes"</p>
<h2 class="ticket-title">
"Utilisateurs"
</h2>
<Transition fallback=|| view! { <p class="mt-4 text-ink/50">"…"</p> }>
<Transition fallback=|| view! { <p class="loading">"…"</p> }>
{move || Suspend::new(async move {
match accounts.await {
Ok(accounts) => view! { <AccountRows accounts me_id editor /> }.into_any(),
Err(err) => {
view! { <p class="mt-4 font-medium">{error_message(err)}</p> }.into_any()
view! { <p class="lead">{error_message(err)}</p> }.into_any()
}
}
})}
@@ -58,7 +58,7 @@ fn AdminView(me: User) -> impl IntoView {
</section>
<button
class="tile-shadow fixed right-[max(1rem,calc(50vw-14rem+1rem))] bottom-[max(1.25rem,env(safe-area-inset-bottom))] z-10 rounded-2xl border-2 border-ink bg-pink px-6 py-4 font-display text-xl font-bold active:translate-y-1 active:shadow-none"
class="fab"
on:click=move |_| editor.set(Some(AccountEditor::New))
>
"+ compte"
@@ -86,12 +86,12 @@ fn AdminView(me: User) -> impl IntoView {
#[component]
fn AdminLayout(children: Children) -> impl IntoView {
view! {
<main class="mx-auto flex min-h-dvh max-w-md flex-col px-4 pt-[max(1.5rem,env(safe-area-inset-top))] pb-32">
<header class="flex items-start justify-between gap-4">
<h1 class="font-display text-5xl leading-[0.9] font-extrabold tracking-tight">"admin"</h1>
<main class="page">
<header class="page-header">
<h1 class="page-title">"admin"</h1>
<A
href="/"
attr:class="shrink-0 rounded-2xl border-2 border-ink bg-paper px-4 py-3 font-semibold"
attr:class="button button-paper"
>
"← mes listes"
</A>
@@ -108,13 +108,13 @@ fn AccountRows(
editor: RwSignal<Option<AccountEditor>>,
) -> impl IntoView {
view! {
<p class="mt-1 text-lg text-ink/70">
<p class="lead">
{match accounts.len() {
1 => "1 compte.".to_owned(),
n => format!("{n} comptes."),
}}
</p>
<ul class="mt-5 flex flex-col gap-2">
<ul class="people">
{accounts
.into_iter()
.map(|Account { user, created_at }| {
@@ -123,22 +123,22 @@ fn AccountRows(
view! {
<li>
<button
class="flex w-full items-center justify-between gap-3 rounded-xl bg-mist px-3 py-2 text-left active:bg-ink/10"
class="person"
on:click=move |_| editor.set(Some(AccountEditor::Edit(edited.clone())))
>
<div class="min-w-0">
<p class="truncate font-semibold">
<div class="person-info">
<p class="person-name">
{user.name.clone()}
{is_me.then_some(" (toi)")}
</p>
<p class="truncate text-sm text-ink/60">{user.email.clone()}</p>
<p class="text-sm text-ink/50">{format!("Inscrit·e le {}", french_date(&created_at))}</p>
<p class="person-email">{user.email.clone()}</p>
<p class="person-date">{format!("Inscrit·e le {}", french_date(&created_at))}</p>
</div>
{user
.is_admin
.then(|| {
view! {
<span class="shrink-0 rounded-lg border-2 border-ink bg-lime px-2 py-0.5 font-mono text-xs uppercase">
<span class="badge">
"admin"
</span>
}
@@ -234,7 +234,7 @@ fn AccountForm(
view! {
<Sheet title=title.to_owned() on_close>
<form class="mt-4 flex flex-col gap-4" on:submit=submit>
<form class="form form-compact" on:submit=submit>
<FormError error=error />
<Field label="Prénom ou pseudo">
<input class="field" required maxlength="40" autocomplete="off" bind:value=name />
@@ -253,23 +253,22 @@ fn AccountForm(
bind:value=password
/>
</Field>
<label class="flex items-center gap-3 font-medium">
<label class="checkbox">
<input
type="checkbox"
class="size-6 accent-ink"
disabled=is_me
bind:checked=is_admin
/>
"Administrateur"
</label>
<div class="mt-2 flex gap-3">
<div class="actions">
{(user_id.is_some() && !is_me)
.then(|| {
view! {
<button
type="button"
class="rounded-2xl border-2 border-ink px-4 py-3 font-semibold"
class="button"
disabled=move || pending.get()
on:click=delete
>
@@ -279,7 +278,7 @@ fn AccountForm(
})}
<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 disabled:opacity-60"
class="button button-primary"
disabled=move || pending.get()
>
{if user_id.is_some() { "Enregistrer" } else { "Créer" }}
+33 -42
View File
@@ -41,7 +41,7 @@ pub fn shell(options: LeptosOptions) -> impl IntoView {
"if ('serviceWorker' in navigator) navigator.serviceWorker.register('/sw.js');"
</script>
</head>
<body class="bg-lime text-ink font-sans antialiased">
<body>
<App />
</body>
</html>
@@ -71,7 +71,7 @@ pub fn App() -> impl IntoView {
<Title text="Lisette" />
<Router>
<Routes fallback=|| view! { <p class="p-4">"Page introuvable."</p> }>
<Routes fallback=|| view! { <p class="page-not-found">"Page introuvable."</p> }>
<Route path=path!("/") view=ListsPage />
<Route path=path!("/l/:id") view=ListsPage />
<Route path=path!("/connexion") view=LoginPage />
@@ -207,13 +207,13 @@ fn ListsView(user: User) -> impl IntoView {
});
view! {
<main class="mx-auto flex min-h-dvh max-w-md flex-col px-4 pt-[max(1.5rem,env(safe-area-inset-top))] pb-32">
<header class="flex items-start justify-between gap-4">
<h1 class="font-display text-5xl leading-[0.9] font-extrabold tracking-tight">
<main class="page">
<header class="page-header">
<h1 class="page-title">
"mes listes"
</h1>
<button
class="grid size-14 shrink-0 place-items-center rounded-2xl bg-ink font-display text-lg font-bold text-lime"
class="avatar"
aria-label="Mon compte"
on:click=move |_| ctx.account_open.set(true)
>
@@ -223,7 +223,7 @@ fn ListsView(user: User) -> impl IntoView {
<ErrorBanner />
<Show when=move || ctx.sync.offline()>
<p class="mt-4 rounded-2xl bg-paper/70 px-4 py-3 font-medium text-ink/70">
<p class="notice">
"Réseau indisponible : tes changements partiront dès que possible."
</p>
</Show>
@@ -231,7 +231,7 @@ fn ListsView(user: User) -> impl IntoView {
<Transition fallback=|| view! { <TicketSkeleton /> }>
<ErrorBoundary fallback=|errors| {
view! {
<p class="mt-6 rounded-2xl bg-paper p-4">
<p class="panel">
"Oups : "
{move || {
errors.get().into_iter().map(|(_, e)| e.to_string()).collect::<Vec<_>>().join(", ")
@@ -281,7 +281,7 @@ fn ListsContent(
let Some(list) = lists.iter().find(|l| l.id == active_id).cloned() else {
return view! {
<ListTabs lists active=None remaining=0 />
<p class="mt-6 rounded-2xl bg-paper p-4">"Cette liste n'existe plus."</p>
<p class="panel">"Cette liste n'existe plus."</p>
}
.into_any();
};
@@ -343,20 +343,20 @@ fn ListsContent(
};
view! {
<div class=format!("fixed inset-0 -z-10 {}", color.dot_class()) aria-hidden="true"></div>
<div class=format!("page-bg {}", color.dot_class()) aria-hidden="true"></div>
<ListTabs lists active=Some(active_id) remaining />
<section class="ticket relative mt-6 bg-paper px-5 pt-6 pb-8">
<div class="flex items-start justify-between gap-2">
<h2 class="font-display text-[1.7rem] leading-tight font-bold tracking-tight">
<section class="ticket">
<div class="ticket-head">
<h2 class="ticket-title">
{list.name.clone()}
</h2>
<button
class="-mt-1 -mr-2 grid size-11 shrink-0 place-items-center rounded-full text-ink/60 active:bg-ink/5"
class="icon-button"
aria-label="Modifier la liste"
on:click=edit_list
>
<svg viewBox="0 0 24 24" fill="currentColor" class="size-6" aria-hidden="true">
<svg viewBox="0 0 24 24" fill="currentColor" aria-hidden="true">
<circle cx="5" cy="12" r="2" />
<circle cx="12" cy="12" r="2" />
<circle cx="19" cy="12" r="2" />
@@ -366,14 +366,14 @@ fn ListsContent(
{(!list.is_owner)
.then(|| {
view! {
<p class="mt-1 font-medium text-ink/60">
<p class="ticket-owner">
{format!("Partagée par {}", list.owner_name)}
</p>
}
})}
<p class="mt-1 text-lg text-ink/70">{move || remaining_text(remaining.get(), total())}</p>
<p class="lead">{move || remaining_text(remaining.get(), total())}</p>
<div class="mt-5 grid grid-cols-3 gap-3">
<div class="tiles">
<For each=move || to_get.get() key=|item| (item.id, item.quantity.map(|q| q.label()), item.name.clone(), item.icon, item.category) let:item>
<ItemTile item />
</For>
@@ -383,12 +383,12 @@ fn ListsContent(
</div>
<Show when=move || !in_basket.with(Vec::is_empty)>
<div class="mt-6 border-t-2 border-dashed border-ink/15 pt-5">
<div class="flex justify-between font-mono text-sm tracking-[0.2em] text-ink/60 uppercase">
<div class="basket">
<div class="basket-head">
<span>"Déjà dans le panier"</span>
<span>{move || format!("{}/{}", in_basket.with(Vec::len), total())}</span>
</div>
<div class="mt-4 grid grid-cols-4 gap-2">
<div class="tiles">
<For each=move || in_basket.get() key=|item| (item.id, item.name.clone(), item.icon) let:item>
<BasketTile item />
</For>
@@ -398,7 +398,7 @@ fn ListsContent(
</section>
<button
class="tile-shadow fixed right-[max(1rem,calc(50vw-14rem+1rem))] bottom-[max(1.25rem,env(safe-area-inset-bottom))] z-10 rounded-2xl border-2 border-ink bg-pink px-6 py-4 font-display text-xl font-bold active:translate-y-1 active:shadow-none"
class="fab"
on:click=move |_| ctx.item_editor.set(Some(ItemEditor::New))
>
"ajouter"
@@ -415,30 +415,21 @@ fn ListTabs(
) -> impl IntoView {
let ctx = expect_context::<Ctx>();
view! {
<nav class="-mx-4 mt-5 flex gap-3 overflow-x-auto px-4 pb-1 [scrollbar-width:none]">
<nav class="tabs">
{lists
.into_iter()
.map(|list| {
let is_active = active == Some(list.id);
let class = if is_active {
"border-ink bg-ink text-paper"
} else {
"border-ink bg-paper"
};
let class = if is_active { "tab tab-active" } else { "tab" };
view! {
<A
href=format!("/l/{}", list.id)
attr:class=format!(
"flex shrink-0 items-center gap-2 rounded-2xl border-2 px-5 py-3 text-lg font-semibold whitespace-nowrap {class}",
)
attr:class=class
>
{(!is_active)
.then(|| {
view! {
<span class=format!(
"size-4 rounded-full border-2 border-ink {}",
list.color.dot_class(),
) />
<span class=format!("dot {}", list.color.dot_class()) />
}
})}
{list.name.clone()}
@@ -448,7 +439,7 @@ fn ListTabs(
})
.collect_view()}
<button
class="shrink-0 rounded-2xl border-2 border-dashed border-ink/50 px-5 py-3 text-lg font-semibold text-ink/70"
class="tab tab-new"
aria-label="Nouvelle liste"
on:click=move |_| ctx.list_editor.set(Some(ListEditor::New))
>
@@ -469,10 +460,10 @@ fn ErrorBanner() -> impl IntoView {
view! {
<div
role="alert"
class="mt-4 flex items-center justify-between gap-3 rounded-2xl border-2 border-ink bg-pink px-4 py-3 font-medium"
class="alert"
>
<span>{msg}</span>
<button class="font-bold" on:click=move |_| ctx.error.set(None)>
<button on:click=move |_| ctx.error.set(None)>
"OK"
</button>
</div>
@@ -486,10 +477,10 @@ fn ErrorBanner() -> impl IntoView {
fn EmptyState() -> impl IntoView {
let ctx = expect_context::<Ctx>();
view! {
<section class="ticket relative mt-6 bg-paper px-5 pt-6 pb-8 text-center">
<p class="text-lg text-ink/70">"Aucune liste pour l'instant."</p>
<section class="ticket ticket-empty">
<p class="lead">"Aucune liste pour l'instant."</p>
<button
class="tile-shadow mt-4 rounded-2xl border-2 border-ink bg-pink px-5 py-3 font-display font-bold"
class="button button-primary"
on:click=move |_| ctx.list_editor.set(Some(ListEditor::New))
>
"Créer une liste"
@@ -500,7 +491,7 @@ fn EmptyState() -> impl IntoView {
#[component]
fn TicketSkeleton() -> impl IntoView {
view! { <div class="ticket mt-20 h-96 animate-pulse bg-paper/60"></div> }
view! { <div class="ticket ticket-skeleton"></div> }
}
fn remaining_text(remaining: usize, total: usize) -> String {
+61 -85
View File
@@ -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"
+10 -13
View File
@@ -52,10 +52,7 @@ pub fn ItemTile(item: Item) -> impl IntoView {
view! {
<button
class=format!(
"tile-shadow relative flex aspect-square touch-manipulation flex-col items-center gap-1 rounded-2xl border-2 border-ink p-2 pb-2.5 text-center select-none active:translate-y-1 active:shadow-none [-webkit-touch-callout:none] {}",
category.tile_class(),
)
class=format!("tile tile-item {}", category.tile_class())
style:view-transition-name=transition::item_name(id)
aria-label=aria_label
on:click=on_click
@@ -68,13 +65,13 @@ pub fn ItemTile(item: Item) -> impl IntoView {
{badge
.map(|badge| {
view! {
<span class="absolute top-2 right-2 rounded-lg bg-ink px-1.5 py-0.5 font-mono text-xs text-paper">
<span class="tile-badge">
{badge}
</span>
}
})}
<IconSvg icon class="min-h-0 w-full flex-1 text-ink" />
<span class="line-clamp-2 text-[0.95rem] leading-tight font-semibold break-words hyphens-auto">
<IconSvg icon />
<span class="tile-label">
{name}
</span>
</button>
@@ -96,12 +93,12 @@ pub fn SuggestionTile(suggestion: Suggestion, list_id: i64) -> impl IntoView {
view! {
<button
class="relative flex aspect-square flex-col items-center gap-1 rounded-2xl border-2 border-dashed border-ink/35 p-2 pb-2.5 text-center text-ink/55 active:bg-ink/5"
class="tile tile-suggestion"
style:view-transition-name=transition_name
on:click=add
>
<IconSvg icon class="min-h-0 w-full flex-1 opacity-60" />
<span class="line-clamp-2 text-[0.95rem] leading-tight font-semibold">{label}</span>
<IconSvg icon />
<span class="tile-label">{label}</span>
</button>
}
}
@@ -116,13 +113,13 @@ pub fn BasketTile(item: Item) -> impl IntoView {
view! {
<button
class="flex aspect-square flex-col items-center gap-0.5 rounded-2xl bg-mist p-1.5 text-center text-ink/45 active:bg-ink/10"
class="tile tile-off"
style:view-transition-name=transition::item_name(id)
aria-label=aria_label
on:click=move |_| item.with_value(|item| ctx.toggle(item))
>
<IconSvg icon class="min-h-0 w-full flex-1" />
<span class="line-clamp-2 text-xs leading-tight font-medium line-through decoration-ink/30">
<IconSvg icon />
<span class="tile-label">
{name}
</span>
</button>
+1 -1
View File
@@ -228,7 +228,7 @@ impl Category {
}
}
/// Tailwind background class for the item tile.
/// Background class for the item tile (see style/main.css).
pub fn tile_class(self) -> &'static str {
match self {
Category::FruitsLegumes => "bg-lime",