You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
583 B
17 lines
583 B
import { Controller } from '@hotwired/stimulus'; |
|
|
|
// Handles tab switching for the left article list sidebar, matching the right sidebar logic |
|
export default class extends Controller { |
|
static targets = ['tab', 'panel']; |
|
|
|
switch(event) { |
|
const panel = event.currentTarget.dataset.panel; |
|
this.tabTargets.forEach(tab => { |
|
tab.classList.toggle('is-active', tab.dataset.panel === panel); |
|
}); |
|
this.panelTargets.forEach(panelEl => { |
|
panelEl.classList.toggle('is-hidden', panelEl.dataset.panel !== panel); |
|
}); |
|
} |
|
} |
|
|
|
|