Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Add rudimentary UI for `BufferSearch`

Marshall Bowers3c1ec2e9ca70
diff --git a/crates/ui2/src/components/buffer_search.rs b/crates/ui2/src/components/buffer_search.rs
index 95e328091c4..642942e5376 100644
--- a/crates/ui2/src/components/buffer_search.rs
+++ b/crates/ui2/src/components/buffer_search.rs
@@ -1,5 +1,5 @@
use crate::prelude::*;
-use crate::EditorPane;
+use crate::{h_stack, EditorPane, Icon, IconButton, Input};
#[derive(Element)]
#[element(view_state = "EditorPane")]
@@ -15,6 +15,15 @@ impl BufferSearch {
_view: &mut EditorPane,
cx: &mut ViewContext<EditorPane>,
) -> impl Element<ViewState = EditorPane> {
- div().child("This is where Buffer Search goes.")
+ let theme = theme(cx);
+
+ h_stack()
+ .fill(theme.highest.base.default.background)
+ .p_2()
+ .child(
+ h_stack()
+ .child(Input::new("Search (↑/↓ for previous/next query)"))
+ .child(IconButton::new(Icon::Replace)),
+ )
}
}
diff --git a/crates/ui2/src/elements/button.rs b/crates/ui2/src/elements/button.rs
index fc26f489f99..e1dac4466fd 100644
--- a/crates/ui2/src/elements/button.rs
+++ b/crates/ui2/src/elements/button.rs
@@ -4,7 +4,7 @@ use std::sync::Arc;
use gpui3::{DefiniteLength, Hsla, Interactive, MouseButton, WindowContext};
use crate::prelude::*;
-use crate::{h_stack, theme, Icon, IconColor, IconElement, Label, LabelColor, LabelSize};
+use crate::{h_stack, Icon, IconColor, IconElement, Label, LabelColor, LabelSize};
#[derive(Default, PartialEq, Clone, Copy)]
pub enum IconPosition {
diff --git a/crates/ui2/src/elements/icon.rs b/crates/ui2/src/elements/icon.rs
index 74ee43b0670..f38c8c339a6 100644
--- a/crates/ui2/src/elements/icon.rs
+++ b/crates/ui2/src/elements/icon.rs
@@ -82,6 +82,8 @@ pub enum Icon {
MicMute,
Plus,
Quote,
+ Replace,
+ ReplaceAll,
Screen,
SelectAll,
Split,
@@ -130,6 +132,8 @@ impl Icon {
Icon::MicMute => "icons/mic-mute.svg",
Icon::Plus => "icons/plus.svg",
Icon::Quote => "icons/quote.svg",
+ Icon::Replace => "icons/replace.svg",
+ Icon::ReplaceAll => "icons/replace_all.svg",
Icon::Screen => "icons/desktop.svg",
Icon::SelectAll => "icons/select-all.svg",
Icon::Split => "icons/split.svg",