This PR mostly makes all of the search bar icon buttons all squared and adjusts the spacing between them, as well as the additional input that appears when you toggle the "Replace all" action. <img width="900" alt="Screenshot 2024-10-02 at 6 08 30 PM" src="https://github.com/user-attachments/assets/86d50a3b-94bd-4c6a-822e-5f7f7b2e2707"> --- Release Notes: - N/A
21 lines
632 B
Rust
21 lines
632 B
Rust
use gpui::{Action, FocusHandle, IntoElement};
|
|
use ui::{prelude::*, Tooltip};
|
|
use ui::{IconButton, IconButtonShape};
|
|
|
|
pub(super) fn render_nav_button(
|
|
icon: ui::IconName,
|
|
active: bool,
|
|
tooltip: &'static str,
|
|
action: &'static dyn Action,
|
|
focus_handle: FocusHandle,
|
|
) -> impl IntoElement {
|
|
IconButton::new(
|
|
SharedString::from(format!("search-nav-button-{}", action.name())),
|
|
icon,
|
|
)
|
|
.shape(IconButtonShape::Square)
|
|
.on_click(|_, cx| cx.dispatch_action(action.boxed_clone()))
|
|
.tooltip(move |cx| Tooltip::for_action_in(tooltip, action, &focus_handle, cx))
|
|
.disabled(!active)
|
|
}
|