Feat: dioxus frontend crate
This commit is contained in:
1 parent
6c1205e91b
commit
4d7ac5bb5d
13 files changed
+465
-15
No files matched your search
+16
-1
@@ -9,14 +9,21 @@ edition = "2018"
|
||||
[dependencies]
|
||||
fern = { version = "0.6.0", features = ["colored"] }
|
||||
log = "0.4.1"
|
||||
dioxus-core = { path = "../packages/core" }
|
||||
dioxus = { path = "../packages/dioxus" }
|
||||
rand = "0.8.2"
|
||||
|
||||
|
||||
[dev-dependencies]
|
||||
# For the tide ssr examples
|
||||
async-std = { version = "1.9.0", features = ["attributes"] }
|
||||
tide = { version = "0.15.0" }
|
||||
|
||||
# For the doc generator
|
||||
pulldown-cmark = { version = "0.8.0", default-features = false }
|
||||
|
||||
|
||||
anyhow = "*"
|
||||
|
||||
|
||||
[lib]
|
||||
path = "common.rs"
|
||||
@@ -28,3 +35,11 @@ name = "hello"
|
||||
[[example]]
|
||||
path = "tide_ssr.rs"
|
||||
name = "tide_ssr"
|
||||
|
||||
[[example]]
|
||||
path = "doc_generator.rs"
|
||||
name = "doc_generator"
|
||||
|
||||
[[example]]
|
||||
path = "router.rs"
|
||||
name = "router"
|
||||
@@ -0,0 +1,57 @@
|
||||
//! The docs generator takes in the `docs` folder and creates a neat, statically-renderer webpage.
|
||||
//! These docs are used to generate the public-facing doc content, showcasing Dioxus' abiltity to
|
||||
//! be used in custom static rendering pipelines.
|
||||
//!
|
||||
//! We use pulldown_cmark as the markdown parser, but instead of outputting html directly, we output
|
||||
//! VNodes to be used in conjuction with our custom templates.
|
||||
|
||||
use dioxus::core::prelude::*;
|
||||
use pulldown_cmark::{Options, Parser};
|
||||
|
||||
fn main() {
|
||||
let gen_dir = "../docs/";
|
||||
|
||||
let site: FC<()> = |_| {
|
||||
html! {
|
||||
<html>
|
||||
|
||||
<head>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
static Homepage: FC<()> = |_| {
|
||||
html! {<div> </div>}
|
||||
};
|
||||
|
||||
static DocPage: FC<()> = |_| {
|
||||
html! {<div> </div>}
|
||||
};
|
||||
|
||||
// struct StaticSiteCfg {
|
||||
// gen_dir: &'static str,
|
||||
// homepage_template: fn() -> VNode,
|
||||
// page_template: fn(page: &'static str) -> VNode,
|
||||
// }
|
||||
|
||||
// impl StaticSiteCfg {
|
||||
// fn render(self) -> anyhow::Result<VNode> {
|
||||
// let StaticSiteCfg { .. } = self;
|
||||
|
||||
// // Set up options and parser. Strikethroughs are not part of the CommonMark standard
|
||||
// // and we therefore must enable it explicitly.
|
||||
// let mut options = Options::empty();
|
||||
// options.insert(Options::ENABLE_STRIKETHROUGH);
|
||||
// let parser = Parser::new_ext(markdown_input, options);
|
||||
|
||||
// //
|
||||
|
||||
// Ok(html! {<div> </div>})
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,9 @@
|
||||
//! Dioxus Router
|
||||
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
let mut app = App::new();
|
||||
|
||||
// app.at(c)
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
//! Server-side-renderered webpages are a great use of Rust's async story, where servers can handle
|
||||
//! thousands of simultaneous clients on minimal hardware.
|
||||
|
||||
use dioxus_core::prelude::*;
|
||||
use dioxus::prelude::*;
|
||||
use tide::{Request, Response};
|
||||
|
||||
#[async_std::main]
|
||||
|
||||
Reference in new issue
Block a user