From 06b16463f1fee3357b5c8c5d6be021d87ba106af Mon Sep 17 00:00:00 2001 From: Xiangpeng Hao Date: Tue, 3 Dec 2024 22:02:51 -0600 Subject: [PATCH] better tab fold --- src/file_reader.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/file_reader.rs b/src/file_reader.rs index 9f23243..f82582a 100644 --- a/src/file_reader.rs +++ b/src/file_reader.rs @@ -98,8 +98,12 @@ pub fn FileReader( let (is_folded, set_is_folded) = create_signal(false); let set_active_tab = move |tab: &str| { - set_active_tab.set(tab.to_string()); - set_is_folded.set(false); + if active_tab.get() == tab { + set_is_folded.set(!is_folded.get()); + } else { + set_active_tab.set(tab.to_string()); + set_is_folded.set(false); + } }; let on_file_select = move |ev: web_sys::Event| {