mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 21:27:49 +02:00
Update theme icon based on the selected one
This commit is contained in:
@@ -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()
|
||||
|
Reference in New Issue
Block a user