2023-06-13 12:43:15 +08:00
|
|
|
use leptos::*;
|
2023-06-13 13:49:35 +08:00
|
|
|
use leptos_router::{use_navigate, use_query_map};
|
2023-06-13 12:43:15 +08:00
|
|
|
use melt_ui::*;
|
|
|
|
|
|
|
|
#[component]
|
2023-08-29 09:11:22 +08:00
|
|
|
pub fn Home() -> impl IntoView {
|
2023-08-29 11:09:28 +08:00
|
|
|
let query_map = use_query_map().get_untracked();
|
2023-06-13 13:49:35 +08:00
|
|
|
if let Some(path) = query_map.get("path") {
|
2023-08-29 11:09:28 +08:00
|
|
|
let navigate = use_navigate();
|
2023-09-01 10:37:36 +08:00
|
|
|
navigate(path, Default::default());
|
2023-06-13 13:49:35 +08:00
|
|
|
}
|
2023-08-29 09:11:22 +08:00
|
|
|
view! {
|
2023-10-05 12:23:15 +08:00
|
|
|
<Layout position=LayoutPosition::ABSOLUTE style="display: flex; align-items: center; justify-content: center; flex-direction: column;">
|
|
|
|
<h1 style="font-size: 80px; line-height: 1;margin: 0 0 18px;">
|
|
|
|
"Melt UI"
|
|
|
|
</h1>
|
|
|
|
<p>"An easy to use leptos component library"</p>
|
|
|
|
<Space>
|
|
|
|
<Button on_click=move |_| {
|
2023-08-29 09:11:22 +08:00
|
|
|
let navigate = use_navigate();
|
|
|
|
navigate("/components/menu", Default::default());
|
2023-06-18 17:05:35 +08:00
|
|
|
}>
|
|
|
|
"Read the docs"
|
|
|
|
</Button>
|
2023-10-05 12:23:15 +08:00
|
|
|
<Button type_=ButtonType::TEXT on:click=move |_| {
|
|
|
|
_ = window().open_with_url("http://github.com/luoxiaozero/melt-ui");
|
|
|
|
}>
|
|
|
|
"Github"
|
|
|
|
</Button>
|
|
|
|
</Space>
|
2023-06-18 17:05:35 +08:00
|
|
|
</Layout>
|
2023-06-13 12:43:15 +08:00
|
|
|
}
|
|
|
|
}
|