diff --git a/demo/Cargo.toml b/demo/Cargo.toml index bf623f8..8a3001a 100644 --- a/demo/Cargo.toml +++ b/demo/Cargo.toml @@ -10,7 +10,7 @@ edition = "2021" leptos = { version = "0.5.4" } leptos_meta = { version = "0.5.4" } leptos_router = { version = "0.5.4" } -leptos_devtools = "0.0.1" +leptos_devtools = { version = "0.0.1", optional = true} thaw = { path = "../thaw", default-features = false } icondata = { version = "0.1.0", features = [ "AiCloseOutlined", @@ -18,6 +18,7 @@ icondata = { version = "0.1.0", features = [ "AiGithubOutlined", "AiUserOutlined", "AiSearchOutlined", + "AiUnorderedListOutlined" ] } demo_markdown = { path = "../demo_markdown" } diff --git a/demo/src/components/site_header.rs b/demo/src/components/site_header.rs index d667b20..8daa5f7 100644 --- a/demo/src/components/site_header.rs +++ b/demo/src/components/site_header.rs @@ -1,5 +1,6 @@ use leptos::*; -use leptos_router::use_navigate; +use leptos_meta::Style; +use leptos_router::{use_location, use_navigate}; use thaw::*; #[component] @@ -8,23 +9,21 @@ pub fn SiteHeader() -> impl IntoView { let theme_name = create_memo(move |_| { theme.with(|theme| { if theme.name == *"light" { - "Dark" + "Dark".to_string() } else { - "Light" + "Light".to_string() } }) }); - let on_theme = move |_| { + let change_theme = Callback::new(move |_| { if theme_name.get_untracked() == "Light" { - theme.set(Theme::light()) + theme.set(Theme::light()); } else { - theme.set(Theme::dark()) + theme.set(Theme::dark()); } - }; + }); let style = create_memo(move |_| { - theme.with(|theme| { - format!("height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid {}", theme.common.border_color) - }) + theme.with(|theme| format!("border-bottom: 1px solid {}", theme.common.border_color)) }); let search_value = create_rw_signal(String::new()); let search_all_options = store_value(gen_search_all_options()); @@ -77,18 +76,58 @@ pub fn SiteHeader() -> impl IntoView { } }); on_cleanup(move || handle.remove()); - view! { - - - -
+ let menu_value = use_menu_value(change_theme); + view! { + + + + +
"Thaw UI"
@@ -105,39 +144,62 @@ pub fn SiteHeader() -> impl IntoView { - - - - + + +