clone of github.com/decent-newsroom/newsroom
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.
 
 
 
 
 
 

23 lines
647 B

import { Controller } from '@hotwired/stimulus';
export default class extends Controller {
static targets = ['tab', 'panel'];
switch(event) {
const panelName = event.currentTarget.dataset.panel;
// Update tab states
this.tabTargets.forEach(tab => {
tab.classList.toggle(
'is-active',
tab.dataset.panel === panelName
);
});
// Update panel visibility
this.panelTargets.forEach(panel => {
const isActive = panel.dataset.panel === panelName;
panel.classList.toggle('is-hidden', !isActive);
});
}
}