ui: Fix end_slot_on_hover API (#59805)
The issue here was that `end_slot_on_hover` would currently only work if `end_slot` was also set. With this, it will now work even if there is no `end_slot`. Release Notes: - N/A
This commit is contained in:
1 parent
502810d204
commit
25d2aaa9f3
1 file changed
+27
-21
@@ -404,30 +404,36 @@ impl RenderOnce for ListItem {
|
|||||||
.children(self.children),
|
.children(self.children),
|
||||||
)
|
)
|
||||||
.when(self.end_slot.is_some(), |this| this.justify_between())
|
.when(self.end_slot.is_some(), |this| this.justify_between())
|
||||||
.when_some(self.end_slot, |this, end_slot| {
|
.map(|this| match self.end_slot_visibility {
|
||||||
this.child(match self.end_slot_visibility {
|
EndSlotVisibility::Always if let Some(end_slot) = self.end_slot => {
|
||||||
EndSlotVisibility::Always => {
|
this.child(h_flex().flex_shrink_1().overflow_hidden().child(end_slot))
|
||||||
h_flex().flex_shrink_1().overflow_hidden().child(end_slot)
|
}
|
||||||
}
|
EndSlotVisibility::OnHover if let Some(end_slot) = self.end_slot => this
|
||||||
EndSlotVisibility::OnHover => h_flex()
|
.child(
|
||||||
.flex_shrink_1()
|
h_flex()
|
||||||
.overflow_hidden()
|
.flex_shrink_1()
|
||||||
.visible_on_hover("list_item")
|
.overflow_hidden()
|
||||||
.child(end_slot),
|
.visible_on_hover("list_item")
|
||||||
EndSlotVisibility::SwapOnHover(hover_slot) => h_flex()
|
.child(end_slot),
|
||||||
|
),
|
||||||
|
EndSlotVisibility::SwapOnHover(hover_slot) => this.child(
|
||||||
|
h_flex()
|
||||||
.relative()
|
.relative()
|
||||||
.flex_shrink_1()
|
.flex_shrink_1()
|
||||||
.child(h_flex().visible_on_hover("list_item").child(hover_slot))
|
.child(h_flex().visible_on_hover("list_item").child(hover_slot))
|
||||||
.child(
|
.when_some(self.end_slot, |this, end_slot| {
|
||||||
h_flex()
|
this.child(
|
||||||
.absolute()
|
h_flex()
|
||||||
.inset_0()
|
.absolute()
|
||||||
.justify_end()
|
.inset_0()
|
||||||
.overflow_hidden()
|
.justify_end()
|
||||||
.group_hover("list_item", |this| this.invisible())
|
.overflow_hidden()
|
||||||
.child(end_slot),
|
.group_hover("list_item", |this| this.invisible())
|
||||||
),
|
.child(end_slot),
|
||||||
})
|
)
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
_ => this,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user