Files
athome/src/impressum.rs
2025-02-07 01:38:24 +01:00

60 lines
1.7 KiB
Rust

use dioxus::prelude::*;
use dioxus_i18n::t;
use crate::components::{H1, HR, P};
#[component]
pub fn Impressum() -> Element {
let mut impressum = use_signal(Vec::<String>::new);
let mut contact = use_signal(Vec::<String>::new);
rsx! {
div {
div {
class: "flex flex-col items-center",
button {
onclick: move |_| async move {
if let Ok(data) = get_impressum().await {
impressum.set(data.clone());
}
if let Ok(data) = get_contact().await {
contact.set(data.clone());
}
},
H1 { { t!("impressum_on") } },
},
},
div {
class: "flex flex-col items-center",
for line in impressum() {
P { {line} }
}
}
if !impressum.read().is_empty() { HR{} },
div {
class: "flex flex-col items-center",
for line in contact() {
P { {line} }
}
}
}
}
}
#[server(GetServerData)]
async fn get_impressum() -> Result<Vec<String>, ServerFnError> {
Ok(vec![
"Tuan-Dat Tran".to_string(),
"c/o AutorenServices.de".to_string(),
"Birkenallee 24".to_string(),
"36037 Fulda".to_string(),
])
}
async fn get_contact() -> Result<Vec<String>, ServerFnError> {
Ok(vec![
"tuan-dat.tran(at)tudattr(dot)dev".to_string(),
"+49 17(six) 83(four)683(eight)8".to_string(),
])
}