mirror of
https://github.com/adoyle0/thaw.git
synced 2025-02-02 08:34:15 -05:00
Demo/231217 (#52)
* fix(demo): tabs demo * demo: add server sider rendering
This commit is contained in:
parent
d94c8ed4c6
commit
89ee294040
4 changed files with 86 additions and 28 deletions
|
@ -38,6 +38,7 @@ fn TheRouter(is_routing: RwSignal<bool>) -> impl IntoView {
|
||||||
<Route path="/guide" view=GuidePage>
|
<Route path="/guide" view=GuidePage>
|
||||||
<Route path="/installation" view=InstallationPage/>
|
<Route path="/installation" view=InstallationPage/>
|
||||||
<Route path="/usage" view=UsagePage/>
|
<Route path="/usage" view=UsagePage/>
|
||||||
|
<Route path="/server-sider-rendering" view=ServerSiderRenderingPage/>
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="/components" view=ComponentsPage>
|
<Route path="/components" view=ComponentsPage>
|
||||||
<Route path="/menu" view=MenuPage/>
|
<Route path="/menu" view=MenuPage/>
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
mod installation;
|
mod installation;
|
||||||
|
mod server_sider_rendering;
|
||||||
mod usage;
|
mod usage;
|
||||||
|
|
||||||
use crate::components::SiteHeader;
|
use crate::components::SiteHeader;
|
||||||
pub use installation::*;
|
pub use installation::*;
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_router::{use_location, use_navigate, Outlet};
|
use leptos_router::{use_location, use_navigate, Outlet};
|
||||||
|
pub use server_sider_rendering::*;
|
||||||
use thaw::*;
|
use thaw::*;
|
||||||
pub use usage::*;
|
pub use usage::*;
|
||||||
|
|
||||||
|
@ -79,7 +81,8 @@ impl IntoView for MenuItemOption {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn gen_guide_menu_data() -> Vec<MenuGroupOption> {
|
pub(crate) fn gen_guide_menu_data() -> Vec<MenuGroupOption> {
|
||||||
vec![MenuGroupOption {
|
vec![
|
||||||
|
MenuGroupOption {
|
||||||
label: "Getting Started".into(),
|
label: "Getting Started".into(),
|
||||||
children: vec![
|
children: vec![
|
||||||
MenuItemOption {
|
MenuItemOption {
|
||||||
|
@ -91,5 +94,13 @@ pub(crate) fn gen_guide_menu_data() -> Vec<MenuGroupOption> {
|
||||||
label: "Usage".into(),
|
label: "Usage".into(),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}]
|
},
|
||||||
|
MenuGroupOption {
|
||||||
|
label: "Guides".into(),
|
||||||
|
children: vec![MenuItemOption {
|
||||||
|
value: "server-sider-rendering".into(),
|
||||||
|
label: "Server Sider Rendering".into(),
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
31
demo/src/pages/guide/server_sider_rendering.rs
Normal file
31
demo/src/pages/guide/server_sider_rendering.rs
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
use crate::components::{Demo, DemoCode};
|
||||||
|
use leptos::*;
|
||||||
|
|
||||||
|
#[component]
|
||||||
|
pub fn ServerSiderRenderingPage() -> impl IntoView {
|
||||||
|
let ssr_config = r#"thaw = { ..., default-features = false, features = ["ssr"] }"#;
|
||||||
|
let hydrate_config = r#"thaw = { ..., default-features = false, features = ["hydrate"] }"#;
|
||||||
|
view! {
|
||||||
|
<div style="width: 896px; margin: 0 auto;">
|
||||||
|
<h1>"Server Sider Rendering"</h1>
|
||||||
|
<p>"To enable the ssr mode, the following configurations are required:"</p>
|
||||||
|
<Demo>
|
||||||
|
""
|
||||||
|
<DemoCode slot>
|
||||||
|
|
||||||
|
{ssr_config}
|
||||||
|
|
||||||
|
</DemoCode>
|
||||||
|
</Demo>
|
||||||
|
<p>"To enable the hydrate mode, the following configurations are required:"</p>
|
||||||
|
<Demo>
|
||||||
|
""
|
||||||
|
<DemoCode slot>
|
||||||
|
|
||||||
|
{hydrate_config}
|
||||||
|
|
||||||
|
</DemoCode>
|
||||||
|
</Demo>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,7 +22,9 @@ pub fn TabsPage() -> impl IntoView {
|
||||||
|
|
||||||
{highlight_str!(
|
{highlight_str!(
|
||||||
r#"
|
r#"
|
||||||
let value = create_rw_signal("apple");
|
let value = create_rw_signal(String::from("apple"));
|
||||||
|
|
||||||
|
view! {
|
||||||
<Tabs value>
|
<Tabs value>
|
||||||
<Tab key="apple" label="Apple">
|
<Tab key="apple" label="Apple">
|
||||||
"apple"
|
"apple"
|
||||||
|
@ -31,6 +33,7 @@ pub fn TabsPage() -> impl IntoView {
|
||||||
"pear"
|
"pear"
|
||||||
</Tab>
|
</Tab>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
|
}
|
||||||
"#,
|
"#,
|
||||||
"rust"
|
"rust"
|
||||||
)}
|
)}
|
||||||
|
@ -50,13 +53,19 @@ pub fn TabsPage() -> impl IntoView {
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>"value"</td>
|
<td>"value"</td>
|
||||||
<td>"RwSignal<String>"</td>
|
<td>
|
||||||
<td>"Default::default()"</td>
|
<Text code=true>"RwSignal<String>"</Text>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<Text code=true>"Default::default()"</Text>
|
||||||
|
</td>
|
||||||
<td>"Tabs value."</td>
|
<td>"Tabs value."</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>"children"</td>
|
<td>"children"</td>
|
||||||
<td>"Children"</td>
|
<td>
|
||||||
|
<Text code=true>"Children"</Text>
|
||||||
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>"Tabs content."</td>
|
<td>"Tabs content."</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -75,19 +84,25 @@ pub fn TabsPage() -> impl IntoView {
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>"key"</td>
|
<td>"key"</td>
|
||||||
<td>"String"</td>
|
<td>
|
||||||
|
<Text code=true>"String"</Text>
|
||||||
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>"The indentifier of the tab."</td>
|
<td>"The indentifier of the tab."</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>"label"</td>
|
<td>"label"</td>
|
||||||
<td>"String"</td>
|
<td>
|
||||||
|
<Text code=true>"String"</Text>
|
||||||
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>"The label of the tab."</td>
|
<td>"The label of the tab."</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>"children"</td>
|
<td>"children"</td>
|
||||||
<td>"Children"</td>
|
<td>
|
||||||
|
<Text code=true>"Children"</Text>
|
||||||
|
</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
<td>"Tab's content."</td>
|
<td>"Tab's content."</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Add table
Reference in a new issue