diff --git a/src/main.rs b/src/main.rs index 638f6f4..e6884f6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -44,9 +44,8 @@ async fn main() -> io::Result<()> { async fn welcome() -> impl IntoResponse { let fact = views::get_cat_fact().await; - Html(ssr::render(move || { - leptos::view! { } - })) + + views::askama::WelcomeTemplate { fact } } async fn log_source( diff --git a/src/views/askama.rs b/src/views/askama.rs new file mode 100644 index 0000000..6ba4069 --- /dev/null +++ b/src/views/askama.rs @@ -0,0 +1,13 @@ +use askama_axum::Template; + +#[derive(Template)] +#[template(path = "welcome.html")] +pub struct WelcomeTemplate { + pub fact: String, +} + +impl WelcomeTemplate { + pub fn new(fact: String) -> WelcomeTemplate { + WelcomeTemplate { fact } + } +} diff --git a/src/views/mod.rs b/src/views/mod.rs index d4c6e42..62533d7 100644 --- a/src/views/mod.rs +++ b/src/views/mod.rs @@ -1,13 +1,12 @@ use futures::TryFutureExt; use serde::Deserialize; +pub mod askama; pub mod base_page; pub mod links; -pub mod welcome; pub use base_page::*; pub use links::*; -pub use welcome::*; #[derive(Debug, Deserialize)] pub struct CatFact { diff --git a/src/views/welcome.rs b/src/views/welcome.rs deleted file mode 100644 index 025c7b5..0000000 --- a/src/views/welcome.rs +++ /dev/null @@ -1,49 +0,0 @@ -use leptos::{component, view, IntoView}; - -use crate::HtmxPage; - -// {https://api.thecatapi.com/v1/images/search?size=small&format=src} -// {https://cataas.com/cat?width=250&height=250} -#[component] -pub fn WelcomePage(fact: String) -> impl IntoView { - view! { - -
- -
-
- } -} - -#[component] -pub fn WelcomeView(fact: String) -> impl IntoView { - view! { -
-
- -
- - - - -

{fact}

- -
- + + + + +

NyaZoom2

+ {% block content %}{% endblock %} + + diff --git a/templates/welcome.html b/templates/welcome.html new file mode 100644 index 0000000..551328d --- /dev/null +++ b/templates/welcome.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} + +{% block content %} +
+
+
+ +
+ + + + +

{{ fact }}

+ +
+ +
+{% endblock content %}