2022-03-09 18:36:30 +00:00
|
|
|
#![allow(non_snake_case)]
|
|
|
|
|
2022-02-04 13:24:02 +00:00
|
|
|
use dioxus::prelude::*;
|
|
|
|
|
|
|
|
fn main() {
|
2022-03-09 18:36:30 +00:00
|
|
|
dioxus::tui::launch(app);
|
2022-02-04 13:24:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[derive(Props, PartialEq)]
|
|
|
|
struct QuadrentProps {
|
|
|
|
color: String,
|
2022-02-04 22:57:00 +00:00
|
|
|
text: String,
|
2022-02-04 13:24:02 +00:00
|
|
|
}
|
|
|
|
|
2022-03-09 18:36:30 +00:00
|
|
|
fn Quadrant(cx: Scope<QuadrentProps>) -> Element {
|
2022-02-04 13:24:02 +00:00
|
|
|
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",
|
2022-03-09 18:36:30 +00:00
|
|
|
Quadrant{
|
2022-02-04 13:24:02 +00:00
|
|
|
color: "red".to_string(),
|
|
|
|
text: "[A]".to_string()
|
|
|
|
},
|
2022-03-09 18:36:30 +00:00
|
|
|
Quadrant{
|
2022-02-04 13:24:02 +00:00
|
|
|
color: "black".to_string(),
|
|
|
|
text: "[B]".to_string()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
div {
|
|
|
|
width: "100%",
|
|
|
|
height: "50%",
|
|
|
|
flex_direction: "row",
|
2022-03-09 18:36:30 +00:00
|
|
|
Quadrant{
|
2022-02-04 13:24:02 +00:00
|
|
|
color: "green".to_string(),
|
|
|
|
text: "[C]".to_string()
|
|
|
|
},
|
2022-03-09 18:36:30 +00:00
|
|
|
Quadrant{
|
2022-02-04 13:24:02 +00:00
|
|
|
color: "blue".to_string(),
|
|
|
|
text: "[D]".to_string()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|