diff --git a/packages/dioxus-tui/examples/all_events.rs b/packages/dioxus-tui/examples/all_terminal_events.rs similarity index 100% rename from packages/dioxus-tui/examples/all_events.rs rename to packages/dioxus-tui/examples/all_terminal_events.rs diff --git a/packages/dioxus-tui/examples/components.rs b/packages/dioxus-tui/examples/components.rs deleted file mode 100644 index 45ed56338..000000000 --- a/packages/dioxus-tui/examples/components.rs +++ /dev/null @@ -1,67 +0,0 @@ -#![allow(non_snake_case)] - -use dioxus::prelude::*; -use dioxus_tui::Config; - -fn main() { - dioxus_tui::launch_cfg(app, Config::default()); -} - -#[derive(Props, PartialEq)] -struct QuadrentProps { - color: String, - text: String, -} - -fn Quadrant(cx: Scope) -> Element { - cx.render(rsx! { - div { - border_width: "1px", - width: "50%", - height: "100%", - background_color: "{cx.props.color}", - justify_content: "center", - align_items: "center", - - "{cx.props.text}" - } - }) -} - -fn app(cx: Scope) -> Element { - cx.render(rsx! { - div { - width: "100%", - height: "100%", - flex_direction: "column", - - div { - width: "100%", - height: "50%", - flex_direction: "row", - Quadrant{ - color: "red".to_string(), - text: "[A]".to_string() - }, - Quadrant{ - color: "black".to_string(), - text: "[B]".to_string() - } - } - - div { - width: "100%", - height: "50%", - flex_direction: "row", - Quadrant{ - color: "green".to_string(), - text: "[C]".to_string() - }, - Quadrant{ - color: "blue".to_string(), - text: "[D]".to_string() - } - } - } - }) -} diff --git a/packages/dioxus-tui/examples/stress.rs b/packages/dioxus-tui/examples/many_small_edit_stress.rs similarity index 100% rename from packages/dioxus-tui/examples/stress.rs rename to packages/dioxus-tui/examples/many_small_edit_stress.rs diff --git a/packages/dioxus-tui/examples/quadrants.rs b/packages/dioxus-tui/examples/quadrants.rs index d9da5dcb5..45ed56338 100644 --- a/packages/dioxus-tui/examples/quadrants.rs +++ b/packages/dioxus-tui/examples/quadrants.rs @@ -1,7 +1,31 @@ +#![allow(non_snake_case)] + use dioxus::prelude::*; +use dioxus_tui::Config; fn main() { - dioxus_tui::launch(app); + dioxus_tui::launch_cfg(app, Config::default()); +} + +#[derive(Props, PartialEq)] +struct QuadrentProps { + color: String, + text: String, +} + +fn Quadrant(cx: Scope) -> Element { + cx.render(rsx! { + div { + border_width: "1px", + width: "50%", + height: "100%", + background_color: "{cx.props.color}", + justify_content: "center", + align_items: "center", + + "{cx.props.text}" + } + }) } fn app(cx: Scope) -> Element { @@ -15,22 +39,13 @@ fn app(cx: Scope) -> Element { width: "100%", height: "50%", flex_direction: "row", - div { - border_width: "1px", - width: "50%", - height: "100%", - background_color: "red", - justify_content: "center", - align_items: "center", - "[A]" - } - div { - width: "50%", - height: "100%", - background_color: "black", - justify_content: "center", - align_items: "center", - "[B]" + Quadrant{ + color: "red".to_string(), + text: "[A]".to_string() + }, + Quadrant{ + color: "black".to_string(), + text: "[B]".to_string() } } @@ -38,21 +53,13 @@ fn app(cx: Scope) -> Element { width: "100%", height: "50%", flex_direction: "row", - div { - width: "50%", - height: "100%", - background_color: "green", - justify_content: "center", - align_items: "center", - "[C]" - } - div { - width: "50%", - height: "100%", - background_color: "blue", - justify_content: "center", - align_items: "center", - "[D]" + Quadrant{ + color: "green".to_string(), + text: "[C]".to_string() + }, + Quadrant{ + color: "blue".to_string(), + text: "[D]".to_string() } } } diff --git a/packages/dioxus-tui/examples/readme.rs b/packages/dioxus-tui/examples/readme_hello_world.rs similarity index 100% rename from packages/dioxus-tui/examples/readme.rs rename to packages/dioxus-tui/examples/readme_hello_world.rs diff --git a/packages/native-core/src/tree.rs b/packages/native-core/src/tree.rs index df25deac3..e0c55eece 100644 --- a/packages/native-core/src/tree.rs +++ b/packages/native-core/src/tree.rs @@ -178,7 +178,7 @@ impl<'a> TreeMut for TreeMutView<'a> { fn set_height(tree: &mut TreeMutView<'_>, node: NodeId, height: u16) { let children = { let mut node_data_mut = &mut tree.1; - let mut node = (&mut node_data_mut).get(node).unwrap(); + let node = (&mut node_data_mut).get(node).unwrap(); node.height = height; node.children.clone() }; diff --git a/packages/rink/examples/counter.rs b/packages/rink/examples/counter_button.rs similarity index 100% rename from packages/rink/examples/counter.rs rename to packages/rink/examples/counter_button.rs diff --git a/packages/rink/src/widget.rs b/packages/rink/src/widget.rs index 7c6645692..ab9044998 100644 --- a/packages/rink/src/widget.rs +++ b/packages/rink/src/widget.rs @@ -26,7 +26,7 @@ impl<'a> RinkBuffer<'a> { // panic!("({x}, {y}) is not in {area:?}"); return; } - let mut cell = self.buf.get_mut(x, y); + let cell = self.buf.get_mut(x, y); cell.bg = convert(self.cfg.rendering_mode, new.bg.blend(cell.bg)); if new.symbol.is_empty() { if !cell.symbol.is_empty() { diff --git a/packages/router/examples/simple.rs b/packages/router/examples/simple_routes.rs similarity index 100% rename from packages/router/examples/simple.rs rename to packages/router/examples/simple_routes.rs