diff options
Diffstat (limited to 'components/top_movers.py')
| -rw-r--r-- | components/top_movers.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/components/top_movers.py b/components/top_movers.py index ea72fc6..5589df6 100644 --- a/components/top_movers.py +++ b/components/top_movers.py @@ -8,6 +8,10 @@ DEFAULT_VISIBLE_MOVERS = 3 MAX_MOVERS = 8 +def _toggle_mover_tab(state_key: str): + st.session_state[state_key] = not st.session_state.get(state_key, False) + + def _inject_styles(): st.markdown( """ @@ -127,8 +131,13 @@ def _render_mover_tab(screen: str, state_key: str): if len(quotes) > DEFAULT_VISIBLE_MOVERS: button_label = "Show Less" if expanded else f"Show More ({len(quotes) - DEFAULT_VISIBLE_MOVERS} more)" - if st.button(button_label, key=f"{state_key}_button", use_container_width=True): - st.session_state[state_key] = not expanded + st.button( + button_label, + key=f"{state_key}_button", + use_container_width=True, + on_click=_toggle_mover_tab, + args=(state_key,), + ) @st.fragment |
