mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
Router skeleton
This commit is contained in:
parent
2981af66e8
commit
fd6a84b5f4
3 changed files with 50 additions and 0 deletions
13
leptos_router/Cargo.toml
Normal file
13
leptos_router/Cargo.toml
Normal 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"
|
34
leptos_router/src/components.rs
Normal file
34
leptos_router/src/components.rs
Normal 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
3
leptos_router/src/lib.rs
Normal file
|
@ -0,0 +1,3 @@
|
|||
mod components;
|
||||
|
||||
pub use components::*;
|
Loading…
Reference in a new issue