diff --git a/frontend/src/components/layout/sidebar.rs b/frontend/src/components/layout/sidebar.rs index 87fd4a4..9857398 100644 --- a/frontend/src/components/layout/sidebar.rs +++ b/frontend/src/components/layout/sidebar.rs @@ -3,7 +3,7 @@ use leptos::task::spawn_local; use leptos_shadcn_button::{Button, ButtonVariant, ButtonSize}; use leptos_shadcn_avatar::{Avatar, AvatarFallback}; use leptos_shadcn_separator::Separator; -use leptos::html; + use leptos_use::storage::use_local_storage; use ::codee::string::FromToStringCodec; @@ -93,11 +93,11 @@ pub fn Sidebar() -> impl IntoView { } }); - let theme_details_ref = NodeRef::::new(); - let close_details = move |node_ref: NodeRef| { - if let Some(el) = node_ref.get_untracked() { - el.set_open(false); - } + + + let toggle_theme = move |_| { + let new_theme = if current_theme.get() == "dark" { "light" } else { "dark" }; + set_current_theme.set(new_theme.to_string()); }; // --- THEME LOGIC END --- @@ -192,7 +192,7 @@ pub fn Sidebar() -> impl IntoView { -
+
@@ -205,50 +205,25 @@ pub fn Sidebar() -> impl IntoView {
// --- THEME BUTTON --- -
- - - + - - - -
+ }> + + + + +