Skip to content

Commit 6bdb6e4

Browse files
Refactor command palette, picker and code action styles.
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
1 parent 3d66ba3 commit 6bdb6e4

File tree

3 files changed

+12
-19
lines changed

3 files changed

+12
-19
lines changed

crates/command_palette2/src/command_palette.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use gpui::{
88
use picker::{Picker, PickerDelegate};
99
use std::cmp::{self, Reverse};
1010
use theme::ActiveTheme;
11-
use ui::{modal, Label};
11+
use ui::{modal, v_stack, Label};
1212
use util::{
1313
channel::{parse_zed_link, ReleaseChannel, RELEASE_CHANNEL},
1414
ResultExt,
@@ -76,8 +76,8 @@ impl Modal for CommandPalette {
7676
impl Render for CommandPalette {
7777
type Element = Div<Self>;
7878

79-
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
80-
modal(cx).w_96().child(self.picker.clone())
79+
fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
80+
v_stack().w_96().child(self.picker.clone())
8181
}
8282
}
8383

crates/editor2/src/editor.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ use text::{OffsetUtf16, Rope};
9797
use theme::{
9898
ActiveTheme, DiagnosticStyle, PlayerColor, SyntaxTheme, Theme, ThemeColors, ThemeSettings,
9999
};
100-
use ui::IconButton;
100+
use ui::{IconButton, StyledExt};
101101
use util::{post_inc, RangeExt, ResultExt, TryFutureExt};
102102
use workspace::{
103103
item::ItemEvent, searchable::SearchEvent, ItemNavHistory, SplitDirection, ViewId, Workspace,
@@ -1582,7 +1582,7 @@ impl CodeActionsMenu {
15821582
.collect()
15831583
},
15841584
)
1585-
.bg(cx.theme().colors().element_background)
1585+
.elevation_1(cx)
15861586
.px_2()
15871587
.py_1()
15881588
.with_width_from_item(

crates/picker2/src/picker2.rs

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use gpui::{
55
WindowContext,
66
};
77
use std::cmp;
8-
use theme::ActiveTheme;
9-
use ui::v_stack;
8+
use ui::{prelude::*, v_stack, Divider};
109

1110
pub struct Picker<D: PickerDelegate> {
1211
pub delegate: D,
@@ -145,6 +144,7 @@ impl<D: PickerDelegate> Render for Picker<D> {
145144
.id("picker-container")
146145
.focusable()
147146
.size_full()
147+
.elevation_2(cx)
148148
.on_action(Self::select_next)
149149
.on_action(Self::select_prev)
150150
.on_action(Self::select_first)
@@ -153,19 +153,12 @@ impl<D: PickerDelegate> Render for Picker<D> {
153153
.on_action(Self::confirm)
154154
.on_action(Self::secondary_confirm)
155155
.child(
156-
v_stack().gap_px().child(
157-
v_stack()
158-
.py_0p5()
159-
.px_1()
160-
.child(div().px_2().py_0p5().child(self.editor.clone())),
161-
),
162-
)
163-
.child(
164-
div()
165-
.h_px()
166-
.w_full()
167-
.bg(cx.theme().colors().element_background),
156+
v_stack()
157+
.py_0p5()
158+
.px_1()
159+
.child(div().px_2().py_0p5().child(self.editor.clone())),
168160
)
161+
.child(Divider::horizontal())
169162
.child(
170163
v_stack()
171164
.py_0p5()

0 commit comments

Comments
 (0)