1use ui::{
2 ButtonCommon, ButtonLike, Clickable, Color, Context, Icon, IconName, IconSize, ParentElement,
3 Render, Styled, Tooltip, Window, h_flex,
4};
5use workspace::{ItemHandle, StatusItemView};
6
7pub struct SearchButton;
8
9impl SearchButton {
10 pub fn new() -> Self {
11 Self {}
12 }
13}
14
15impl Render for SearchButton {
16 fn render(&mut self, _window: &mut Window, cx: &mut Context<Self>) -> impl ui::IntoElement {
17 h_flex().gap_2().child(
18 ButtonLike::new("project-search-indicator")
19 .child(
20 Icon::new(IconName::MagnifyingGlass)
21 .size(IconSize::Small)
22 .color(Color::Default),
23 )
24 .tooltip(|window, cx| {
25 Tooltip::for_action(
26 "Project Search",
27 &workspace::DeploySearch::default(),
28 window,
29 cx,
30 )
31 })
32 .on_click(cx.listener(|_this, _, window, cx| {
33 window.dispatch_action(Box::new(workspace::DeploySearch::default()), cx);
34 })),
35 )
36 }
37}
38
39impl StatusItemView for SearchButton {
40 fn set_active_pane_item(
41 &mut self,
42 _active_pane_item: Option<&dyn ItemHandle>,
43 _window: &mut Window,
44 _cx: &mut Context<Self>,
45 ) {
46 }
47}