Router skeleton

This commit is contained in:
Greg Johnston 2022-08-05 07:53:04 -04:00
parent 2981af66e8
commit fd6a84b5f4
3 changed files with 50 additions and 0 deletions

13
leptos_router/Cargo.toml Normal file
View file

@ -0,0 +1,13 @@
[package]
name = "leptos_router"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
leptos_core = { path = "../leptos_core" }
leptos_dom = { path = "../leptos_dom"}
leptos_macro = { path = "../leptos_macro"}
leptos_reactive = { path = "../leptos_reactive"}
serde = "1"

View file

@ -0,0 +1,34 @@
use leptos_core as leptos;
use leptos_dom::IntoChild;
use leptos_macro::{component, Props};
use leptos_reactive::Scope;
use serde::{de::DeserializeOwned, Serialize};
pub struct RouterProps<C, D>
where
C: for<'a> IntoChild<'a>,
D: Serialize + DeserializeOwned + 'static,
{
base: Option<String>,
data: Option<Box<dyn Fn() -> D>>,
children: C,
}
pub fn Router<C, D>(cx: Scope, props: RouterProps<C, D>)
where
C: for<'a> IntoChild<'a>,
D: Serialize + DeserializeOwned + 'static,
{
}
/* pub fn Router = (props: RouterProps) => {
const { source, url, base, data, out } = props;
const integration =
source || (isServer ? staticIntegration({ value: url || "" }) : pathIntegration());
const routerState = createRouterContext(integration, base, data, out);
return (
<RouterContextObj.Provider value={routerState}>{props.children}</RouterContextObj.Provider>
);
};
*/

3
leptos_router/src/lib.rs Normal file
View file

@ -0,0 +1,3 @@
mod components;
pub use components::*;