mirror of
https://github.com/zyachel/quetre.git
synced 2025-04-01 20:17:36 +03:00
fix(theme): fix theme not being applied on a single click
This commit is contained in:
parent
69f464d7f7
commit
c5dff2a617
1 changed files with 2 additions and 1 deletions
|
@ -17,7 +17,8 @@ const setMetaTheme = () => {
|
|||
// EVENT LISTENER
|
||||
////////////////////////////////////////////////////////
|
||||
btnTheme.addEventListener('click', () => {
|
||||
const themeToSet = document.documentElement.getAttribute('theme') === 'light' ? 'dark' : 'light';
|
||||
const curTheme = document.documentElement.getAttribute('theme') ?? 'light';
|
||||
const themeToSet = curTheme === 'light' ? 'dark' : 'light';
|
||||
setTheme(themeToSet);
|
||||
if (isLocalStorageAccessible()) localStorage.setItem('theme', themeToSet);
|
||||
setMetaTheme();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue