search_bar.rs

 1use gpui::{Action, 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) -> impl IntoElement {
11    IconButton::new(
12        SharedString::from(format!("search-nav-button-{}", action.name())),
13        icon,
14    )
15    .on_click(|_, cx| cx.dispatch_action(action.boxed_clone()))
16    .tooltip(move |cx| Tooltip::for_action(tooltip, action, cx))
17    .disabled(!active)
18}