Merge origin/main into macos
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use ruin_app::prelude::*;
|
||||
use ruin_app::{PartialTextStyle, prelude::*};
|
||||
use ruin_ui::{BoxShadow, BoxShadowKind, Point};
|
||||
use tracing_subscriber::EnvFilter;
|
||||
|
||||
#[ruin_runtime::async_main]
|
||||
@@ -18,6 +19,8 @@ async fn main() -> ruin_app::Result<()> {
|
||||
Window::new()
|
||||
.title(title)
|
||||
.app_id("dev.ruin.counter")
|
||||
.base_color(Color::rgba(255, 255, 255, 80))
|
||||
.min_size(320.0, 240.0)
|
||||
.size(960.0, 640.0),
|
||||
)
|
||||
.mount(view! {
|
||||
@@ -40,9 +43,15 @@ 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) {
|
||||
text(role = TextRole::Heading(1), size = 32.0, weight = FontWeight::Semibold) {
|
||||
column(gap = 16.0, padding = 24.0, align_items = AlignItems::Center, text_style = text_style) {
|
||||
text(role = TextRole::Heading(1), size = 32.0, weight = FontWeight::Semibold, color = Color::rgba(0, 0, 0, 255)) {
|
||||
title
|
||||
}
|
||||
|
||||
@@ -51,12 +60,14 @@ fn CounterApp(title: &'static str) -> impl IntoView {
|
||||
block(
|
||||
padding = 16.0,
|
||||
gap = 8.0,
|
||||
background = surfaces::raised(),
|
||||
align_self = AlignItems::Stretch,
|
||||
background = Color::rgba(255, 255, 255, 200),
|
||||
border_radius = 12.0,
|
||||
border = Border::new(2.0, Color::rgb(0, 0, 0))
|
||||
border = Border::new(2.0, Color::rgba(0, 0, 0, 120)),
|
||||
shadow = BoxShadow::new(Point::new(2.0, 2.0), 8.0, 2.0, Color::rgba(0, 0, 0, 60), BoxShadowKind::Outer),
|
||||
) {
|
||||
text(size = 18.0) { "count = "; count.clone() }
|
||||
text(color = colors::muted()) { "double = "; doubled.clone() }
|
||||
text(size = 18.0, color = Color::rgb(0, 0, 0)) { "count = "; count.clone() }
|
||||
text(color = Color::rgba(0, 0, 0, 200)) { "double = "; doubled.clone() }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -65,8 +76,9 @@ fn CounterApp(title: &'static str) -> impl IntoView {
|
||||
#[component]
|
||||
fn CounterActions(count: Signal<i32>) -> impl IntoView {
|
||||
view! {
|
||||
row(gap = 8.0) {
|
||||
row(gap = 16.0) {
|
||||
button(
|
||||
background = Color::rgba(255, 255, 255, 90),
|
||||
on_press = {
|
||||
let count = count.clone();
|
||||
move |_| {
|
||||
@@ -74,10 +86,11 @@ fn CounterActions(count: Signal<i32>) -> impl IntoView {
|
||||
}
|
||||
},
|
||||
) {
|
||||
"-1"
|
||||
text(selectable = false, pointer_events = false) { "-1" }
|
||||
}
|
||||
|
||||
button(
|
||||
background = Color::rgba(255, 255, 255, 90),
|
||||
on_press = {
|
||||
let count = count.clone();
|
||||
move |_| {
|
||||
@@ -85,10 +98,11 @@ fn CounterActions(count: Signal<i32>) -> impl IntoView {
|
||||
}
|
||||
},
|
||||
) {
|
||||
"Reset"
|
||||
text(selectable = false, pointer_events = false) { "Reset" }
|
||||
}
|
||||
|
||||
button(
|
||||
background = Color::rgba(255, 255, 255, 90),
|
||||
on_press = {
|
||||
let count = count.clone();
|
||||
move |_| {
|
||||
@@ -96,7 +110,7 @@ fn CounterActions(count: Signal<i32>) -> impl IntoView {
|
||||
}
|
||||
},
|
||||
) {
|
||||
"+1"
|
||||
text(selectable = false, pointer_events = false) { "+1" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user