search_bar.rs

 1use gpui::{MouseDownEvent, RenderOnce, WindowContext};
 2use ui::{Button, ButtonVariant, IconButton};
 3
 4use crate::mode::SearchMode;
 5
 6pub(super) fn render_nav_button(
 7    icon: ui::Icon,
 8    _active: bool,
 9    on_click: impl Fn(&MouseDownEvent, &mut WindowContext) + 'static,
10) -> impl RenderOnce {
11    // let tooltip_style = cx.theme().tooltip.clone();
12    // let cursor_style = if active {
13    //     CursorStyle::PointingHand
14    // } else {
15    //     CursorStyle::default()
16    // };
17    // enum NavButton {}
18    IconButton::new("search-nav-button", icon).on_click(on_click)
19}
20
21pub(crate) fn render_search_mode_button(
22    mode: SearchMode,
23    is_active: bool,
24    on_click: impl Fn(&MouseDownEvent, &mut WindowContext) + 'static,
25) -> Button {
26    let button_variant = if is_active {
27        ButtonVariant::Filled
28    } else {
29        ButtonVariant::Ghost
30    };
31
32    Button::new(mode.label())
33        .on_click(on_click)
34        .variant(button_variant)
35}