Factor out popup menu component.
Factor out the popup menu inside user tooltips into a reusable component.
This commit is contained in:
26
app/components/popup_menu_component/popup_menu_component.js
Normal file
26
app/components/popup_menu_component/popup_menu_component.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { delegate } from 'tippy.js';
|
||||
import 'tippy.js/dist/tippy.css';
|
||||
|
||||
class PopupMenuComponent {
|
||||
static initialize() {
|
||||
delegate("body", {
|
||||
allowHTML: true,
|
||||
interactive: true,
|
||||
theme: "common-tooltip",
|
||||
target: "a.popup-menu-button",
|
||||
placement: "bottom-start",
|
||||
trigger: "click",
|
||||
content: PopupMenuComponent.content,
|
||||
});
|
||||
}
|
||||
|
||||
static content(element) {
|
||||
let $content = $(element).parents(".popup-menu").find(".popup-menu-content");
|
||||
$content.show();
|
||||
return $content.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(PopupMenuComponent.initialize);
|
||||
|
||||
export default PopupMenuComponent;
|
||||
Reference in New Issue
Block a user