Sha256: ff12f6701b47352c0ac880c22a1f366f92ba42686e0a41684dafbb8b409fe379
Contents?: true
Size: 987 Bytes
Versions: 4
Compression:
Stored size: 987 Bytes
Contents
import { Controller } from '@hotwired/stimulus' import Cookies from './../utils/cookies' import { fadeOut, fadeIn } from './../utils/utils' export default class extends Controller { connect () { if (document.getElementById('sidebar').classList.contains('opened')) { document.querySelector('.navbar .navbar-brand').style.visibility = 'hidden' } } expandNavbar (e) { const icon = this.element.querySelector('i') if (document.getElementById('sidebar').classList.toggle('opened')) { icon.classList.add('bi-chevron-left') icon.classList.remove('bi-chevron-right') fadeOut(document.querySelector('.navbar .navbar-brand')) } else { icon.classList.remove('bi-chevron-left') icon.classList.add('bi-chevron-right') fadeIn(document.querySelector('.navbar .navbar-brand')) } const isOpened = document.getElementById('sidebar').classList.contains('opened') new Cookies().setCookie('navbar_expand', isOpened, 30) } }
Version data entries
4 entries across 4 versions & 1 rubygems