mirror of
https://github.com/adoyle0/thaw.git
synced 2025-02-11 03:13:11 -05:00
41 lines
1.2 KiB
Rust
41 lines
1.2 KiB
Rust
|
use leptos::*;
|
||
|
use leptos_router::use_navigate;
|
||
|
use melt_ui::*;
|
||
|
|
||
|
#[component]
|
||
|
pub fn Home(cx: Scope) -> impl IntoView {
|
||
|
let (theme, set_theme) = create_signal(cx, Theme::light());
|
||
|
provide_context(cx, theme);
|
||
|
let (count, set_count) = create_signal(cx, 0.0);
|
||
|
let (button_type, set_button_type) = create_signal(cx, ButtonType::TEXT);
|
||
|
view! { cx,
|
||
|
<Button on:click=move |_| {
|
||
|
let navigate = use_navigate(cx);
|
||
|
_ = navigate("/components/menu", Default::default());
|
||
|
}>
|
||
|
"components"
|
||
|
</Button>
|
||
|
<hr />
|
||
|
<Space>
|
||
|
<Button
|
||
|
on:click=move |_| set_theme.update(move |value| *value = Theme::dark())
|
||
|
type_=button_type
|
||
|
>
|
||
|
"theme"
|
||
|
</Button>
|
||
|
<Button on:click=move |_| set_button_type.update(move |value| *value = ButtonType::PRIMARY)>
|
||
|
"click"
|
||
|
</Button>
|
||
|
<Button
|
||
|
on:click=move |_| set_count.update(move |value| *value += 1.0)
|
||
|
type_=button_type
|
||
|
>
|
||
|
"click"
|
||
|
</Button>
|
||
|
{move || count.get()}
|
||
|
|
||
|
<Progress percentage=count/>
|
||
|
</Space>
|
||
|
}
|
||
|
}
|