fix(ui): trigger FilterTabs indicator animation on click
This commit is contained in:
parent
3daa09efc2
commit
c69a632e75
@ -207,11 +207,7 @@ pub fn FilterTabs(
|
|||||||
let mut indicator_style = use_signal(|| "left: 0px; width: 0px; opacity: 0;".to_string());
|
let mut indicator_style = use_signal(|| "left: 0px; width: 0px; opacity: 0;".to_string());
|
||||||
let id_prefix = use_hook(|| TAB_GROUP_ID.fetch_add(1, std::sync::atomic::Ordering::SeqCst));
|
let id_prefix = use_hook(|| TAB_GROUP_ID.fetch_add(1, std::sync::atomic::Ordering::SeqCst));
|
||||||
|
|
||||||
use_effect({
|
let update_indicator = move |active: String| {
|
||||||
let active_value = active_value.clone();
|
|
||||||
move || {
|
|
||||||
#[allow(unused_variables)]
|
|
||||||
let active = active_value.clone();
|
|
||||||
spawn(async move {
|
spawn(async move {
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[cfg(target_arch = "wasm32")]
|
||||||
{
|
{
|
||||||
@ -242,6 +238,12 @@ pub fn FilterTabs(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
use_effect({
|
||||||
|
let active_value = active_value.clone();
|
||||||
|
move || {
|
||||||
|
update_indicator(active_value.clone());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -258,7 +260,10 @@ pub fn FilterTabs(
|
|||||||
},
|
},
|
||||||
onclick: {
|
onclick: {
|
||||||
let v = value.to_string();
|
let v = value.to_string();
|
||||||
move |_| on_change.call(v.clone())
|
move |_| {
|
||||||
|
on_change.call(v.clone());
|
||||||
|
update_indicator(v.clone());
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"{label}"
|
"{label}"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user