import { Controller } from '@hotwired/stimulus'; /* * Off-canvas mobile navigation drawer. Ported from myep. * * Two instances cooperate through a Stimulus outlet: the opener button in the header and the * drawer itself. Purely client-side -- htmx is not involved. */ export default class extends Controller { static outlets = ['mobilenav']; static classes = ['closed']; trigger({ params: { mode } }) { this.mobilenavOutlet.toggle(mode); } toggle(mode) { // Added only now, so the drawer does not animate into place on first paint. this.element.classList.add('transition-transform', 'duration-300'); this.element.classList.toggle(this.closedClass, 'close' === mode); } }