refactor: gh-pages

This commit is contained in:
luoxiao 2023-09-01 10:37:36 +08:00
parent 3e4e39a394
commit 7a51c2d68b
3 changed files with 19 additions and 48 deletions

View file

@ -7,58 +7,30 @@ pub fn App() -> impl IntoView {
view! { view! {
<Router base="/melt-ui"> <Router base="/melt-ui">
<Routes base="/melt-ui".to_string() > <Routes base="/melt-ui".to_string() >
<Route path="/" view=move || view! { <Route path="/" view=Home />
<Home /> <Route path="/components" view=ComponentsPage>
} /> <Route path="/menu" view=MenuPage />
<Route path="/components" view=move || view! { <Route path="/slider" view=SliderPage />
<ComponentsPage /> <Route path="/tabbar" view=|| view! {
} >
<Route path="/menu" view=move || view! {
<MenuPage />
} />
<Route path="/slider" view=move || view! {
<SliderPage />
} />
<Route path="/tabbar" view=move || view! {
<MobilePage path="/melt-ui?path=/mobile/tabbar" /> <MobilePage path="/melt-ui?path=/mobile/tabbar" />
} /> } />
<Route path="/nav-bar" view=move || view! { <Route path="/nav-bar" view=|| view! {
<MobilePage path="/melt-ui?path=/mobile/nav-bar" /> <MobilePage path="/melt-ui?path=/mobile/nav-bar" />
} /> } />
<Route path="/input" view=move || view! { <Route path="/input" view=InputPage />
<InputPage /> <Route path="/image" view=ImagePage />
} /> <Route path="/modal" view=ModalPage />
<Route path="/image" view=move || view! { <Route path="/button" view=ButtonPage />
<ImagePage /> <Route path="/checkbox" view=CheckboxPage />
} /> <Route path="/toast" view=|| view! {
<Route path="/modal" view=move || view! {
<ModalPage />
} />
<Route path="/button" view=move || view! {
<ButtonPage />
} />
<Route path="/checkbox" view=move || view! {
<CheckboxPage />
} />
<Route path="/toast" view=move || view! {
<MobilePage path="/melt-ui?path=/mobile/toast" /> <MobilePage path="/melt-ui?path=/mobile/toast" />
} /> } />
<Route path="/tabs" view=move || view! { <Route path="/tabs" view=TabsPage />
<TabsPage /> <Route path="/select" view=SelectPage />
} />
<Route path="/select" view=move || view! {
<SelectPage />
} />
</Route> </Route>
<Route path="/mobile/tabbar" view=move || view! { <Route path="/mobile/tabbar" view=TabbarPage />
<TabbarPage /> <Route path="/mobile/nav-bar" view=NavBarPage />
} /> <Route path="/mobile/toast" view=ToastPage />
<Route path="/mobile/nav-bar" view=move || view! {
<NavBarPage />
} />
<Route path="/mobile/toast" view=move || view! {
<ToastPage />
} />
</Routes> </Routes>
</Router> </Router>
} }

View file

@ -6,5 +6,5 @@ use app::*;
use leptos::*; use leptos::*;
fn main() { fn main() {
mount_to_body(|| view! { <App/> }) mount_to_body(App)
} }

View file

@ -7,9 +7,8 @@ use melt_ui::*;
pub fn Home() -> impl IntoView { pub fn Home() -> impl IntoView {
let query_map = use_query_map().get_untracked(); let query_map = use_query_map().get_untracked();
if let Some(path) = query_map.get("path") { if let Some(path) = query_map.get("path") {
let path = store_value(path.clone());
let navigate = use_navigate(); let navigate = use_navigate();
navigate(&path.get_value(), Default::default()); navigate(path, Default::default());
} }
view! { view! {
<Layout position=LayoutPosition::ABSOLUTE> <Layout position=LayoutPosition::ABSOLUTE>