From e58fca9fa6badd535265949f8046474f2e532b55 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Mon, 21 Aug 2023 15:05:21 -0700 Subject: [PATCH] Add close button to result component --- dyesub-tool/index.html | 1 + dyesub-tool/src/main.rs | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/dyesub-tool/index.html b/dyesub-tool/index.html index c84ca76..a8e7770 100644 --- a/dyesub-tool/index.html +++ b/dyesub-tool/index.html @@ -5,6 +5,7 @@ dyesub-tool +
diff --git a/dyesub-tool/src/main.rs b/dyesub-tool/src/main.rs index e756c60..f4fd3b1 100644 --- a/dyesub-tool/src/main.rs +++ b/dyesub-tool/src/main.rs @@ -35,12 +35,22 @@ enum Colorway { #[component] fn ResultMessage(cx: Scope, message: ReadSignal>) -> impl IntoView { - move || message().map(|ResultMessageData { title, message, colorway }| view! { cx, -
>::into(colorway)]> -

{title}

-

{message}

-
- }) + let (open, set_open) = create_signal(cx, true); + create_effect(cx, move |_| { + message.track(); + set_open(true); + }); + move || view! { cx, + + {move || message().map(|ResultMessageData { title, message, colorway }| view! { cx, +
>::into(colorway)] style="position: relative"> + {title} + +

{message}

+
+ })} +
+ } } #[derive(From, IntoStaticStr)]