use nsh_core::element::desktop::window as app_window;
use nsh_core::prelude::*;
use nsh_base::theme;
#[native_module("__SPECIFIER__")]
fn native(registry: &mut Registry) {
registry.register::<App>();
}
#[component]
pub fn App() -> impl IntoElement {
let count = signal(0_u32);
let content = move || {
view()
.flex_1()
.bg(move || theme().background)
.text_color(move || theme().foreground)
.child(
view()
.flex_1()
.p_safe_area()
.child(
view()
.flex_1()
.items_center()
.justify_center()
.gap_4()
.child(
text(move || format!("Count: {}", count.get())).text_size(px(28.0)),
)
.child(
view()
.px_5()
.py_3()
.rounded(px(10.0))
.bg(move || theme().primary)
.active(|s| s.opacity(0.6))
.on_press(move || count.update(|value| *value += 1))
.child(
text("Tap").text_size(px(17.0)).text_color(move || {
theme().primary_foreground
}),
),
),
),
)
};
app_window().id("main").content(content)
}