Sha256: 7865672b5267331ab6a11b84184db18f7fb3260a3b06c6653ed688a340fb7eaa

Contents?: true

Size: 839 Bytes

Versions: 153

Compression:

Stored size: 839 Bytes

Contents

import { Controller } from "@hotwired/stimulus"
import { enter, leave } from "el-transition"

export default class extends Controller {
  static targets = [ "wrapper", "revealable"]
  static classes = [ "hidden" ] // necessary because we're always hiding the mobile menu on larger screens and this is the class used for only mobile screen sizes
  
  open() {
    this.showWrapper()
    this.revealableTargets.forEach(revealableTarget => {
      enter(revealableTarget)
    })
  }
  
  close() {
    Promise.all(
      this.revealableTargets.map(revealableTarget => {
        return leave(revealableTarget)
      })
    ).then(() => {
      this.hideWrapper()
    })
    
  }
  
  showWrapper() {
    this.wrapperTarget.classList.remove(this.hiddenClass)
  }
  
  hideWrapper() {
    this.wrapperTarget.classList.add(this.hiddenClass)
  }
}

Version data entries

153 entries across 153 versions & 1 rubygems

Version Path
bullet_train-1.7.18 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.7.17 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.7.16 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.7.15 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.7.14 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.7.13 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.7.12 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.7.11 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.7.10 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.7.9 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.7.3 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.7.2 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.7.1 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.7.0 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.6.38 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.6.37 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.6.36 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.6.35 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.6.34 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.6.33 app/javascript/controllers/mobile_menu_controller.js