Sha256: cc3c128c20d750856cfde4b2bef046c921f46179b095815f5555223d5fe3ca6e
Contents?: true
Size: 1.16 KB
Versions: 122
Compression:
Stored size: 1.16 KB
Contents
import '@github/tab-container-element' // keep in sync with tab_container_component.rb const DEFAULT_SELECTED_CLASSES: string[] = ['ariadne-border-slate-500', 'ariadne-text-slate-600'] const DEFAULT_UNSELECTED_CLASSES: string[] = [ 'ariadne-text-gray-500', 'hover:ariadne-text-gray-700', 'hover:ariadne-border-gray-300', ] for (const tabContainer of document.getElementsByTagName('tab-container')) { tabContainer.addEventListener('tab-container-change', function (event: Event) { const newPanel = (event as CustomEvent).detail.relatedTarget as HTMLElement const tabContainer = newPanel.closest('tab-container') as HTMLElement const tabList = tabContainer.firstElementChild as HTMLElement const currentTab = tabList.querySelector('[aria-selected="true"]') as HTMLElement const tabId = newPanel.getAttribute('id')?.split('-').slice(1).join('-') const newTab = tabList.querySelector(`#${tabId}`) as HTMLElement currentTab.classList.remove(...DEFAULT_SELECTED_CLASSES) currentTab.classList.add(...DEFAULT_UNSELECTED_CLASSES) newTab.classList.add(...DEFAULT_SELECTED_CLASSES) newTab.classList.remove(...DEFAULT_UNSELECTED_CLASSES) }) }
Version data entries
122 entries across 122 versions & 1 rubygems