diff --git a/crates/ui2/src/components/popover.rs b/crates/ui2/src/components/popover.rs index 74478e40512cc6da5753caa6fb39a097f713cd20..a919cc541753b3f7d4109ea673bf7b55f3c8c500 100644 --- a/crates/ui2/src/components/popover.rs +++ b/crates/ui2/src/components/popover.rs @@ -1,5 +1,6 @@ use gpui::{ - AnyElement, Component, Div, ElementId, ParentElement, RenderOnce, Styled, WindowContext, + AnyElement, Component, Div, Element, ElementId, ParentElement, RenderOnce, Styled, + WindowContext, }; use smallvec::SmallVec; @@ -8,7 +9,7 @@ use crate::{v_stack, StyledExt}; #[derive(RenderOnce)] pub struct Popover { children: SmallVec<[AnyElement; 2]>, - aside: Option>, + aside: Option, } impl Component for Popover { @@ -30,7 +31,7 @@ impl Component for Popover { .absolute() .elevation_2(cx) .p_1() - .children(aside), + .child(aside), ) }) } @@ -43,6 +44,14 @@ impl Popover { aside: None, } } + + pub fn aside(mut self, aside: impl RenderOnce) -> Self + where + Self: Sized, + { + self.aside = Some(aside.render_once().into_any()); + self + } } impl ParentElement for Popover {