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-08 09:28:13 +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>
|
2023-10-05 12:23:15 +08:00
|
|
|
<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-10-08 09:28:13 +08:00
|
|
|
}>"Read the docs"</Button>
|
|
|
|
<Button
|
2023-10-08 14:01:24 +08:00
|
|
|
variant=ButtonVariant::TEXT
|
2023-10-08 09:28:13 +08:00
|
|
|
on:click=move |_| {
|
|
|
|
_ = window().open_with_url("http://github.com/luoxiaozero/melt-ui");
|
|
|
|
}
|
|
|
|
>
|
|
|
|
|
2023-10-05 12:23:15 +08:00
|
|
|
"Github"
|
|
|
|
</Button>
|
|
|
|
</Space>
|
2023-06-18 17:05:35 +08:00
|
|
|
</Layout>
|
2023-06-13 12:43:15 +08:00
|
|
|
}
|
|
|
|
}
|