Factor out popup menu component.

Factor out the popup menu inside user tooltips into a reusable
component.
This commit is contained in:
evazion
2021-01-19 20:22:41 -06:00
parent 90567bfc61
commit ccae422961
9 changed files with 87 additions and 58 deletions

View 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;