1use gpui::{Action, FocusHandle, IntoElement};
2use ui::IconButton;
3use ui::{prelude::*, Tooltip};
4
5pub(super) fn render_nav_button(
6 icon: ui::IconName,
7 active: bool,
8 tooltip: &'static str,
9 action: &'static dyn Action,
10 focus_handle: FocusHandle,
11) -> impl IntoElement {
12 IconButton::new(
13 SharedString::from(format!("search-nav-button-{}", action.name())),
14 icon,
15 )
16 .on_click(|_, cx| cx.dispatch_action(action.boxed_clone()))
17 .tooltip(move |cx| Tooltip::for_action_in(tooltip, action, &focus_handle, cx))
18 .disabled(!active)
19}