Sha256: 7b6cd9ce4aa9307b15d2c4403a942c4b6de90ba2572e9d2efa47ec7a0a70f5ea

Contents?: true

Size: 689 Bytes

Versions: 13

Compression:

Stored size: 689 Bytes

Contents

import { Controller } from "@hotwired/stimulus"
import { useClickOutside, useTransition } from "stimulus-use"

export default class extends Controller {
  static targets = ["menu", "open", "close"]

  connect() {
    useClickOutside(this);
    useTransition(this, { element: this.menuTarget })
  }

  toggle() {
    this.toggleTransition();
  }

  clickOutside() {
    if (!this.menuTarget.classList.contains("hidden")) {
      this.toggleTransition();
    }
  }

  enter() {
    this.openTarget.classList.toggle("hidden")
    this.closeTarget.classList.toggle("hidden")
  }

  leave() {
    this.openTarget.classList.toggle("hidden")
    this.closeTarget.classList.toggle("hidden")
  }
}

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
maquina-0.7.2 app/assets/javascripts/controllers/mobile_menu_controller.js
maquina-0.7.1 app/assets/javascripts/controllers/mobile_menu_controller.js
maquina-0.5.2 app/assets/javascripts/maquina/controllers/mobile_menu_controller.js
maquina-0.5.1 app/assets/javascripts/maquina/controllers/mobile_menu_controller.js
maquina-0.4.0 app/assets/javascripts/maquina/controllers/mobile_menu_controller.js
maquina-0.3.0 app/assets/javascripts/maquina/controllers/mobile_menu_controller.js
maquina-0.2.5 app/assets/javascripts/maquina/controllers/mobile_menu_controller.js
maquina-0.2.4 app/assets/javascripts/maquina/controllers/mobile_menu_controller.js
maquina-0.2.3 app/assets/javascripts/maquina/controllers/mobile_menu_controller.js
maquina-0.2.2 app/assets/javascripts/maquina/controllers/mobile_menu_controller.js
maquina-0.2.1 app/assets/javascripts/maquina/controllers/mobile_menu_controller.js
maquina-0.2.0 app/assets/javascripts/maquina/controllers/mobile_menu_controller.js
maquina-0.1.0 app/assets/javascripts/maquina/controllers/mobile_menu_controller.js