import { Controller } from '@hotwired/stimulus'; export default class extends Controller { connect() { const main = document.querySelector('main') const form = document.querySelector('form') if (sessionStorage.getItem('size')) { main.classList.toggle('size-max', true) if (form) form.classList.toggle('size-max-form', true) } else { main.classList.toggle('size-max', false) if (form) form.classList.toggle('size-max-form', false) } } resize() { const main = document.querySelector('main') const form = document.querySelector('form') if (main.classList.toggle('size-max')) { if (form) form.classList.toggle('size-max-form', true) sessionStorage.setItem('size', 'size-max') } else { if (form) form.classList.toggle('size-max-form', false) sessionStorage.removeItem('size') } } }