Fix cargo check on examples

This commit is contained in:
Jonathan Kelley committed 2024-01-30 17:59:57 -08:00
1 parent 0bd9692e45
commit a72c035de4
42 files changed
+95 -145

No files matched your search

+1 -2
View File
@@ -1,7 +1,6 @@
use dioxus::prelude::*;
use std::{collections::VecDeque, fmt::Debug, rc::Rc};
use dioxus::{events::*, html::MouseEvent, prelude::*};
fn main() {
launch(app);
}
+1 -1
View File
@@ -32,7 +32,7 @@ fn app() -> Element {
let mut input_operator = move |key: &str| val.write().push_str(key);
let mut handle_key_down_event = move |evt: KeyboardEvent| match evt.key() {
let handle_key_down_event = move |evt: KeyboardEvent| match evt.key() {
Key::Backspace => {
if !val().is_empty() {
val.write().pop();
-1
View File
@@ -1,4 +1,3 @@
use dioxus::desktop::{tao::dpi::LogicalSize, Config, WindowBuilder};
use dioxus::prelude::*;
use dioxus::router::prelude::*;
+1 -1
View File
@@ -7,7 +7,7 @@ fn main() {
fn app() -> Element {
let mut value = use_signal(|| 0);
let mut depth = use_signal(|| 0 as usize);
let mut items = use_memo(move || (0..depth()).map(|f| f as _).collect::<Vec<isize>>());
let items = use_memo(move || (0..depth()).map(|f| f as _).collect::<Vec<isize>>());
let state = use_memo(move || value() + 1);
+1 -1
View File
@@ -2,7 +2,7 @@ use dioxus::desktop::{tao::dpi::PhysicalPosition, LogicalSize, WindowBuilder};
use dioxus::prelude::*;
fn main() {
LaunchBuilder::desktop().with_cfg(make_config());
LaunchBuilder::desktop().with_cfg(make_config()).launch(app);
}
fn app() -> Element {
+9 -7
View File
@@ -4,9 +4,10 @@ use std::rc::Rc;
use dioxus::{html::geometry::euclid::Rect, prelude::*};
fn main() {
LaunchBuilder::desktop().with_cfg(
dioxus::desktop::Config::default().with_custom_head(
r#"
LaunchBuilder::desktop()
.with_cfg(
dioxus::desktop::Config::default().with_custom_head(
r#"
<style type="text/css">
html, body {
height: 100%;
@@ -19,16 +20,17 @@ fn main() {
}
</style>
"#
.to_owned(),
),
);
.to_owned(),
),
)
.launch(app);
}
fn app() -> Element {
let mut div_element = use_signal(|| None as Option<Rc<MountedData>>);
let mut dimensions = use_signal(Rect::zero);
let mut read_dims = move |_| async move {
let read_dims = move |_| async move {
let read = div_element.read();
let client_rect = read.as_ref().map(|el| el.get_client_rect());
if let Some(client_rect) = client_rect {
+1 -1
View File
@@ -39,7 +39,7 @@ fn app() -> Element {
});
// use_resource will spawn a future that resolves to a value - essentially an async memo
let slow_count = use_resource(move || async move {
let _slow_count = use_resource(move || async move {
tokio::time::sleep(Duration::from_millis(200)).await;
count() * 2
});
+1 -1
View File
@@ -1,7 +1,7 @@
use dioxus::prelude::*;
fn main() {
let mut dom = VirtualDom::prebuilt(app);
let dom = VirtualDom::prebuilt(app);
let html = dioxus_ssr::render(&dom);
println!("{}", html);
+1 -1
View File
@@ -15,7 +15,7 @@ fn app() -> Element {
};
}
let mut items = use_memo(move || (0..depth()).map(|f| f as _).collect::<Vec<isize>>());
let items = use_memo(move || (0..depth()).map(|f| f as _).collect::<Vec<isize>>());
rsx! {
button { onclick: move |_| state += 1, "Increment" }
+1 -1
View File
@@ -35,7 +35,7 @@ fn Dice() -> Element {
svg {
view_box: "-1000 -1000 2000 2000",
prevent_default: "onclick",
onclick: move |e| value.set(thread_rng().gen_range(1..=6)),
onclick: move |_| value.set(thread_rng().gen_range(1..=6)),
rect { x: -1000, y: -1000, width: 2000, height: 2000, rx: 200, fill: "#aaa" }
for ((x, y), _) in DOTS.iter().zip(active_dots.read().iter()).filter(|(_, &active)| active) {
circle {
+2 -2
View File
@@ -25,7 +25,7 @@ const STYLE: &str = include_str!("./assets/todomvc.css");
fn app() -> Element {
let mut todos = use_signal(|| HashMap::<u32, TodoItem>::new());
let mut filter = use_signal(|| FilterState::All);
let filter = use_signal(|| FilterState::All);
let active_todo_count =
use_memo(move || todos.read().values().filter(|item| !item.checked).count());
@@ -47,7 +47,7 @@ fn app() -> Element {
filtered_todos
});
let mut toggle_all = move |_| {
let toggle_all = move |_| {
let check = active_todo_count() != 0;
for (_, item) in todos.write().iter_mut() {
item.checked = check;