mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-14 04:04:23 +00:00
Creates a vertical-ellipsis-menu component
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { Controller } from "stimulus";
|
||||
|
||||
export default class extends Controller {
|
||||
static targets = ["content"];
|
||||
|
||||
connect() {
|
||||
super.connect();
|
||||
window.addEventListener("click", (e) => {
|
||||
if (this.element.contains(e.target)) return;
|
||||
this.#hide();
|
||||
});
|
||||
}
|
||||
|
||||
toggle() {
|
||||
this.contentTarget.classList.toggle("show");
|
||||
}
|
||||
|
||||
#hide() {
|
||||
this.contentTarget.classList.remove("show");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user