Compare commits
No commits in common. "f37ebd04453963c36b5f647b53b868f32474cb00" and "49028baec7c47d6144dc920aed894ad372606980" have entirely different histories.
f37ebd0445
...
49028baec7
11 changed files with 118 additions and 128 deletions
90
Cargo.lock
generated
90
Cargo.lock
generated
|
@ -66,6 +66,7 @@ checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca"
|
||||||
name = "app"
|
name = "app"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"femark",
|
||||||
"http 1.0.0",
|
"http 1.0.0",
|
||||||
"leptos",
|
"leptos",
|
||||||
"leptos_axum",
|
"leptos_axum",
|
||||||
|
@ -74,6 +75,7 @@ dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"sqlx",
|
"sqlx",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
|
"toml 0.8.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -974,7 +976,7 @@ dependencies = [
|
||||||
"futures-sink",
|
"futures-sink",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"http 1.0.0",
|
"http 1.0.0",
|
||||||
"indexmap 2.2.2",
|
"indexmap 2.2.1",
|
||||||
"slab",
|
"slab",
|
||||||
"tokio",
|
"tokio",
|
||||||
"tokio-util",
|
"tokio-util",
|
||||||
|
@ -1176,11 +1178,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hyper-util"
|
name = "hyper-util"
|
||||||
version = "0.1.3"
|
version = "0.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa"
|
checksum = "bdea9aac0dbe5a9240d68cfd9501e2db94222c6dc06843e06640b9e07f0fdc67"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytes",
|
"bytes",
|
||||||
|
"futures-channel",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"http 1.0.0",
|
"http 1.0.0",
|
||||||
"http-body",
|
"http-body",
|
||||||
|
@ -1188,6 +1191,7 @@ dependencies = [
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"socket2",
|
"socket2",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
"tracing",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -1224,9 +1228,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "2.2.2"
|
version = "2.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520"
|
checksum = "433de089bd45971eecf4668ee0ee8f4cec17db4f8bd8f7bc3197a6ce37aa7d9b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"hashbrown 0.14.3",
|
"hashbrown 0.14.3",
|
||||||
|
@ -1288,9 +1292,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos"
|
name = "leptos"
|
||||||
version = "0.6.5"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0c115de7c6fca2164133e18328777d02c371434ace38049ac02886b5cffd22dc"
|
checksum = "13156caccc40bb71d687bed455b7d644ac69ecb5a5c180c2809ba52df863a99a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"leptos_config",
|
"leptos_config",
|
||||||
|
@ -1310,9 +1314,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_axum"
|
name = "leptos_axum"
|
||||||
version = "0.6.5"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "933ce9f409dd29ce429eb457f928d1cb48ebd39386d2dfe2f78d366e78cf7842"
|
checksum = "47756bd25127a3cc5eb33535cafe7199d669fffd5f12d2a9a37757b7399556c9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
@ -1334,9 +1338,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_config"
|
name = "leptos_config"
|
||||||
version = "0.6.5"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "055262ff3660e95ec95cadd8a05a02070d624354e08e30b99c14a81023feb2dc"
|
checksum = "99cee343145b16836df6847d7da0db6f7f0a3f53f860e6b771bdeebb6da7f0ed"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"config",
|
"config",
|
||||||
"regex",
|
"regex",
|
||||||
|
@ -1347,9 +1351,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_dom"
|
name = "leptos_dom"
|
||||||
version = "0.6.5"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "adfea7feb9c488448db466ca0673b691ec2a05efb0b2bc6626b7248ee04bb39c"
|
checksum = "bf6c02444169c390660bb8975adf064daf3f24f40b2d3f25618e5c0bbbe89cb5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-recursion",
|
"async-recursion",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
@ -1357,7 +1361,7 @@ dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
"getrandom",
|
"getrandom",
|
||||||
"html-escape",
|
"html-escape",
|
||||||
"indexmap 2.2.2",
|
"indexmap 2.2.1",
|
||||||
"itertools",
|
"itertools",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"leptos_reactive",
|
"leptos_reactive",
|
||||||
|
@ -1377,13 +1381,13 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_hot_reload"
|
name = "leptos_hot_reload"
|
||||||
version = "0.6.5"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3ba8f68f7c3135975eb34ed19210272ebef2d6f422d138ff87a726b8793fe105"
|
checksum = "11bf126e9ac0597cda4156f14dea23627d90d53ade182a537b234b7e131e0096"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"camino",
|
"camino",
|
||||||
"indexmap 2.2.2",
|
"indexmap 2.2.1",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
|
@ -1395,9 +1399,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_integration_utils"
|
name = "leptos_integration_utils"
|
||||||
version = "0.6.5"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "700bdb6d9d754964b576fa3b76a28a68adbd6ced6d7dc84a18e29e91a82c2376"
|
checksum = "55eb3cbc78aa67790799ef480270bef3d10e23f0a38e6fa3e4e42d797f931a13"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
"leptos",
|
"leptos",
|
||||||
|
@ -1409,9 +1413,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_macro"
|
name = "leptos_macro"
|
||||||
version = "0.6.5"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "039c510dafb7d9997e4b8accfcced5675fabc65720caf544592df32432d6d65a"
|
checksum = "b859592ff768b01122733ac03a72507849e7ea2f640c63bb1c3487a5dc7a0891"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"attribute-derive",
|
"attribute-derive",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
@ -1432,12 +1436,12 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_meta"
|
name = "leptos_meta"
|
||||||
version = "0.6.5"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4bbbbd77839b4d3189c06319b32aaa3bc43510fb43f9c1bffb8e124a33decd6c"
|
checksum = "4705c24a835c3e8a158a351fee971d9efb0060a9817f719a79e22666dd112558"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"indexmap 2.2.2",
|
"indexmap 2.2.1",
|
||||||
"leptos",
|
"leptos",
|
||||||
"tracing",
|
"tracing",
|
||||||
"wasm-bindgen",
|
"wasm-bindgen",
|
||||||
|
@ -1446,14 +1450,14 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_reactive"
|
name = "leptos_reactive"
|
||||||
version = "0.6.5"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b30c5bc7f3496d6ba399578171cf133c50d2172f9791fe292db4da2fd0d8cec4"
|
checksum = "4c5f08f2392b01cc5fc9223eeb92c70b40d366354ffbfb1c6761c9e621a8f966"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"futures",
|
"futures",
|
||||||
"indexmap 2.2.2",
|
"indexmap 2.2.1",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"paste",
|
"paste",
|
||||||
"pin-project",
|
"pin-project",
|
||||||
|
@ -1474,9 +1478,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_router"
|
name = "leptos_router"
|
||||||
version = "0.6.5"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "498159479603569e1d7c969cffa0817b73249e96f825c295743f8f4607a68cbe"
|
checksum = "28334116fab9b903b31c8f6d2be254e86dd35265db6e0c0f5cfbc7b6c18ea0ef"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cached",
|
"cached",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
@ -1506,9 +1510,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "leptos_server"
|
name = "leptos_server"
|
||||||
version = "0.6.5"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f06b9b860479385991fad54cbee372382aee3c1e75ca78b5da6f8bda90c153e1"
|
checksum = "4d6baa84d07a5869261e1dc606058886f1a79d6bf89b7b138cf25bae30983b76"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"inventory",
|
"inventory",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
|
@ -1522,9 +1526,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.153"
|
version = "0.2.152"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
|
checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libm"
|
name = "libm"
|
||||||
|
@ -2428,9 +2432,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "server_fn"
|
name = "server_fn"
|
||||||
version = "0.6.5"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "97fab54d9dd2d7e9eba4efccac41d2ec3e7c6e9973d14c0486d662a32662320c"
|
checksum = "f27208122b0fa6d2b90b7dc25de60294e28647efd43b4c8abaf7df86227931a5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
@ -2463,9 +2467,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "server_fn_macro"
|
name = "server_fn_macro"
|
||||||
version = "0.6.5"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3be6011b586a0665546b7ced372b0be690d9e005d3f8524795da2843274d7720"
|
checksum = "a8d7a5a1c0f78f261dbb8cf16281020552a1d518dbcb8501b33b8edae02b781b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"const_format",
|
"const_format",
|
||||||
"convert_case",
|
"convert_case",
|
||||||
|
@ -2477,9 +2481,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "server_fn_macro_default"
|
name = "server_fn_macro_default"
|
||||||
version = "0.6.5"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "752ed78ec49132d154b922cf5ab6485680cab039a75740c48ea2db621ad481da"
|
checksum = "29d13a68cc5b1ff8a3259e3ae984b91559268f0e5a7a8b0216f55b05307df5cb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"server_fn_macro",
|
"server_fn_macro",
|
||||||
"syn 2.0.48",
|
"syn 2.0.48",
|
||||||
|
@ -2648,7 +2652,7 @@ dependencies = [
|
||||||
"futures-util",
|
"futures-util",
|
||||||
"hashlink",
|
"hashlink",
|
||||||
"hex",
|
"hex",
|
||||||
"indexmap 2.2.2",
|
"indexmap 2.2.1",
|
||||||
"log",
|
"log",
|
||||||
"memchr",
|
"memchr",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
|
@ -3022,7 +3026,7 @@ version = "0.21.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1"
|
checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap 2.2.2",
|
"indexmap 2.2.1",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_spanned",
|
"serde_spanned",
|
||||||
"toml_datetime",
|
"toml_datetime",
|
||||||
|
@ -3662,9 +3666,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winnow"
|
name = "winnow"
|
||||||
version = "0.5.36"
|
version = "0.5.35"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "818ce546a11a9986bc24f93d0cdf38a8a1a400f1473ea8c82e59f6e0ffab9249"
|
checksum = "1931d78a9c73861da0134f453bb1f790ce49b2e30eba8410b4b79bac72b46a2d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
|
@ -12,6 +12,8 @@ leptos_axum = { workspace = true, optional = true }
|
||||||
http.workspace = true
|
http.workspace = true
|
||||||
thiserror.workspace = true
|
thiserror.workspace = true
|
||||||
serde = { version = "1" }
|
serde = { version = "1" }
|
||||||
|
femark = { version = "0.1.5", optional = true }
|
||||||
|
toml = { version = "0.8.8", optional = true }
|
||||||
sqlx = { version = "0.7", features = [
|
sqlx = { version = "0.7", features = [
|
||||||
"runtime-tokio-rustls",
|
"runtime-tokio-rustls",
|
||||||
"sqlite",
|
"sqlite",
|
||||||
|
@ -25,5 +27,10 @@ ssr = [
|
||||||
"leptos_meta/ssr",
|
"leptos_meta/ssr",
|
||||||
"leptos_router/ssr",
|
"leptos_router/ssr",
|
||||||
"dep:leptos_axum",
|
"dep:leptos_axum",
|
||||||
|
"dep:femark",
|
||||||
|
"dep:toml",
|
||||||
"dep:sqlx",
|
"dep:sqlx",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[package.metadata.cargo-all-features]
|
||||||
|
denylist = ["femark"]
|
||||||
|
|
|
@ -1,21 +1,17 @@
|
||||||
use crate::components::ui::articles::*;
|
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
use crate::components::ui::articles::Article;
|
||||||
|
|
||||||
#[server]
|
#[server]
|
||||||
pub async fn get_articles(article_type: ArticleType) -> Result<Vec<Article>, ServerFnError> {
|
pub async fn get_blog_posts() -> Result<Vec<Article>, ServerFnError> {
|
||||||
use sqlx::*;
|
use sqlx::*;
|
||||||
let query = match article_type {
|
|
||||||
ArticleType::All => "select * from blog order by date",
|
|
||||||
ArticleType::Blog => "select * from blog where content_type like 'blog'",
|
|
||||||
ArticleType::Game => "select * from blog where content_type like 'game'",
|
|
||||||
ArticleType::Project => "select * from blog where content_type like 'project'",
|
|
||||||
};
|
|
||||||
|
|
||||||
let pool: SqlitePool = use_context::<SqlitePool>().expect("couldn't get pool context");
|
let pool: SqlitePool = use_context::<SqlitePool>().expect("couldn't get pool context");
|
||||||
|
|
||||||
let result = sqlx::query_as::<_, Article>(query)
|
let result =
|
||||||
|
sqlx::query_as::<_, Article>("select * from blog where content_type like 'game'")
|
||||||
.fetch_all(&pool)
|
.fetch_all(&pool)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::components::api::*;
|
|
||||||
use crate::components::ui::containers::*;
|
use crate::components::ui::containers::*;
|
||||||
|
use crate::components::api::*;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use serde::*;
|
use serde::*;
|
||||||
|
|
||||||
|
@ -12,14 +12,6 @@ pub struct Article {
|
||||||
pub content: String,
|
pub content: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
|
||||||
pub enum ArticleType {
|
|
||||||
All,
|
|
||||||
Blog,
|
|
||||||
Game,
|
|
||||||
Project,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Article(data: Article) -> impl IntoView {
|
pub fn Article(data: Article) -> impl IntoView {
|
||||||
view! {
|
view! {
|
||||||
|
@ -37,9 +29,12 @@ pub fn Article(data: Article) -> impl IntoView {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn ArticleBuilder(article_type: ArticleType) -> impl IntoView {
|
pub fn ArticleBuilder() -> impl IntoView {
|
||||||
let data_resource =
|
let data_resource = create_local_resource(
|
||||||
create_local_resource(|| (), move |_| async move { get_articles(article_type).await });
|
|| (),
|
||||||
|
|_| async move { get_blog_posts().await },
|
||||||
|
// |_| async move { slingshot("./public/blog".to_string()).await },
|
||||||
|
);
|
||||||
|
|
||||||
let articles_view = move || {
|
let articles_view = move || {
|
||||||
data_resource.and_then(|data| {
|
data_resource.and_then(|data| {
|
||||||
|
|
|
@ -1,21 +1,17 @@
|
||||||
use crate::components::ui::articles::*;
|
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
|
||||||
use crate::components::api::get_articles;
|
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn Card(data: Article) -> impl IntoView {
|
pub fn Card(children: Children) -> impl IntoView {
|
||||||
view! {
|
view! {
|
||||||
<div class="p-7 my-5 mx-2 w-80 rounded-lg shadow-inner min-w-3/12 max-w-3/12 bg-zinc-900 shadow-zinc-950">
|
<div class="p-7 my-5 mx-2 w-80 rounded-lg shadow-inner min-w-3/12 max-w-3/12 bg-zinc-900 shadow-zinc-950">
|
||||||
<h1 class="text-2xl font-light text-orange-600 max-6-xs">
|
<h1 class="text-2xl font-light text-orange-600 max-6-xs">
|
||||||
{&data.title}
|
"Card Header"
|
||||||
</h1>
|
</h1>
|
||||||
<hr class="opacity-50"/>
|
<hr class="opacity-50"/>
|
||||||
<span class="pt-0 pb-3.5 text-xs opacity-50 m-t">{&data.date}</span>
|
|
||||||
<p class="text-center">
|
<p class="text-center">
|
||||||
"[image]"
|
"[image]"
|
||||||
</p>
|
</p>
|
||||||
<div inner_html=&data.content></div>
|
{children()}
|
||||||
<p class="text-right">
|
<p class="text-right">
|
||||||
<a class="text-orange-300 hover:underline" href="https://lickmysa.cc" >Read more...</a>
|
<a class="text-orange-300 hover:underline" href="https://lickmysa.cc" >Read more...</a>
|
||||||
</p>
|
</p>
|
||||||
|
@ -24,22 +20,6 @@ pub fn Card(data: Article) -> impl IntoView {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn CardBuilder(article_type: ArticleType) -> impl IntoView {
|
pub fn CardHolder(children: Children) -> impl IntoView {
|
||||||
let data_resource = create_local_resource(
|
view! { <div class="flex flex-wrap place-content-evenly mx-auto w-11/12">{children()}</div> }
|
||||||
|| (),
|
|
||||||
move |_| async move { get_articles(article_type).await },
|
|
||||||
);
|
|
||||||
|
|
||||||
let cards_view = move || {
|
|
||||||
data_resource.and_then(|data| {
|
|
||||||
data.iter()
|
|
||||||
.map(|article| view! {<Card data=article.clone()/> })
|
|
||||||
.collect_view()
|
|
||||||
})
|
|
||||||
};
|
|
||||||
view! {
|
|
||||||
<div class="flex flex-wrap place-content-evenly mx-auto max-w-8/12">
|
|
||||||
{cards_view}
|
|
||||||
</div>
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ pub mod components;
|
||||||
pub mod error_template;
|
pub mod error_template;
|
||||||
pub mod routes;
|
pub mod routes;
|
||||||
|
|
||||||
use crate::routes::{blog::Blog, games::Games, home::Home, projects::Projects};
|
use crate::routes::{blog::Blog, home::Home, projects::Projects};
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
pub fn App() -> impl IntoView {
|
pub fn App() -> impl IntoView {
|
||||||
|
@ -38,9 +38,6 @@ pub fn App() -> impl IntoView {
|
||||||
<li>
|
<li>
|
||||||
<A href="/projects">"Projects"</A>
|
<A href="/projects">"Projects"</A>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
|
||||||
<A href="/games">"Games"</A>
|
|
||||||
</li>
|
|
||||||
<li>
|
<li>
|
||||||
<a href="https://git.doordesk.net">"Git"</a>
|
<a href="https://git.doordesk.net">"Git"</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -51,7 +48,6 @@ pub fn App() -> impl IntoView {
|
||||||
<Route path="" view=Home/>
|
<Route path="" view=Home/>
|
||||||
<Route path="blog" view=Blog/>
|
<Route path="blog" view=Blog/>
|
||||||
<Route path="projects" view=Projects/>
|
<Route path="projects" view=Projects/>
|
||||||
<Route path="games" view=Games/>
|
|
||||||
</Routes>
|
</Routes>
|
||||||
</main>
|
</main>
|
||||||
<p class="m-auto w-8 text-center duration-200 hover:rotate-180">
|
<p class="m-auto w-8 text-center duration-200 hover:rotate-180">
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
pub mod blog;
|
|
||||||
pub mod games;
|
|
||||||
pub mod home;
|
pub mod home;
|
||||||
|
pub mod blog;
|
||||||
pub mod projects;
|
pub mod projects;
|
||||||
|
|
|
@ -12,7 +12,7 @@ pub fn Blog() -> impl IntoView {
|
||||||
<ErrorBoundary fallback=|errors| {
|
<ErrorBoundary fallback=|errors| {
|
||||||
view! { <ErrorTemplate errors=errors/> }
|
view! { <ErrorTemplate errors=errors/> }
|
||||||
}>
|
}>
|
||||||
<ArticleBuilder article_type={ArticleType::Blog} />
|
<ArticleBuilder/>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
use crate::components::ui::articles::*;
|
|
||||||
use crate::components::ui::cards::*;
|
|
||||||
use crate::error_template::*;
|
|
||||||
use leptos::*;
|
|
||||||
|
|
||||||
#[island]
|
|
||||||
pub fn Games() -> impl IntoView {
|
|
||||||
|
|
||||||
view! {
|
|
||||||
<Suspense fallback=move || {
|
|
||||||
view! { <p>"Loading..."</p> }
|
|
||||||
}>
|
|
||||||
<ErrorBoundary fallback=|errors| {
|
|
||||||
view! { <ErrorTemplate errors=errors/> }
|
|
||||||
}>
|
|
||||||
<CardBuilder article_type={ArticleType::Game} />
|
|
||||||
</ErrorBoundary>
|
|
||||||
</Suspense>
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +1,9 @@
|
||||||
use crate::components::ui::articles::*;
|
|
||||||
use crate::components::ui::cards::*;
|
use crate::components::ui::cards::*;
|
||||||
use crate::error_template::*;
|
use crate::error_template::*;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
|
||||||
#[island]
|
#[component]
|
||||||
pub fn Home() -> impl IntoView {
|
pub fn Home() -> impl IntoView {
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<Suspense fallback=move || {
|
<Suspense fallback=move || {
|
||||||
view! { <p>"Loading..."</p> }
|
view! { <p>"Loading..."</p> }
|
||||||
|
@ -13,8 +11,26 @@ pub fn Home() -> impl IntoView {
|
||||||
<ErrorBoundary fallback=|errors| {
|
<ErrorBoundary fallback=|errors| {
|
||||||
view! { <ErrorTemplate errors=errors/> }
|
view! { <ErrorTemplate errors=errors/> }
|
||||||
}>
|
}>
|
||||||
<CardBuilder article_type={ArticleType::Game} />
|
<h1>Latest Stuff or whatever</h1>
|
||||||
<ArticleBuilder article_type={ArticleType::All} />
|
|
||||||
|
<CardHolder>
|
||||||
|
<Card>
|
||||||
|
<p>{"home1"}</p>
|
||||||
|
</Card>
|
||||||
|
<Card>
|
||||||
|
<p>{"home2"}</p>
|
||||||
|
</Card>
|
||||||
|
<Card>
|
||||||
|
<p>{"home3"}</p>
|
||||||
|
</Card>
|
||||||
|
<Card>
|
||||||
|
<p>{"home4"}</p>
|
||||||
|
</Card>
|
||||||
|
<Card>
|
||||||
|
<p>{"home5"}</p>
|
||||||
|
</Card>
|
||||||
|
</CardHolder>
|
||||||
|
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
use crate::components::ui::articles::*;
|
use crate::components::ui::cards::*;
|
||||||
use crate::error_template::*;
|
use crate::error_template::*;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
|
||||||
#[island]
|
#[component]
|
||||||
pub fn Projects() -> impl IntoView {
|
pub fn Projects() -> impl IntoView {
|
||||||
|
|
||||||
view! {
|
view! {
|
||||||
<Suspense fallback=move || {
|
<Suspense fallback=move || {
|
||||||
view! { <p>"Loading..."</p> }
|
view! { <p>"Loading..."</p> }
|
||||||
|
@ -12,7 +11,25 @@ pub fn Projects() -> impl IntoView {
|
||||||
<ErrorBoundary fallback=|errors| {
|
<ErrorBoundary fallback=|errors| {
|
||||||
view! { <ErrorTemplate errors=errors/> }
|
view! { <ErrorTemplate errors=errors/> }
|
||||||
}>
|
}>
|
||||||
<ArticleBuilder article_type={ArticleType::Project} />
|
|
||||||
|
<CardHolder>
|
||||||
|
<Card>
|
||||||
|
<p>{"project1"}</p>
|
||||||
|
</Card>
|
||||||
|
<Card>
|
||||||
|
<p>{"project2"}</p>
|
||||||
|
</Card>
|
||||||
|
<Card>
|
||||||
|
<p>{"project3"}</p>
|
||||||
|
</Card>
|
||||||
|
<Card>
|
||||||
|
<p>{"project4"}</p>
|
||||||
|
</Card>
|
||||||
|
<Card>
|
||||||
|
<p>{"project5"}</p>
|
||||||
|
</Card>
|
||||||
|
</CardHolder>
|
||||||
|
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue