audit menu
This commit is contained in:
+16
-6
@@ -7,7 +7,7 @@ use gpui::{
|
||||
Entity, InteractiveElement as _, IntoElement, KeyDownEvent, MouseButton, MouseDownEvent,
|
||||
ParentElement as _, Pixels, Point, RenderOnce, Role, ScrollHandle, SharedString,
|
||||
StatefulInteractiveElement as _, Styled as _, Window, anchored, canvas, deferred, div,
|
||||
ease_out_quint, px,
|
||||
ease_out_quint, px, relative,
|
||||
};
|
||||
use gpui_native_icons::{IconRole, icon as icon_glyph};
|
||||
use gpui_native_theme::ActiveTheme as _;
|
||||
@@ -138,6 +138,9 @@ struct MenuChrome {
|
||||
radius_sm: Pixels,
|
||||
icon_size: Pixels,
|
||||
dense_icon_size: Pixels,
|
||||
menu_item_height: Pixels,
|
||||
spacing_unit: Pixels,
|
||||
text_size: Pixels,
|
||||
shadow: Vec<BoxShadow>,
|
||||
}
|
||||
|
||||
@@ -258,6 +261,9 @@ impl RenderOnce for Menu {
|
||||
radius_sm: theme.radius.sm,
|
||||
icon_size: theme.sizes.medium.icon_size,
|
||||
dense_icon_size: theme.sizes.medium.dense_icon_size,
|
||||
menu_item_height: theme.sizes.medium.menu_item_height,
|
||||
spacing_unit: theme.spacing.unit,
|
||||
text_size: theme.sizes.medium.text_size,
|
||||
shadow: theme.elevations.popover.shadows(),
|
||||
},
|
||||
theme.motion.overlay,
|
||||
@@ -374,7 +380,7 @@ impl RenderOnce for Menu {
|
||||
.aria_label(label)
|
||||
.mt_1()
|
||||
.min_w_56()
|
||||
.p_1()
|
||||
.p(chrome.spacing_unit)
|
||||
.bg(chrome.surface)
|
||||
.text_color(chrome.foreground)
|
||||
.rounded(chrome.radius_overlay)
|
||||
@@ -454,8 +460,9 @@ fn render_item(
|
||||
match item.kind {
|
||||
MenuItemKind::Separator => div()
|
||||
.h(px(1.))
|
||||
.mx_2()
|
||||
.my_1()
|
||||
.debug_selector(move || format!("menu-separator-{index}"))
|
||||
.mx(chrome.spacing_unit * 2.0)
|
||||
.my(chrome.spacing_unit)
|
||||
.bg(chrome.border)
|
||||
.into_any_element(),
|
||||
MenuItemKind::Action => {
|
||||
@@ -468,11 +475,14 @@ fn render_item(
|
||||
|
||||
div()
|
||||
.id(("menu-item", index))
|
||||
.debug_selector(move || format!("menu-item-{index}"))
|
||||
.flex()
|
||||
.items_center()
|
||||
.gap_2()
|
||||
.px_2()
|
||||
.py_1()
|
||||
.min_h(chrome.menu_item_height)
|
||||
.px(chrome.spacing_unit * 2.0)
|
||||
.text_size(chrome.text_size)
|
||||
.line_height(relative(1.0))
|
||||
.rounded(chrome.radius_sm)
|
||||
.map(|row| {
|
||||
if disabled {
|
||||
|
||||
Reference in New Issue
Block a user