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.14.0 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.13.0 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.12.3 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.12.2 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.12.1 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.12.0 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.11.0 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.10.0 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.9.0 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.8.5 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.8.4 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.8.3 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.8.2 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.8.1 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.8.0 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.7.23 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.7.22 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.7.21 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.7.20 app/javascript/controllers/mobile_menu_controller.js
bullet_train-1.7.19 app/javascript/controllers/mobile_menu_controller.js