main
Elnu 1 year ago
parent 127639355f
commit ff53f33d56

@ -3,12 +3,12 @@
mod render; mod render;
pub mod svg; pub mod svg;
use class_list::class_list;
use derive_more::From; use derive_more::From;
use leptos::{ev::SubmitEvent, html::Input, *}; use leptos::{ev::SubmitEvent, html::Input, *};
use strum_macros::IntoStaticStr; use strum_macros::IntoStaticStr;
use wasm_bindgen::{JsCast, JsValue}; use wasm_bindgen::{JsCast, JsValue};
use web_sys::File; use web_sys::File;
use class_list::class_list;
#[derive(Clone)] #[derive(Clone)]
struct ResultMessageData { struct ResultMessageData {
@ -40,16 +40,18 @@ fn ResultMessage(cx: Scope, message: ReadSignal<Option<ResultMessageData>>) -> i
message.track(); message.track();
set_open(true); set_open(true);
}); });
move || view! { cx, move || {
<Show when=move || open() fallback=|_| ()> view! { cx,
{move || message().map(|ResultMessageData { title, message, colorway }| view! { cx, <Show when=move || open() fallback=|_| ()>
<div class=class_list!["box", <Colorway as Into<&str>>::into(colorway)] style="position: relative"> {move || message().map(|ResultMessageData { title, message, colorway }| view! { cx,
<strong class="block titlebar">{title}</strong> <div class=class_list!["box", <Colorway as Into<&str>>::into(colorway)] style="position: relative">
<button class="iconbutton" on:click=move |_| set_open(false) style="position: absolute; bottom: 0.5em; right: 0.5em">"×"</button> <strong class="block titlebar">{title}</strong>
<p>{message}</p> <button class="iconbutton" on:click=move |_| set_open(false) style="position: absolute; bottom: 0.5em; right: 0.5em">"×"</button>
</div> <p>{message}</p>
})} </div>
</Show> })}
</Show>
}
} }
} }
@ -130,7 +132,7 @@ fn KeyboardFromFile(
colorway: Colorway::Bad, colorway: Colorway::Bad,
})); }));
file_input().unwrap().set_value(""); file_input().unwrap().set_value("");
}, }
} }
}); });
}; };

Loading…
Cancel
Save