Refactor command palette, picker and code action styles.
Co-Authored-By: Marshall Bowers <1486634+maxdeviant@users.noreply.github.com>
This commit is contained in:
parent
3d66ba35a3
commit
6bdb6e486e
3 changed files with 12 additions and 19 deletions
|
@ -8,7 +8,7 @@ use gpui::{
|
||||||
use picker::{Picker, PickerDelegate};
|
use picker::{Picker, PickerDelegate};
|
||||||
use std::cmp::{self, Reverse};
|
use std::cmp::{self, Reverse};
|
||||||
use theme::ActiveTheme;
|
use theme::ActiveTheme;
|
||||||
use ui::{modal, Label};
|
use ui::{modal, v_stack, Label};
|
||||||
use util::{
|
use util::{
|
||||||
channel::{parse_zed_link, ReleaseChannel, RELEASE_CHANNEL},
|
channel::{parse_zed_link, ReleaseChannel, RELEASE_CHANNEL},
|
||||||
ResultExt,
|
ResultExt,
|
||||||
|
@ -76,8 +76,8 @@ impl Modal for CommandPalette {
|
||||||
impl Render for CommandPalette {
|
impl Render for CommandPalette {
|
||||||
type Element = Div<Self>;
|
type Element = Div<Self>;
|
||||||
|
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
|
fn render(&mut self, _cx: &mut ViewContext<Self>) -> Self::Element {
|
||||||
modal(cx).w_96().child(self.picker.clone())
|
v_stack().w_96().child(self.picker.clone())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ use text::{OffsetUtf16, Rope};
|
||||||
use theme::{
|
use theme::{
|
||||||
ActiveTheme, DiagnosticStyle, PlayerColor, SyntaxTheme, Theme, ThemeColors, ThemeSettings,
|
ActiveTheme, DiagnosticStyle, PlayerColor, SyntaxTheme, Theme, ThemeColors, ThemeSettings,
|
||||||
};
|
};
|
||||||
use ui::IconButton;
|
use ui::{IconButton, StyledExt};
|
||||||
use util::{post_inc, RangeExt, ResultExt, TryFutureExt};
|
use util::{post_inc, RangeExt, ResultExt, TryFutureExt};
|
||||||
use workspace::{
|
use workspace::{
|
||||||
item::ItemEvent, searchable::SearchEvent, ItemNavHistory, SplitDirection, ViewId, Workspace,
|
item::ItemEvent, searchable::SearchEvent, ItemNavHistory, SplitDirection, ViewId, Workspace,
|
||||||
|
@ -1582,7 +1582,7 @@ impl CodeActionsMenu {
|
||||||
.collect()
|
.collect()
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.bg(cx.theme().colors().element_background)
|
.elevation_1(cx)
|
||||||
.px_2()
|
.px_2()
|
||||||
.py_1()
|
.py_1()
|
||||||
.with_width_from_item(
|
.with_width_from_item(
|
||||||
|
|
|
@ -5,8 +5,7 @@ use gpui::{
|
||||||
WindowContext,
|
WindowContext,
|
||||||
};
|
};
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
use theme::ActiveTheme;
|
use ui::{prelude::*, v_stack, Divider};
|
||||||
use ui::v_stack;
|
|
||||||
|
|
||||||
pub struct Picker<D: PickerDelegate> {
|
pub struct Picker<D: PickerDelegate> {
|
||||||
pub delegate: D,
|
pub delegate: D,
|
||||||
|
@ -145,6 +144,7 @@ impl<D: PickerDelegate> Render for Picker<D> {
|
||||||
.id("picker-container")
|
.id("picker-container")
|
||||||
.focusable()
|
.focusable()
|
||||||
.size_full()
|
.size_full()
|
||||||
|
.elevation_2(cx)
|
||||||
.on_action(Self::select_next)
|
.on_action(Self::select_next)
|
||||||
.on_action(Self::select_prev)
|
.on_action(Self::select_prev)
|
||||||
.on_action(Self::select_first)
|
.on_action(Self::select_first)
|
||||||
|
@ -153,19 +153,12 @@ impl<D: PickerDelegate> Render for Picker<D> {
|
||||||
.on_action(Self::confirm)
|
.on_action(Self::confirm)
|
||||||
.on_action(Self::secondary_confirm)
|
.on_action(Self::secondary_confirm)
|
||||||
.child(
|
.child(
|
||||||
v_stack().gap_px().child(
|
|
||||||
v_stack()
|
v_stack()
|
||||||
.py_0p5()
|
.py_0p5()
|
||||||
.px_1()
|
.px_1()
|
||||||
.child(div().px_2().py_0p5().child(self.editor.clone())),
|
.child(div().px_2().py_0p5().child(self.editor.clone())),
|
||||||
),
|
|
||||||
)
|
|
||||||
.child(
|
|
||||||
div()
|
|
||||||
.h_px()
|
|
||||||
.w_full()
|
|
||||||
.bg(cx.theme().colors().element_background),
|
|
||||||
)
|
)
|
||||||
|
.child(Divider::horizontal())
|
||||||
.child(
|
.child(
|
||||||
v_stack()
|
v_stack()
|
||||||
.py_0p5()
|
.py_0p5()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue