get cargo check --all --examples --tests working!

This commit is contained in:
Jonathan Kelley committed 2024-01-19 15:01:01 -08:00
1 parent 83bce6ce97
commit 337c04557b
18 files changed
+109 -508

No files matched your search

+7
View File
@@ -83,15 +83,19 @@ impl From<&Url> for IntoRoutable {
pub struct LinkProps {
/// A class to apply to the generate HTML anchor tag if the `target` route is active.
pub active_class: Option<String>,
/// The children to render within the generated HTML anchor tag.
pub children: Element,
/// When [`true`], the `target` route will be opened in a new tab.
///
/// This does not change whether the [`Link`] is active or not.
#[props(default)]
pub new_tab: bool,
/// The onclick event handler.
pub onclick: Option<EventHandler<MouseEvent>>,
#[props(default)]
/// Whether the default behavior should be executed if an `onclick` handler is provided.
///
@@ -100,13 +104,16 @@ pub struct LinkProps {
/// will be executed after the links regular functionality.
/// 3. If `onclick_only` is [`true`], only the provided `onclick` handler will be executed.
pub onclick_only: bool,
/// The rel attribute for the generated HTML anchor tag.
///
/// For external `a`s, this defaults to `noopener noreferrer`.
pub rel: Option<String>,
/// The navigation target. Roughly equivalent to the href attribute of an HTML anchor tag.
#[props(into)]
pub to: IntoRoutable,
#[props(extends = GlobalAttributes)]
attributes: Vec<Attribute>,
}
+20 -13
View File
@@ -12,7 +12,7 @@ where
phantom: std::marker::PhantomData,
},
);
let _ = vdom.rebuild();
vdom.rebuild_in_place();
return dioxus_ssr::render(&vdom);
#[derive(Props)]
@@ -20,14 +20,21 @@ where
phantom: std::marker::PhantomData<R>,
}
impl<R: Routable> Clone for AppProps<R> {
fn clone(&self) -> Self {
Self {
phantom: std::marker::PhantomData,
}
}
}
impl<R: Routable> PartialEq for AppProps<R> {
fn eq(&self, _other: &Self) -> bool {
false
}
}
#[component]
fn App<R: Routable>(cx: Scope<AppProps<R>>) -> Element
fn App<R: Routable>(props: AppProps<R>) -> Element
where
<R as FromStr>::Err: std::fmt::Display,
{
@@ -51,7 +58,7 @@ fn href_internal() {
}
#[component]
fn Test(_cx: Scope) -> Element {
fn Test() -> Element {
todo!()
}
@@ -89,7 +96,7 @@ fn href_external() {
}
#[component]
fn Test(_cx: Scope) -> Element {
fn Test() -> Element {
todo!()
}
@@ -127,7 +134,7 @@ fn with_class() {
}
#[component]
fn Test(_cx: Scope) -> Element {
fn Test() -> Element {
todo!()
}
@@ -168,7 +175,7 @@ fn with_active_class_active() {
rsx! {
Link {
to: Route::Root {},
active_class: "active_class",
active_class: "active_class".to_string(),
class: "test_class",
"Link"
}
@@ -199,7 +206,7 @@ fn with_active_class_inactive() {
}
#[component]
fn Test(_cx: Scope) -> Element {
fn Test() -> Element {
todo!()
}
@@ -208,7 +215,7 @@ fn with_active_class_inactive() {
rsx! {
Link {
to: Route::Test {},
active_class: "active_class",
active_class: "active_class".to_string(),
class: "test_class",
"Link"
}
@@ -239,7 +246,7 @@ fn with_id() {
}
#[component]
fn Test(_cx: Scope) -> Element {
fn Test() -> Element {
todo!()
}
@@ -278,7 +285,7 @@ fn with_new_tab() {
}
#[component]
fn Test(_cx: Scope) -> Element {
fn Test() -> Element {
todo!()
}
@@ -349,7 +356,7 @@ fn with_rel() {
}
#[component]
fn Test(_cx: Scope) -> Element {
fn Test() -> Element {
todo!()
}
@@ -358,7 +365,7 @@ fn with_rel() {
rsx! {
Link {
to: Route::Test {},
rel: "test_rel",
rel: "test_rel".to_string(),
"Link"
}
}
+8 -23
View File
@@ -5,7 +5,7 @@ use dioxus_router::prelude::*;
fn prepare(path: impl Into<String>) -> VirtualDom {
let mut vdom = VirtualDom::new_with_props(App, AppProps { path: path.into() });
let _ = vdom.rebuild();
vdom.rebuild_in_place();
return vdom;
#[derive(Routable, Clone)]
@@ -29,18 +29,13 @@ fn prepare(path: impl Into<String>) -> VirtualDom {
ParameterFixed { id: u8 },
}
#[derive(Debug, Props, PartialEq)]
struct AppProps {
path: String,
}
#[component]
fn App(cx: Scope<AppProps>) -> Element {
fn App(path: String) -> Element {
rsx! {
h1 { "App" }
Router::<Route> {
config: {
let path = cx.props.path.parse().unwrap();
let path = path.parse().unwrap();
move || RouterConfig::default().history(MemoryHistory::with_initial_path(path))
}
}
@@ -49,9 +44,7 @@ fn prepare(path: impl Into<String>) -> VirtualDom {
#[component]
fn RootIndex() -> Element {
rsx! {
h2 { "Root Index" }
}
rsx! { h2 { "Root Index" } }
}
#[component]
@@ -64,16 +57,12 @@ fn prepare(path: impl Into<String>) -> VirtualDom {
#[component]
fn FixedIndex() -> Element {
rsx! {
h3 { "Fixed - Index" }
}
rsx! { h3 { "Fixed - Index" } }
}
#[component]
fn FixedFixed() -> Element {
rsx! {
h3 { "Fixed - Fixed"}
}
rsx! { h3 { "Fixed - Fixed"} }
}
#[component]
@@ -86,16 +75,12 @@ fn prepare(path: impl Into<String>) -> VirtualDom {
#[component]
fn ParameterIndex(id: u8) -> Element {
rsx! {
h3 { "Parameter - Index" }
}
rsx! { h3 { "Parameter - Index" } }
}
#[component]
fn ParameterFixed(id: u8) -> Element {
rsx! {
h3 { "Parameter - Fixed" }
}
rsx! { h3 { "Parameter - Fixed" } }
}
}