Update popover.rs

This commit is contained in:
Nate Butler 2023-11-27 20:12:20 -05:00
parent ca2052b0c1
commit 979ff70196

View file

@ -1,5 +1,5 @@
use gpui::{ use gpui::{
AnyElement, Div, Element, ElementId, IntoElement, ParentElement, RenderOnce, Styled, div, AnyElement, Div, Element, ElementId, IntoElement, ParentElement, RenderOnce, Styled,
WindowContext, WindowContext,
}; };
use smallvec::SmallVec; use smallvec::SmallVec;
@ -44,23 +44,16 @@ impl RenderOnce for Popover {
type Rendered = Div; type Rendered = Div;
fn render(self, cx: &mut WindowContext) -> Self::Rendered { fn render(self, cx: &mut WindowContext) -> Self::Rendered {
v_stack() div()
.relative() .flex()
.elevation_2(cx) .gap_1()
.p_1() .child(v_stack().elevation_2(cx).px_1().children(self.children))
.children(self.children)
.when_some(self.aside, |this, aside| { .when_some(self.aside, |this, aside| {
// TODO: This will statically position the aside to the top right of the popover.
// We should update this to use gpui2::overlay avoid collisions with the window edges.
this.child( this.child(
v_stack() v_stack()
.top_0()
.left_full()
.ml_1()
.absolute()
.elevation_2(cx) .elevation_2(cx)
.bg(cx.theme().colors().surface_background) .bg(cx.theme().colors().surface_background)
.p_1() .px_1()
.child(aside), .child(aside),
) )
}) })