* Create a minimalistic toast

* Profile editing (WIP)
This commit is contained in:
Greg Burri 2024-12-04 17:39:56 +01:00
parent 327b2d0a5b
commit 1c79cc890d
25 changed files with 1133 additions and 575 deletions

20
frontend/src/toast.rs Normal file
View file

@ -0,0 +1,20 @@
use gloo::{console::log, timers::callback::Timeout};
use web_sys::{console, Document, HtmlInputElement};
pub enum Level {
Success,
Error,
Info,
Warning,
}
pub fn show(level: Level, message: &str, doc: Document) {
let toast_element = doc.get_element_by_id("toast").unwrap();
toast_element.set_inner_html(message);
toast_element.set_class_name("show");
Timeout::new(4_000, move || {
toast_element.set_class_name("");
})
.forget();
}