Retrospring/app/javascript/retrospring/features/front/theme.ts

14 lines
370 B
TypeScript
Raw Normal View History

2022-04-09 17:37:54 -07:00
export function themeButtonHandler(event: Event): void {
const button = event.currentTarget as HTMLButtonElement;
event.preventDefault();
const theme = button.dataset.theme;
document.body.setAttribute('class', 'not-logged-in');
if (theme === 'reset') return;
if (!document.body.classList.contains(theme)) {
document.body.classList.add(theme);
}
}