Added Markdown file conversion. Changed some Cargo params to keep rust-analyzer from freaking out. Updated build.rs to not panic when 'npx' isn't in the path.
This commit is contained in:
parent
cd13cbbc1e
commit
686e591f21
14
Cargo.toml
14
Cargo.toml
@ -10,9 +10,15 @@ members = [
|
|||||||
"rust-letter-be",
|
"rust-letter-be",
|
||||||
]
|
]
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
[workspace.dependencies]
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
rust-letter-be = { path = "./rust-letter-be" }
|
|
||||||
rocket = "=0.5.0-rc.3"
|
rocket = "=0.5.0-rc.3"
|
||||||
tokio = "1.27.0"
|
tokio = "1.27.0"
|
||||||
|
dioxus = "0.3.2"
|
||||||
|
markdown = "1.0.0-alpha.7"
|
||||||
|
dioxus-ssr = "0.3.0"
|
||||||
|
log = "0.4.6"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
[dependencies]
|
||||||
|
rust-letter-be = { path = "./rust-letter-be" }
|
||||||
|
rocket = { workspace = true }
|
16
data/poem.md
Normal file
16
data/poem.md
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
You are important. I wrote a small poem I hope will help you today.\
|
||||||
|
It's not very long, but I'm doing my best, and so are you.
|
||||||
|
|
||||||
|
You are the moon, you are the stars\
|
||||||
|
Im glad you're here, whomever you are.\
|
||||||
|
We've been through much; in this life it's true,\
|
||||||
|
But in the end, you will come through.
|
||||||
|
|
||||||
|
Much like life, this poem is short\
|
||||||
|
It doesn't always rhyme, or have a nice beat;\
|
||||||
|
It might seem wrong, or incomplete;\
|
||||||
|
It might go on, or so it seems;\
|
||||||
|
It might feel like you're in a dream.
|
||||||
|
|
||||||
|
That's not the point, I know in my heart\
|
||||||
|
I'm glad you're here, whomever you are.
|
@ -6,13 +6,13 @@ edition = "2021"
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rust-letter-fe = { path = "../rust-letter-fe" }
|
rust-letter-fe = { path = "../rust-letter-fe" }
|
||||||
dioxus-ssr = "0.3.0"
|
dioxus-ssr = { workspace = true }
|
||||||
log = "0.4.6"
|
log = { workspace = true }
|
||||||
|
|
||||||
# If you're unsure about why we're depending on a release candidate,
|
# If you're unsure about why we're depending on a release candidate,
|
||||||
# check the Rocket documentation:
|
# check the Rocket documentation:
|
||||||
# https://rocket.rs/v0.5-rc/guide/upgrading/
|
# https://rocket.rs/v0.5-rc/guide/upgrading/
|
||||||
rocket = "=0.5.0-rc.3"
|
rocket = { workspace = true }
|
||||||
|
|
||||||
# Needed to enable handlebar template support
|
# Needed to enable handlebar template support
|
||||||
[dependencies.rocket_dyn_templates]
|
[dependencies.rocket_dyn_templates]
|
||||||
|
@ -5,10 +5,8 @@ authors = ["Ada Werefox <ada.werefox@tutanota.com>"]
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
dioxus = "0.3.2"
|
dioxus = { workspace = true }
|
||||||
|
markdown = { workspace = true }
|
||||||
# Only need these when we're using this crate as a dev server
|
|
||||||
[target.'cfg(target_family = "wasm")'.dependencies]
|
|
||||||
dioxus-web = "0.3.1"
|
dioxus-web = "0.3.1"
|
||||||
dioxus-autofmt = "0.3.0"
|
dioxus-autofmt = "0.3.0"
|
||||||
# WebAssembly Debug
|
# WebAssembly Debug
|
||||||
|
@ -5,5 +5,11 @@ fn main() {
|
|||||||
.split(" "),
|
.split(" "),
|
||||||
);
|
);
|
||||||
tailwind.env("NODE_ENV", "production");
|
tailwind.env("NODE_ENV", "production");
|
||||||
tailwind.spawn().unwrap();
|
match tailwind.spawn() {
|
||||||
|
Ok(_) => (),
|
||||||
|
Err(_) => {
|
||||||
|
print!("Didn't find npx in the path, can't compile CSS. Is Node installed?");
|
||||||
|
()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,8 @@ pub mod web_app {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn MakePoem(cx: Scope) -> Element {
|
fn MakePoem(cx: Scope) -> Element {
|
||||||
let poem = include_str!("../../data/poem.txt").split("\n\n");
|
let poem_str = include_str!("../../data/poem.md");
|
||||||
|
let poem = markdown::to_html(poem_str);
|
||||||
|
|
||||||
cx.render(rsx!(
|
cx.render(rsx!(
|
||||||
div {
|
div {
|
||||||
@ -61,15 +62,7 @@ pub mod web_app {
|
|||||||
},
|
},
|
||||||
div {
|
div {
|
||||||
class: "font-nerd flex flex-col space-y-4 mx-4 py-4",
|
class: "font-nerd flex flex-col space-y-4 mx-4 py-4",
|
||||||
poem.map(|phrase| rsx!(
|
dangerous_inner_html: "{poem}",
|
||||||
div {
|
|
||||||
phrase.lines().map(|line| rsx!(
|
|
||||||
p {
|
|
||||||
line
|
|
||||||
}
|
|
||||||
))
|
|
||||||
}
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use rust_letter_fe::web_app;
|
|
||||||
use dioxus_web;
|
|
||||||
use console_error_panic_hook;
|
use console_error_panic_hook;
|
||||||
|
use dioxus_web::{self, Config};
|
||||||
|
use rust_letter_fe::web_app::{self, VirtualDom};
|
||||||
use wasm_logger;
|
use wasm_logger;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user