Checkpoint - try using overlay for completions popover

[no ci]
This commit is contained in:
Nate Butler 2023-11-27 11:22:19 -05:00
parent 1acc6b462f
commit 8a35a02863
3 changed files with 34 additions and 23 deletions

View file

@ -1,11 +1,11 @@
use gpui::{
AnyElement, Div, Element, ElementId, IntoElement, ParentElement, RenderOnce, Styled,
div, AnyElement, Div, Element, ElementId, IntoElement, ParentElement, RenderOnce, Styled,
WindowContext,
};
use smallvec::SmallVec;
use theme2::ActiveTheme;
use crate::{v_stack, StyledExt};
use crate::{h_stack, v_stack, StyledExt};
/// A popover is used to display a menu or show some options.
///
@ -44,21 +44,18 @@ impl RenderOnce for Popover {
type Rendered = Div;
fn render(self, cx: &mut WindowContext) -> Self::Rendered {
v_stack()
.relative()
.elevation_2(cx)
.p_1()
.children(self.children)
div()
.flex()
.flex_none()
.gap_1()
.child(v_stack().elevation_2(cx).p_1().children(self.children))
.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(
v_stack()
.top_0()
.left_full()
.ml_1()
.absolute()
.elevation_2(cx)
.flex_1()
.bg(cx.theme().colors().surface_background)
.p_1()
.child(aside),