ui: Use PopoverMenu::new for constructing PopoverMenus (#13178)

This PR replaces the `popover_menu` function for constructing
`PopoverMenu`s with a `PopoverMenu::new` associated function.

This brings `PopoverMenu` in line with our other UI components.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-06-17 18:14:37 -04:00 committed by GitHub
parent 59104a08fd
commit 78e0f71a28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 53 additions and 50 deletions

View file

@ -9,7 +9,7 @@ use language::{Buffer, OwnedSyntaxLayer};
use std::{mem, ops::Range};
use theme::ActiveTheme;
use tree_sitter::{Node, TreeCursor};
use ui::{h_flex, popover_menu, ButtonLike, Color, ContextMenu, Label, LabelCommon, PopoverMenu};
use ui::{h_flex, ButtonLike, Color, ContextMenu, Label, LabelCommon, PopoverMenu};
use workspace::{
item::{Item, ItemHandle, TabContentParams},
SplitDirection, ToolbarItemEvent, ToolbarItemLocation, ToolbarItemView, Workspace,
@ -431,7 +431,7 @@ impl SyntaxTreeToolbarItemView {
let view = cx.view().clone();
Some(
popover_menu("Syntax Tree")
PopoverMenu::new("Syntax Tree")
.trigger(Self::render_header(&active_layer))
.menu(move |cx| {
ContextMenu::build(cx, |mut menu, cx| {
@ -492,7 +492,7 @@ fn format_node_range(node: Node) -> String {
impl Render for SyntaxTreeToolbarItemView {
fn render(&mut self, cx: &mut ViewContext<'_, Self>) -> impl IntoElement {
self.render_menu(cx)
.unwrap_or_else(|| popover_menu("Empty Syntax Tree"))
.unwrap_or_else(|| PopoverMenu::new("Empty Syntax Tree"))
}
}