2022-07-07 08:50:36 +00:00
|
|
|
// ANCHOR: all
|
|
|
|
#![allow(non_snake_case)]
|
|
|
|
use dioxus::prelude::*;
|
|
|
|
|
|
|
|
fn main() {
|
2022-07-09 19:15:20 +00:00
|
|
|
dioxus_desktop::launch(App);
|
2022-07-07 08:50:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn App(cx: Scope) -> Element {
|
|
|
|
// ANCHOR: Clickable_usage
|
|
|
|
cx.render(rsx! {
|
|
|
|
Clickable {
|
|
|
|
href: "https://www.youtube.com/watch?v=C-M2hs3sXGo",
|
|
|
|
"How to " i {"not"} " be seen"
|
|
|
|
}
|
|
|
|
})
|
|
|
|
// ANCHOR_END: Clickable_usage
|
|
|
|
}
|
|
|
|
|
|
|
|
// ANCHOR: Clickable
|
|
|
|
#[derive(Props)]
|
|
|
|
struct ClickableProps<'a> {
|
|
|
|
href: &'a str,
|
|
|
|
children: Element<'a>,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn Clickable<'a>(cx: Scope<'a, ClickableProps<'a>>) -> Element {
|
|
|
|
cx.render(rsx!(
|
|
|
|
a {
|
|
|
|
href: "{cx.props.href}",
|
|
|
|
class: "fancy-button",
|
|
|
|
&cx.props.children
|
|
|
|
}
|
|
|
|
))
|
|
|
|
}
|
|
|
|
// ANCHOR_END: Clickable
|