mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
22 lines
414 B
JavaScript
22 lines
414 B
JavaScript
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");
|
|
}
|
|
}
|