Refactor ruin_app, add some README files, minor usability in reactivity
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use ruin_app::prelude::*;
|
||||
use ruin_app::{PartialTextStyle, prelude::*};
|
||||
use ruin_ui::{BoxShadow, BoxShadowKind, Point};
|
||||
|
||||
#[ruin_runtime::async_main]
|
||||
@@ -34,8 +34,14 @@ fn CounterApp(title: &'static str) -> impl IntoView {
|
||||
move || format!("{title} ({})", count.get())
|
||||
});
|
||||
|
||||
let text_style = PartialTextStyle {
|
||||
color: Some(Color::BLACK),
|
||||
weight: Some(FontWeight::Bold),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
view! {
|
||||
column(gap = 16.0, padding = 24.0) {
|
||||
column(gap = 16.0, padding = 24.0, text_style = text_style) {
|
||||
text(role = TextRole::Heading(1), size = 32.0, weight = FontWeight::Semibold, color = Color::rgba(0, 0, 0, 255)) {
|
||||
title
|
||||
}
|
||||
@@ -63,7 +69,6 @@ fn CounterActions(count: Signal<i32>) -> impl IntoView {
|
||||
row(gap = 16.0) {
|
||||
button(
|
||||
background = Color::rgba(255, 255, 255, 90),
|
||||
color = Color::rgba(0, 0, 0, 255),
|
||||
on_press = {
|
||||
let count = count.clone();
|
||||
move |_| {
|
||||
@@ -71,12 +76,11 @@ fn CounterActions(count: Signal<i32>) -> impl IntoView {
|
||||
}
|
||||
},
|
||||
) {
|
||||
"-1"
|
||||
text(selectable = false, pointer_events = false) { "-1" }
|
||||
}
|
||||
|
||||
button(
|
||||
background = Color::rgba(255, 255, 255, 90),
|
||||
color = Color::rgba(0, 0, 0, 255),
|
||||
on_press = {
|
||||
let count = count.clone();
|
||||
move |_| {
|
||||
@@ -84,12 +88,11 @@ fn CounterActions(count: Signal<i32>) -> impl IntoView {
|
||||
}
|
||||
},
|
||||
) {
|
||||
"Reset"
|
||||
text(selectable = false, pointer_events = false) { "Reset" }
|
||||
}
|
||||
|
||||
button(
|
||||
background = Color::rgba(255, 255, 255, 90),
|
||||
color = Color::rgba(0, 0, 0, 255),
|
||||
on_press = {
|
||||
let count = count.clone();
|
||||
move |_| {
|
||||
@@ -97,7 +100,7 @@ fn CounterActions(count: Signal<i32>) -> impl IntoView {
|
||||
}
|
||||
},
|
||||
) {
|
||||
"+1"
|
||||
text(selectable = false, pointer_events = false) { "+1" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user