parent
410be96446
commit
501794ea82
@ -1,22 +1,12 @@ |
|||||||
import Cookies from 'js-cookie' |
import Cookies from 'js-cookie' |
||||||
const permantDarkModeEl = document.getElementById('permanent-dark-mode') |
|
||||||
// @ts-ignore
|
|
||||||
const permanentDarkModeEnabled = false || (permantDarkModeEl && permantDarkModeEl.textContent === 'true') |
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const darkModeChangerEl = document.getElementsByClassName('dark-mode-changer')[0] |
const darkModeChangerEl = document.getElementsByClassName('dark-mode-changer')[0] |
||||||
|
|
||||||
if (permanentDarkModeEnabled) { |
|
||||||
// @ts-ignore
|
|
||||||
darkModeChangerEl.style.display = 'none' |
|
||||||
} |
|
||||||
|
|
||||||
darkModeChangerEl && darkModeChangerEl.addEventListener('click', function () { |
darkModeChangerEl && darkModeChangerEl.addEventListener('click', function () { |
||||||
if (!permanentDarkModeEnabled) { |
if (Cookies.get('chakra-ui-color-mode') === 'dark') { |
||||||
if (Cookies.get('chakra-ui-color-mode') === 'dark') { |
Cookies.set('chakra-ui-color-mode', 'light') |
||||||
Cookies.set('chakra-ui-color-mode', 'light') |
} else { |
||||||
} else { |
Cookies.set('chakra-ui-color-mode', 'dark') |
||||||
Cookies.set('chakra-ui-color-mode', 'dark') |
|
||||||
} |
|
||||||
document.location.reload() |
|
||||||
} |
} |
||||||
|
document.location.reload() |
||||||
}) |
}) |
||||||
|
Loading…
Reference in new issue