Update theme icon based on the selected one

This commit is contained in:
2023-09-18 21:39:15 +02:00
parent 46a2aa7011
commit 8e0a18d707
2 changed files with 14 additions and 13 deletions

View File

@@ -76,11 +76,9 @@
return
}
// FIXME
//const themeSwitcherText = document.querySelector('#bd-theme-text')
//const activeThemeIcon = document.querySelector('.theme-icon-active use')
const activeThemeIcon = document.querySelector('.theme-icon-active i')
const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`)
//const svgOfActiveBtn = btnToActive.querySelector('svg use').getAttribute('href')
const biOfActiveBtn = btnToActive.querySelector('.theme-icon i').getAttribute('class')
document.querySelectorAll('[data-bs-theme-value]').forEach(element => {
element.classList.remove('active')
@@ -89,10 +87,7 @@
btnToActive.classList.add('active')
btnToActive.setAttribute('aria-pressed', 'true')
// FIXME
//activeThemeIcon.setAttribute('href', svgOfActiveBtn)
//const themeSwitcherLabel = `${themeSwitcherText.textContent} (${btnToActive.dataset.bsThemeValue})`
//themeSwitcher.setAttribute('aria-label', themeSwitcherLabel)
activeThemeIcon.setAttribute('class', biOfActiveBtn)
if (focus) {
themeSwitcher.focus()