menu: Fix sub-menu item height to match with other items. (#892)
This commit is contained in:
parent
8dc9666214
commit
a1e2160083
4 changed files with 14 additions and 5 deletions
|
|
@ -3,6 +3,7 @@ mod event;
|
||||||
mod focusable;
|
mod focusable;
|
||||||
mod icon;
|
mod icon;
|
||||||
mod kbd;
|
mod kbd;
|
||||||
|
mod menu;
|
||||||
mod root;
|
mod root;
|
||||||
mod styled;
|
mod styled;
|
||||||
mod svg_img;
|
mod svg_img;
|
||||||
|
|
@ -22,7 +23,6 @@ pub mod button;
|
||||||
pub mod checkbox;
|
pub mod checkbox;
|
||||||
pub mod clipboard;
|
pub mod clipboard;
|
||||||
pub mod color_picker;
|
pub mod color_picker;
|
||||||
pub mod context_menu;
|
|
||||||
pub mod description_list;
|
pub mod description_list;
|
||||||
pub mod divider;
|
pub mod divider;
|
||||||
pub mod dock;
|
pub mod dock;
|
||||||
|
|
@ -39,7 +39,6 @@ pub mod list;
|
||||||
pub mod modal;
|
pub mod modal;
|
||||||
pub mod notification;
|
pub mod notification;
|
||||||
pub mod popover;
|
pub mod popover;
|
||||||
pub mod popup_menu;
|
|
||||||
pub mod progress;
|
pub mod progress;
|
||||||
pub mod radio;
|
pub mod radio;
|
||||||
pub mod resizable;
|
pub mod resizable;
|
||||||
|
|
@ -65,6 +64,7 @@ pub use wry;
|
||||||
pub use crate::Disableable;
|
pub use crate::Disableable;
|
||||||
pub use event::InteractiveElementExt;
|
pub use event::InteractiveElementExt;
|
||||||
pub use focusable::FocusableCycle;
|
pub use focusable::FocusableCycle;
|
||||||
|
pub use menu::{context_menu, popup_menu};
|
||||||
pub use root::{ContextModal, Root};
|
pub use root::{ContextModal, Root};
|
||||||
pub use styled::*;
|
pub use styled::*;
|
||||||
pub use time::*;
|
pub use time::*;
|
||||||
|
|
@ -96,7 +96,7 @@ pub fn init(cx: &mut App) {
|
||||||
list::init(cx);
|
list::init(cx);
|
||||||
modal::init(cx);
|
modal::init(cx);
|
||||||
popover::init(cx);
|
popover::init(cx);
|
||||||
popup_menu::init(cx);
|
menu::init(cx);
|
||||||
table::init(cx);
|
table::init(cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ use gpui::{
|
||||||
Pixels, Point, Position, Stateful, Style, Window,
|
Pixels, Point, Position, Stateful, Style, Window,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::popup_menu::PopupMenu;
|
use crate::menu::popup_menu::PopupMenu;
|
||||||
|
|
||||||
pub trait ContextMenuExt: ParentElement + Sized {
|
pub trait ContextMenuExt: ParentElement + Sized {
|
||||||
fn context_menu(
|
fn context_menu(
|
||||||
8
crates/ui/src/menu/mod.rs
Normal file
8
crates/ui/src/menu/mod.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
use gpui::App;
|
||||||
|
|
||||||
|
pub mod context_menu;
|
||||||
|
pub mod popup_menu;
|
||||||
|
|
||||||
|
pub fn init(cx: &mut App) {
|
||||||
|
popup_menu::init(cx);
|
||||||
|
}
|
||||||
|
|
@ -787,6 +787,7 @@ impl PopupMenu {
|
||||||
disabled,
|
disabled,
|
||||||
} => this.selected(hovered).disabled(*disabled).child(
|
} => this.selected(hovered).disabled(*disabled).child(
|
||||||
h_flex()
|
h_flex()
|
||||||
|
.items_start()
|
||||||
.when(hovered, |this| {
|
.when(hovered, |this| {
|
||||||
this.rounded(cx.theme().radius)
|
this.rounded(cx.theme().radius)
|
||||||
.mx(-INNER_PADDING)
|
.mx(-INNER_PADDING)
|
||||||
|
|
@ -794,9 +795,9 @@ impl PopupMenu {
|
||||||
.bg(cx.theme().accent)
|
.bg(cx.theme().accent)
|
||||||
.text_color(cx.theme().accent_foreground)
|
.text_color(cx.theme().accent_foreground)
|
||||||
})
|
})
|
||||||
.items_start()
|
|
||||||
.child(
|
.child(
|
||||||
h_flex()
|
h_flex()
|
||||||
|
.min_h(ITEM_HEIGHT)
|
||||||
.size_full()
|
.size_full()
|
||||||
.items_center()
|
.items_center()
|
||||||
.gap_x_1()
|
.gap_x_1()
|
||||||
Loading…
Reference in a new issue