Position contacts and user menus

Using the new approach for consistency
This commit is contained in:
Petros Amoiridis 2023-03-14 09:25:08 +02:00
parent 3464961aa4
commit 86ed5b8b83
No known key found for this signature in database
2 changed files with 17 additions and 31 deletions

View file

@ -322,20 +322,7 @@ impl CollabTitlebarItem {
] ]
}; };
user_menu.show( user_menu.show(Default::default(), AnchorCorner::TopRight, items, cx);
vec2f(
theme
.workspace
.titlebar
.user_menu_button
.default
.button_width,
theme.workspace.titlebar.height,
),
AnchorCorner::TopRight,
items,
cx,
);
}); });
} }
@ -402,7 +389,6 @@ impl CollabTitlebarItem {
theme.tooltip.clone(), theme.tooltip.clone(),
cx, cx,
) )
.aligned()
.boxed(), .boxed(),
) )
.with_children(badge) .with_children(badge)
@ -547,10 +533,15 @@ impl CollabTitlebarItem {
) )
.contained() .contained()
.with_margin_left(theme.workspace.titlebar.item_spacing) .with_margin_left(theme.workspace.titlebar.item_spacing)
.aligned()
.boxed(), .boxed(),
) )
.with_child(ChildView::new(&self.user_menu, cx).boxed()) .with_child(
ChildView::new(&self.user_menu, cx)
.aligned()
.bottom()
.right()
.boxed(),
)
.boxed() .boxed()
} }
@ -572,22 +563,18 @@ impl CollabTitlebarItem {
fn render_contacts_popover_host<'a>( fn render_contacts_popover_host<'a>(
&'a self, &'a self,
theme: &'a theme::Titlebar, _theme: &'a theme::Titlebar,
cx: &'a RenderContext<Self>, cx: &'a RenderContext<Self>,
) -> Option<ElementBox> { ) -> Option<ElementBox> {
self.contacts_popover.as_ref().map(|popover| { self.contacts_popover.as_ref().map(|popover| {
Overlay::new( Overlay::new(ChildView::new(popover, cx).boxed())
ChildView::new(popover, cx) .with_fit_mode(OverlayFitMode::SwitchAnchor)
.contained() .with_anchor_corner(AnchorCorner::TopRight)
.with_margin_top(theme.height) .with_z_index(999)
.with_margin_left(theme.toggle_contacts_button.default.button_width) .aligned()
.with_margin_right(-theme.toggle_contacts_button.default.button_width) .bottom()
.boxed(), .right()
) .boxed()
.with_fit_mode(OverlayFitMode::SwitchAnchor)
.with_anchor_corner(AnchorCorner::BottomLeft)
.with_z_index(999)
.boxed()
}) })
} }

View file

@ -8,7 +8,6 @@ export default function contactsPopover(colorScheme: ColorScheme) {
background: background(layer), background: background(layer),
cornerRadius: 6, cornerRadius: 6,
padding: { top: 6, bottom: 6 }, padding: { top: 6, bottom: 6 },
margin: { top: -6 },
shadow: colorScheme.popoverShadow, shadow: colorScheme.popoverShadow,
border: border(layer), border: border(layer),
width: 300, width: 300,