2023-06-18 19:40:23 +08:00
|
|
|
use crate::components::SiteHeader;
|
2024-07-07 18:33:45 +08:00
|
|
|
use leptos::prelude::*;
|
2024-01-04 23:32:58 +08:00
|
|
|
use leptos_meta::Style;
|
2024-07-07 18:33:45 +08:00
|
|
|
use leptos_router::{
|
|
|
|
components::Outlet,
|
|
|
|
hooks::{use_location, use_navigate},
|
|
|
|
};
|
2023-11-05 16:03:58 +08:00
|
|
|
use thaw::*;
|
2023-06-13 12:43:15 +08:00
|
|
|
|
|
|
|
#[component]
|
2023-08-29 09:11:22 +08:00
|
|
|
pub fn ComponentsPage() -> impl IntoView {
|
|
|
|
let navigate = use_navigate();
|
2023-11-08 21:53:49 +08:00
|
|
|
let loaction = use_location();
|
2023-06-13 12:43:15 +08:00
|
|
|
|
2024-07-07 18:33:45 +08:00
|
|
|
let select_name = RwSignal::new(String::new());
|
2024-06-03 11:27:29 +08:00
|
|
|
Effect::new(move |_| {
|
|
|
|
select_name.set(loaction.pathname.get());
|
2023-06-13 12:43:15 +08:00
|
|
|
});
|
|
|
|
|
2023-11-08 21:53:49 +08:00
|
|
|
_ = select_name.watch(move |name| {
|
|
|
|
let pathname = loaction.pathname.get_untracked();
|
2024-06-03 11:27:29 +08:00
|
|
|
if &pathname != name {
|
|
|
|
navigate(name, Default::default());
|
2023-06-13 12:43:15 +08:00
|
|
|
}
|
|
|
|
});
|
2023-08-29 09:11:22 +08:00
|
|
|
view! {
|
2024-01-04 23:32:58 +08:00
|
|
|
<Style>
|
|
|
|
"
|
|
|
|
.demo-components__component {
|
|
|
|
width: 896px;
|
|
|
|
margin: 0 auto;
|
2024-08-16 23:09:09 +08:00
|
|
|
padding: 8px 12px 28px;
|
|
|
|
box-sizing: border-box;
|
2024-01-04 23:32:58 +08:00
|
|
|
}
|
2024-04-19 14:42:30 +08:00
|
|
|
.demo-components__toc {
|
|
|
|
width: 190px;
|
2024-08-16 23:09:09 +08:00
|
|
|
margin: 12px;
|
2024-04-19 14:42:30 +08:00
|
|
|
}
|
|
|
|
.demo-components__toc > .thaw-anchor {
|
|
|
|
position: sticky;
|
|
|
|
top: 36px;
|
|
|
|
}
|
2024-01-04 23:32:58 +08:00
|
|
|
.demo-md-table-box {
|
|
|
|
overflow: auto;
|
|
|
|
}
|
|
|
|
@media screen and (max-width: 1200px) {
|
2024-04-19 14:42:30 +08:00
|
|
|
.demo-components__toc,
|
2024-01-04 23:32:58 +08:00
|
|
|
.demo-components__sider {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
.demo-components__component {
|
2024-08-16 23:09:09 +08:00
|
|
|
width: 100vw;
|
2024-01-04 23:32:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
"
|
|
|
|
</Style>
|
2023-10-16 21:15:43 +08:00
|
|
|
<Layout position=LayoutPosition::Absolute>
|
2023-10-08 09:28:13 +08:00
|
|
|
<SiteHeader/>
|
2024-07-07 18:33:45 +08:00
|
|
|
<Layout has_sider=true position=LayoutPosition::Absolute attr:style="top: 64px;">
|
2024-05-11 17:47:33 +08:00
|
|
|
<div class="demo-components__sider">
|
2024-05-11 15:53:37 +08:00
|
|
|
<NavDrawer selected_value=select_name>
|
2024-07-07 18:33:45 +08:00
|
|
|
{
|
2024-08-05 14:08:46 +08:00
|
|
|
gen_nav_data().into_iter().map(|data| {
|
|
|
|
let NavGroupOption { label, children } = data;
|
2024-07-07 18:33:45 +08:00
|
|
|
view! {
|
2024-07-08 00:04:07 +08:00
|
|
|
<Caption1Strong style="margin-inline-start: 10px; margin-top: 10px; display: inline-block">
|
2024-07-07 18:33:45 +08:00
|
|
|
{label}
|
|
|
|
</Caption1Strong>
|
|
|
|
{
|
|
|
|
children.into_iter().map(|item| {
|
2024-08-05 14:08:46 +08:00
|
|
|
let NavItemOption { label, value } = item;
|
2024-07-07 18:33:45 +08:00
|
|
|
view! {
|
|
|
|
<NavItem value>{label}</NavItem>
|
|
|
|
}
|
|
|
|
}).collect_view()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).collect_view()
|
|
|
|
}
|
2024-05-11 15:53:37 +08:00
|
|
|
</NavDrawer>
|
2024-05-11 17:47:33 +08:00
|
|
|
</div>
|
2024-08-16 23:09:09 +08:00
|
|
|
<Layout content_style="display: flex" attr:class=("doc-content", true)>
|
2023-10-08 09:28:13 +08:00
|
|
|
<Outlet/>
|
2023-06-18 19:40:23 +08:00
|
|
|
</Layout>
|
|
|
|
</Layout>
|
|
|
|
</Layout>
|
2023-06-13 12:43:15 +08:00
|
|
|
}
|
|
|
|
}
|
2023-10-15 15:43:02 +08:00
|
|
|
|
2024-08-05 14:08:46 +08:00
|
|
|
pub(crate) struct NavGroupOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
pub label: &'static str,
|
2024-08-05 14:08:46 +08:00
|
|
|
pub children: Vec<NavItemOption>,
|
2023-10-15 15:43:02 +08:00
|
|
|
}
|
|
|
|
|
2024-08-05 14:08:46 +08:00
|
|
|
pub(crate) struct NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
pub label: &'static str,
|
|
|
|
pub value: &'static str,
|
2023-10-15 15:43:02 +08:00
|
|
|
}
|
|
|
|
|
2024-08-05 14:08:46 +08:00
|
|
|
pub(crate) fn gen_nav_data() -> Vec<NavGroupOption> {
|
2023-10-15 15:43:02 +08:00
|
|
|
vec![
|
2024-08-05 14:08:46 +08:00
|
|
|
NavGroupOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
label: "Getting Started",
|
2024-06-03 11:27:29 +08:00
|
|
|
children: vec![
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/guide/installation",
|
|
|
|
label: "Installation",
|
2024-06-03 11:27:29 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/guide/server-sider-rendering",
|
|
|
|
label: "Server Sider Rendering",
|
2024-06-03 11:27:29 +08:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
// NavGroupOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
// label: "Development",
|
2024-07-30 21:53:36 +08:00
|
|
|
// children: vec![
|
2024-08-05 14:08:46 +08:00
|
|
|
// NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
// value: "/guide/development/components",
|
|
|
|
// label: "Components",
|
2024-07-30 21:53:36 +08:00
|
|
|
// },
|
|
|
|
// ],
|
|
|
|
// },
|
2024-08-05 14:08:46 +08:00
|
|
|
NavGroupOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
label: "Components",
|
2023-10-16 15:10:55 +08:00
|
|
|
children: vec![
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/accordion",
|
|
|
|
label: "Accordion",
|
2024-05-15 23:03:35 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/anchor",
|
|
|
|
label: "Anchor",
|
2024-06-26 22:12:28 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/auto-complete",
|
|
|
|
label: "Auto Complete",
|
2024-06-26 22:12:28 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/avatar",
|
|
|
|
label: "Avatar",
|
2023-10-16 15:10:55 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/back-top",
|
|
|
|
label: "Back Top",
|
2024-06-26 22:12:28 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/badge",
|
|
|
|
label: "Badge",
|
2024-06-05 17:17:17 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/breadcrumb",
|
|
|
|
label: "Breadcrumb",
|
2024-06-04 10:13:37 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/button",
|
|
|
|
label: "Button",
|
2023-10-16 15:10:55 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/calendar",
|
|
|
|
label: "Calendar",
|
2024-06-26 22:12:28 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/card",
|
|
|
|
label: "Card",
|
2023-10-16 22:04:34 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/checkbox",
|
|
|
|
label: "Checkbox",
|
2024-06-26 22:12:28 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/color-picker",
|
|
|
|
label: "Color Picker",
|
2024-06-26 22:12:28 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/combobox",
|
|
|
|
label: "Combobox",
|
2024-06-27 14:51:36 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/config-provider",
|
|
|
|
label: "Config Provider",
|
2024-05-24 10:05:54 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/date-picker",
|
|
|
|
label: "Date Picker",
|
2024-06-25 22:57:44 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/dialog",
|
|
|
|
label: "Dialog",
|
2024-06-28 15:54:20 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/divider",
|
|
|
|
label: "Divider",
|
2023-10-17 11:11:39 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/drawer",
|
|
|
|
label: "Drawer",
|
2024-06-04 14:18:15 +08:00
|
|
|
},
|
2024-08-18 23:15:55 +08:00
|
|
|
NavItemOption {
|
|
|
|
value: "/components/field",
|
|
|
|
label: "Field",
|
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/grid",
|
|
|
|
label: "Grid",
|
2024-06-05 10:04:34 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/icon",
|
|
|
|
label: "Icon",
|
2024-06-06 10:53:04 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/image",
|
|
|
|
label: "Image",
|
2023-10-21 17:37:53 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/input",
|
|
|
|
label: "Input",
|
2023-11-20 21:00:13 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/layout",
|
|
|
|
label: "Layout",
|
2024-06-23 23:33:09 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/loading-bar",
|
|
|
|
label: "Loading Bar",
|
2024-06-25 23:42:53 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/menu",
|
|
|
|
label: "Menu",
|
2024-07-24 13:22:46 +00:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/message-bar",
|
|
|
|
label: "Message Bar",
|
2023-10-15 15:43:02 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/nav",
|
|
|
|
label: "Nav",
|
2024-08-01 00:18:31 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/pagination",
|
|
|
|
label: "Pagination",
|
2024-08-02 15:49:34 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/popover",
|
|
|
|
label: "Popover",
|
2023-10-15 15:43:02 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/progress-bar",
|
|
|
|
label: "ProgressBar",
|
2023-10-15 15:43:02 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/radio",
|
|
|
|
label: "Radio",
|
2023-10-19 22:31:14 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/scrollbar",
|
|
|
|
label: "Scrollbar",
|
2023-12-05 19:24:20 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/skeleton",
|
|
|
|
label: "Skeleton",
|
2024-04-19 14:42:30 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/slider",
|
|
|
|
label: "Slider",
|
2024-04-16 23:00:01 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/space",
|
|
|
|
label: "Space",
|
2023-11-07 11:02:48 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/spin-button",
|
|
|
|
label: "Spin Button",
|
2023-10-15 15:43:02 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/spinner",
|
|
|
|
label: "Spinner",
|
2024-01-07 19:20:08 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/switch",
|
|
|
|
label: "Switch",
|
2023-10-19 17:16:57 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/tab-list",
|
|
|
|
label: "Tab List",
|
2023-10-15 15:43:02 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/table",
|
|
|
|
label: "Table",
|
2023-12-21 13:31:17 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/tag",
|
|
|
|
label: "Tag",
|
2023-11-15 17:50:16 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/text",
|
|
|
|
label: "Text",
|
2023-11-08 22:35:00 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/textarea",
|
|
|
|
label: "Textarea",
|
2023-10-15 15:43:02 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/time-picker",
|
|
|
|
label: "Time Picker",
|
2023-10-15 15:43:02 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/toast",
|
|
|
|
label: "Toast",
|
2024-07-02 17:20:58 +08:00
|
|
|
},
|
2024-08-05 14:08:46 +08:00
|
|
|
NavItemOption {
|
2024-08-14 17:40:06 +08:00
|
|
|
value: "/components/tooltip",
|
|
|
|
label: "Tooltip",
|
|
|
|
},
|
|
|
|
NavItemOption {
|
|
|
|
value: "/components/upload",
|
|
|
|
label: "Upload",
|
2024-06-03 16:31:32 +08:00
|
|
|
},
|
2023-10-15 15:43:02 +08:00
|
|
|
],
|
|
|
|
},
|
|
|
|
]
|
|
|
|
}
|