agent: Show nav dropdown close button only on hover (#29732)

This commit is contained in:
Danilo Leal
2025-05-01 11:21:57 -03:00
committed by GitHub
parent e07ffe7cf1
commit 122af4fd53
3 changed files with 61 additions and 5 deletions
@@ -16,6 +16,7 @@ pub enum ListItemSpacing {
#[derive(IntoElement)]
pub struct ListItem {
id: ElementId,
group_name: Option<SharedString>,
disabled: bool,
selected: bool,
spacing: ListItemSpacing,
@@ -48,6 +49,7 @@ impl ListItem {
pub fn new(id: impl Into<ElementId>) -> Self {
Self {
id: id.into(),
group_name: None,
disabled: false,
selected: false,
spacing: ListItemSpacing::Dense,
@@ -72,6 +74,11 @@ impl ListItem {
}
}
pub fn group_name(mut self, group_name: impl Into<SharedString>) -> Self {
self.group_name = Some(group_name.into());
self
}
pub fn spacing(mut self, spacing: ListItemSpacing) -> Self {
self.spacing = spacing;
self
@@ -196,6 +203,7 @@ impl RenderOnce for ListItem {
fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {
h_flex()
.id(self.id)
.when_some(self.group_name, |this, group| this.group(group))
.w_full()
.relative()
// When an item is inset draw the indent spacing outside of the item