import { Controller } from "@hotwired/stimulus"

export default class extends Controller {
  static targets = ["divA"] // Add targets for all your divs

  connect() {
    this.toggleDivs() // Call on connect to set initial state
  }

  toggleDivs() {
    const selectedValue = this.element.querySelector('select').value;
    console.log("sv: ")

    // Hide all divs first
    this.divATarget.classList.add("hidden");

    // Show the relevant div based on selection
    if (selectedValue === "cig+") {
      this.divATarget.classList.remove("hidden");
    }
  }
}