mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
17 lines
490 B
JavaScript
17 lines
490 B
JavaScript
import { Controller } from "stimulus";
|
|
|
|
export default class extends Controller {
|
|
static targets = ["chevron"];
|
|
static values = { selector: String };
|
|
|
|
toggle(event) {
|
|
if (this.hasChevronTarget) {
|
|
this.chevronTarget.classList.toggle("icon-chevron-down");
|
|
this.chevronTarget.classList.toggle("icon-chevron-up");
|
|
}
|
|
|
|
const element = document.querySelector(this.selectorValue);
|
|
element.style.display = element.style.display === "none" ? "block" : "none";
|
|
}
|
|
}
|