Modal dialog improvement.

main
Josef Rokos 2 years ago
parent 9f17393310
commit df247b3ed1

1042
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -20,6 +20,10 @@ serde = { version = "1", features = ["derive"] }
wasm-bindgen = "=0.2.87"
web-sys = { version = "0.3.61", features = ["Navigator"] }
lazy_static = "1.4.0"
chrono = "0.4.26"
sqlx = { version = "0.7.1", optional = true, features = ["runtime-tokio-rustls", "postgres", "chrono", "rust_decimal"] }
rust_decimal = "1.31.0"
uuid = {version = "1.4.1", features = ["v4"]}
[features]
csr = ["leptos/csr", "leptos_meta/csr", "leptos_router/csr"]
@ -29,6 +33,7 @@ ssr = [
"dep:actix-web",
"dep:leptos_actix",
"dep:actix-session",
"dep:sqlx",
"leptos/ssr",
"leptos_meta/ssr",
"leptos_router/ssr",

@ -20,7 +20,7 @@ pub fn HomePage(cx: Scope) -> impl IntoView {
view! { cx,
<ModalDialog opener={dialog} title="Titulek".to_string()>
<ModalDialog opener={dialog} title="Titulek">
<ModalBody>
<div class="row">
<div class="col mb-3">

@ -8,7 +8,9 @@ lazy_static! {
("cs", HashMap::from( [
("Dashboard", "Přehled"),
("Settings", "Nastavení"),
("Search...", "Najít...")
("Search...", "Najít..."),
("Close", "Zavřít"),
("Save changes", "Uložit změny")
])),
("sk", HashMap::from( [
("Dashboard", "Prehlad"),

@ -1,4 +1,4 @@
use std::rc::Rc;
use crate::locales::trl;
use leptos::*;
#[derive(Copy, Clone)]
@ -21,11 +21,11 @@ impl DialogOpener {
}
pub fn show(&self) {
self.set_visible.update(|state| { *state = true});
self.set_visible.update(|state| *state = true);
}
pub fn hide(&self) {
self.set_visible.update(|state| { *state = false});
self.set_visible.update(|state| *state = false);
}
}
@ -33,10 +33,9 @@ impl DialogOpener {
pub fn ModalDialog(
cx: Scope,
opener: DialogOpener,
title: String,
title: &'static str,
children: Children,
) -> impl IntoView {
view! {cx,
<div class={ move || if opener.visible() {"modal fade show"} else {"modal fade"}}
style={ move || if opener.visible() {"display: block;"} else {""}}
@ -44,7 +43,7 @@ pub fn ModalDialog(
<div class="modal-dialog modal-dialog-centered" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="modalCenterTitle">{title}</h5>
<h5 class="modal-title" id="modalCenterTitle">{trl(cx, title)}</h5>
<button
type="button"
class="btn-close"
@ -75,4 +74,4 @@ pub fn ModalFooter(cx: Scope, children: Children) -> impl IntoView {
{children(cx)}
</div>
}
}
}

Loading…
Cancel
Save