Feat: building large apps, revamp macro
This commit is contained in:
1 parent
5791e49700
commit
9f7f43b661
20 files changed
+386
-293
No files matched your search
@@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "dioxus-docs-site"
|
||||
version = "0.0.0"
|
||||
authors = ["Jonathan Kelley <jkelleyrtp@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
dioxus-ssr = { path = "../ssr" }
|
||||
@@ -0,0 +1,10 @@
|
||||
# Dioxus docs site
|
||||
|
||||
Generate the liveview site powering diouxslabs.com.
|
||||
|
||||
We use the dioxus SSR crate and the use_router hook to generate a
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Whitespace-only changes.
@@ -0,0 +1,82 @@
|
||||
use dioxus_ssr::{prelude::*, TextRenderer};
|
||||
|
||||
fn main() {
|
||||
TextRenderer::new(App);
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
enum Routes {
|
||||
Homepage,
|
||||
ExampleList,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Props)]
|
||||
struct AppProps {
|
||||
route: Routes,
|
||||
}
|
||||
|
||||
trait Blah {}
|
||||
impl<'a, G> Blah for LazyNodes<'a, G> where G: for<'b> FnOnce(&'b NodeCtx<'a>) -> VNode<'a> + 'a {}
|
||||
|
||||
static App: FC<AppProps> = |ctx, props| {
|
||||
//
|
||||
let body = match props.route {
|
||||
Routes::Homepage => ctx.render(rsx!(
|
||||
div {
|
||||
Homepage {}
|
||||
}
|
||||
)),
|
||||
Routes::ExampleList => ctx.render(rsx!(
|
||||
div {
|
||||
ExampleList {}
|
||||
}
|
||||
)),
|
||||
};
|
||||
|
||||
ctx.render(rsx!(
|
||||
div {
|
||||
Header {}
|
||||
{body}
|
||||
{
|
||||
}
|
||||
Footer {}
|
||||
}
|
||||
))
|
||||
};
|
||||
|
||||
#[derive(Debug, PartialEq, Props)]
|
||||
struct HeaderProp {
|
||||
selected: Routes,
|
||||
}
|
||||
|
||||
static Header: FC<()> = |ctx, _| {
|
||||
ctx.render(rsx! {
|
||||
div {
|
||||
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
static Footer: FC<()> = |ctx, _| {
|
||||
ctx.render(rsx! {
|
||||
div {
|
||||
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
static Homepage: FC<()> = |ctx, _| {
|
||||
ctx.render(rsx! {
|
||||
div {
|
||||
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
static ExampleList: FC<()> = |ctx, _| {
|
||||
ctx.render(rsx! {
|
||||
div {
|
||||
|
||||
}
|
||||
})
|
||||
};
|
||||
Reference in new issue
Block a user