WIP: Implement frontend

This commit is contained in:
Björn Fromme
2023-09-18 13:10:20 +02:00
parent bfc5e5e242
commit ce97017ac4
70 changed files with 8751 additions and 337 deletions
+32
View File
@@ -0,0 +1,32 @@
import { Controller } from '@hotwired/stimulus'
export default class extends Controller {
static classes = [ 'buttonActive' ]
static targets = [ 'button', 'tab' ]
static values = { activeTab: Number }
select({ params: { tab } }) {
let selectedTab = tab
this.activeTabValue = selectedTab
this.element.dispatchEvent(new CustomEvent('select', {
detail: {
tab: selectedTab
}
}))
}
activeTabValueChanged(activeTab) {
this.tabTargets.forEach((element, index) => {
element.classList.toggle('hidden', activeTab !== index)
})
this.buttonTargets.forEach((element, index) => {
if (this.hasButtonActiveClass) {
element.classList.toggle(this.buttonActiveClass, activeTab === index)
}
})
}
}