chore: clean up examples and fix link opening code

This commit is contained in:
Jonathan Kelley committed 2022-01-31 19:40:48 -05:00
1 parent cc99fa8eb2
commit 6905bf98d7
7 files changed
+28 -31

No files matched your search

-5
View File
@@ -18,11 +18,6 @@ fn app(cx: Scope) -> Element {
disabled: "{disabled}",
"lower button"
}
input {
value: "false",
}
}
})
}
+2 -2
View File
@@ -16,7 +16,7 @@ struct ListBreeds {
}
fn app(cx: Scope) -> Element {
let fut = use_future(&cx, || async move {
let breeds = use_future(&cx, || async move {
reqwest::get("https://dog.ceo/api/breeds/list/all")
.await
.unwrap()
@@ -26,7 +26,7 @@ fn app(cx: Scope) -> Element {
let (breed, set_breed) = use_state(&cx, || None);
match fut.value() {
match breeds.value() {
Some(Ok(breeds)) => cx.render(rsx! {
div {
h1 {"Select a dog breed!"}
-1
View File
@@ -56,7 +56,6 @@ fn app(cx: Scope) -> Element {
)
})
}
})
}
+1 -1
View File
@@ -4,7 +4,7 @@ fn main() {
dioxus::desktop::launch_with_props(app, (), |c| {
c.with_file_drop_handler(|_w, e| {
println!("{:?}", e);
false
true
})
});
}
+2 -2
View File
@@ -17,9 +17,9 @@ impl Label {
fn new_list(num: usize) -> Vec<Self> {
let mut rng = SmallRng::from_entropy();
let mut labels = Vec::with_capacity(num);
for _ in 0..num {
for x in 0..num {
labels.push(Label {
key: 0,
key: x,
labels: [
ADJECTIVES.choose(&mut rng).unwrap(),
COLOURS.choose(&mut rng).unwrap(),