Sha256: aac3195ff62de7382df96736bb7bf93ebf9a620b501ca170a131a802b50acc6a
Contents?: true
Size: 1.52 KB
Versions: 28
Compression:
Stored size: 1.52 KB
Contents
// import {Controller} from '@hotwired/stimulus' // export default class CommentComponent extends Controller { // static targets = ['tab', 'tabBarComponent'] // declare readonly commentComponentTarget: HTMLDivElement // declare readonly tabBarComponentTarget: HTMLElement // technically a `nav but typescript can't find it? // declare readonly tabTargets: [HTMLButtonElement] // // keep in sync with comment_component.rb // SELECTED_TAB_CLASSES = ['ariadne-border-indigo-500', 'ariadne-text-indigo-600'] // PUBLIC_BACKGROUND_COLOR = 'ariadne-bg-white' // INTERNAL_BACKGROUND_COLOR = 'ariadne-bg-internal-message' // toggleTab() { // for (const tab of this.tabTargets) { // if (tab.hasAttribute('aria-selected')) { // tab.classList.remove(...this.SELECTED_TAB_CLASSES) // this.toggleBackgrounds(tab, false) // tab.removeAttribute('aria-selected') // } else { // tab.setAttribute('aria-selected', 'true') // tab.classList.add(...this.SELECTED_TAB_CLASSES) // this.toggleBackgrounds(tab, true) // } // } // } // toggleBackgrounds(tab: HTMLButtonElement, publicComment: boolean) { // if (publicComment) { // this.tabBarComponentTarget.classList.add(this.PUBLIC_BACKGROUND_COLOR) // this.tabBarComponentTarget.classList.remove(this.INTERNAL_BACKGROUND_COLOR) // this.tabBarComponentTarget.classList.remove(this.PUBLIC_BACKGROUND_COLOR) // this.tabBarComponentTarget.classList.add(this.INTERNAL_BACKGROUND_COLOR) // } // } // }
Version data entries
28 entries across 28 versions & 1 rubygems