chore: clean up docs with changes to templates
This commit is contained in:
1 parent
f075a519cc
commit
a252774226
18 files changed
+34
-399
No files matched your search
@@ -26,7 +26,7 @@ struct ClickableProps<'a> {
|
||||
// ANCHOR: Clickable
|
||||
fn Clickable<'a>(cx: Scope<'a, ClickableProps<'a>>) -> Element {
|
||||
match cx.props.children {
|
||||
Some(VNode::Text(_)) => {
|
||||
Ok(VNode { dynamic_nodes, .. }) => {
|
||||
todo!("render some stuff")
|
||||
}
|
||||
_ => {
|
||||
|
||||
@@ -48,7 +48,7 @@ fn LogIn<'a>(
|
||||
fn LogInWarning(cx: Scope, is_logged_in: bool) -> Element {
|
||||
// ANCHOR: conditional_none
|
||||
if *is_logged_in {
|
||||
return None;
|
||||
return cx.render(rsx!(()));
|
||||
}
|
||||
|
||||
cx.render(rsx! {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use dioxus::events::MouseData;
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
@@ -20,7 +19,7 @@ fn App(cx: Scope) -> Element {
|
||||
// ANCHOR: component_with_handler
|
||||
#[derive(Props)]
|
||||
pub struct FancyButtonProps<'a> {
|
||||
on_click: EventHandler<'a, MouseData>,
|
||||
on_click: EventHandler<'a, MouseEvent>,
|
||||
}
|
||||
|
||||
pub fn FancyButton<'a>(cx: Scope<'a, FancyButtonProps<'a>>) -> Element<'a> {
|
||||
|
||||
@@ -14,7 +14,7 @@ fn App(cx: Scope) -> Element {
|
||||
button {
|
||||
onclick: move |event| {
|
||||
// now, outer won't be triggered
|
||||
event.cancel_bubble();
|
||||
event.stop_propogation();
|
||||
},
|
||||
"inner"
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ fn App(cx: Scope) -> Element {
|
||||
background_color: "red",
|
||||
justify_content: "center",
|
||||
align_items: "center",
|
||||
onkeydown: move |k: KeyboardEvent| if let KeyCode::Q = k.data.key_code {
|
||||
onkeydown: move |k: KeyboardEvent| if let KeyCode::Q = k.key_code {
|
||||
tui_ctx.quit();
|
||||
},
|
||||
|
||||
|
||||
@@ -63,5 +63,5 @@ fn App(cx: Scope) -> Element {
|
||||
}
|
||||
// ANCHOR_END: loop
|
||||
|
||||
None
|
||||
cx.render(rsx!(()))
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
// ANCHOR: all
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use dioxus::events::FormData;
|
||||
use dioxus::prelude::*;
|
||||
|
||||
fn main() {
|
||||
@@ -83,7 +82,7 @@ fn Meme<'a>(cx: Scope<'a>, caption: &'a str) -> Element<'a> {
|
||||
fn CaptionEditor<'a>(
|
||||
cx: Scope<'a>,
|
||||
caption: &'a str,
|
||||
on_input: EventHandler<'a, FormData>,
|
||||
on_input: EventHandler<'a, FormEvent>,
|
||||
) -> Element<'a> {
|
||||
let input_style = r"
|
||||
border: none;
|
||||
|
||||
@@ -150,7 +150,7 @@ fn Meme<'a>(cx: Scope<'a>, caption: &'a str) -> Element<'a> {
|
||||
fn CaptionEditor<'a>(
|
||||
cx: Scope<'a>,
|
||||
caption: &'a str,
|
||||
on_input: EventHandler<'a, FormData>,
|
||||
on_input: EventHandler<'a, FormEvent>,
|
||||
) -> Element<'a> {
|
||||
let is_dark_mode = use_is_dark_mode(cx);
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ pub fn Expression(cx: Scope) -> Element {
|
||||
// ANCHOR: expression
|
||||
let text = "Dioxus";
|
||||
cx.render(rsx!(span {
|
||||
[text.to_uppercase()]
|
||||
text.to_uppercase()
|
||||
}))
|
||||
// ANCHOR_END: expression
|
||||
}
|
||||
@@ -58,7 +58,7 @@ pub fn Tokio(cx: Scope) -> Element {
|
||||
// ANCHOR_END: tokio
|
||||
};
|
||||
|
||||
None
|
||||
cx.render(rsx!(()))
|
||||
}
|
||||
|
||||
pub fn ToOwnedMacro(cx: Scope) -> Element {
|
||||
@@ -69,7 +69,7 @@ pub fn ToOwnedMacro(cx: Scope) -> Element {
|
||||
|
||||
let _ = || {
|
||||
// ANCHOR: to_owned_macro
|
||||
use dioxus::core::to_owned;
|
||||
use dioxus::hooks::to_owned;
|
||||
|
||||
cx.spawn({
|
||||
to_owned![count, age, name, description];
|
||||
@@ -80,5 +80,5 @@ pub fn ToOwnedMacro(cx: Scope) -> Element {
|
||||
// ANCHOR_END: to_owned_macro
|
||||
};
|
||||
|
||||
None
|
||||
cx.render(rsx!(()))
|
||||
}
|
||||
@@ -56,5 +56,5 @@ fn RandomDog(cx: Scope, breed: String) -> Element {
|
||||
});
|
||||
// ANCHOR_END: dependency
|
||||
|
||||
None
|
||||
cx.render(rsx!(()))
|
||||
}
|
||||
Reference in new issue
Block a user