|
|
|
@ -8,6 +8,7 @@ use leptos::{ev::SubmitEvent, html::Input, *};
|
|
|
|
|
use strum_macros::IntoStaticStr;
|
|
|
|
|
use wasm_bindgen::{JsCast, JsValue};
|
|
|
|
|
use web_sys::File;
|
|
|
|
|
use class_list::class_list;
|
|
|
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
|
struct ResultMessageData {
|
|
|
|
@ -17,6 +18,7 @@ struct ResultMessageData {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Default, Clone, Copy, IntoStaticStr)]
|
|
|
|
|
#[allow(dead_code)]
|
|
|
|
|
enum Colorway {
|
|
|
|
|
#[default]
|
|
|
|
|
#[strum(serialize = "plain")]
|
|
|
|
@ -33,17 +35,12 @@ enum Colorway {
|
|
|
|
|
|
|
|
|
|
#[component]
|
|
|
|
|
fn ResultMessage(cx: Scope, message: ReadSignal<Option<ResultMessageData>>) -> impl IntoView {
|
|
|
|
|
view! { cx,
|
|
|
|
|
<Show when=move || message().is_some() fallback=move |_| {}>
|
|
|
|
|
<div class=move || {
|
|
|
|
|
let colorway_str: &str = message().unwrap().colorway.into();
|
|
|
|
|
colorway_str.to_owned() + " box"
|
|
|
|
|
}>
|
|
|
|
|
<h3>{move || message().unwrap().title}</h3>
|
|
|
|
|
<p>{move || message().unwrap().message}</p>
|
|
|
|
|
</div>
|
|
|
|
|
</Show>
|
|
|
|
|
}
|
|
|
|
|
move || message().map(|ResultMessageData { title, message, colorway }| view! { cx,
|
|
|
|
|
<div class=class_list!["box", <Colorway as Into<&str>>::into(colorway)]>
|
|
|
|
|
<h3>{title}</h3>
|
|
|
|
|
<p>{message}</p>
|
|
|
|
|
</div>
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(From, IntoStaticStr)]
|
|
|
|
|