Sha256: 36a58e80e1d0a22cb3e7d0acc11395ecaff41302e18b659fc513f1a146621010

Contents?: true

Size: 1015 Bytes

Versions: 3

Compression:

Stored size: 1015 Bytes

Contents

import {Controller} from '@hotwired/stimulus'

export default class SlideoverComponent extends Controller {
  static targets = ['expandable', 'expandWrapper', 'slidePanel', 'buttonWrapper']

  declare readonly expandableTarget: HTMLDivElement
  declare readonly expandWrapperTarget: HTMLDivElement
  declare readonly slidePanelTargets: [HTMLDivElement]
  declare readonly buttonWrapperTarget: HTMLDivElement

  toggle() {
    this.expandableTarget.classList.toggle('hidden')
    this.expandWrapperTarget.classList.toggle('bg-filter-panel')
    for (const slidePanel of this.slidePanelTargets) {
      slidePanel.classList.toggle('hidden')
    }
    this.buttonWrapperTarget.classList.toggle('bg-filter-panel')
    if (document.getElementById('btnClose')?.classList.contains('hidden')) {
      const formID = this.buttonWrapperTarget.getAttribute('data-slideover-component-form-id')
      if (formID) {
        const form = <HTMLFormElement>document.getElementById(formID)
        form?.submit()
      }
    }
  }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.6 app/components/ariadne/slideover-component.ts
ariadne_view_components-0.0.5 app/components/ariadne/slideover-component.ts
ariadne_view_components-0.0.4 app/components/ariadne/slideover-component.ts