Inset ContextMenu
headers (#9197)
This PR insets the headers within `ContextMenu`s to give them some more breathing room. #### Before <img width="347" alt="Screenshot 2024-03-11 at 4 13 31 PM" src="https://github.com/zed-industries/zed/assets/1486634/73a56d68-d40e-4396-b584-f443197b69d6"> #### After <img width="354" alt="Screenshot 2024-03-11 at 4 12 43 PM" src="https://github.com/zed-industries/zed/assets/1486634/44c12a07-0784-4c94-b194-245f5cf94b2b"> Release Notes: - Added padding to headers in context menus.
This commit is contained in:
parent
02dcdd0228
commit
c0b1f74794
2 changed files with 80 additions and 71 deletions
|
@ -272,11 +272,12 @@ impl Render for ContextMenu {
|
|||
})
|
||||
.flex_none()
|
||||
.child(List::new().children(self.items.iter_mut().enumerate().map(
|
||||
|(ix, item)| match item {
|
||||
|(ix, item)| {
|
||||
match item {
|
||||
ContextMenuItem::Separator => ListSeparator.into_any_element(),
|
||||
ContextMenuItem::Header(header) => {
|
||||
ListSubHeader::new(header.clone()).into_any_element()
|
||||
}
|
||||
ContextMenuItem::Header(header) => ListSubHeader::new(header.clone())
|
||||
.inset(true)
|
||||
.into_any_element(),
|
||||
ContextMenuItem::Entry {
|
||||
label,
|
||||
handler,
|
||||
|
@ -317,7 +318,9 @@ impl Render for ContextMenu {
|
|||
self.action_context
|
||||
.as_ref()
|
||||
.map(|focus| {
|
||||
KeyBinding::for_action_in(&**action, focus, cx)
|
||||
KeyBinding::for_action_in(
|
||||
&**action, focus, cx,
|
||||
)
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
KeyBinding::for_action(&**action, cx)
|
||||
|
@ -347,6 +350,7 @@ impl Render for ContextMenu {
|
|||
.child(entry_render(cx))
|
||||
.into_any_element()
|
||||
}
|
||||
}
|
||||
},
|
||||
))),
|
||||
)
|
||||
|
|
|
@ -21,6 +21,11 @@ impl ListSubHeader {
|
|||
self.start_slot = left_icon;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn inset(mut self, inset: bool) -> Self {
|
||||
self.inset = inset;
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl RenderOnce for ListSubHeader {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue