Skip to content

Commit

Permalink
add functions to toggle and check dark mode
Browse files Browse the repository at this point in the history
  • Loading branch information
HectorVilas committed Jan 14, 2023
1 parent f3d9edf commit 9acc6e7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/modules/todoHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ export const todoHandler = (() => {
function loadSample(){
if(localStorage.length === 0){
localStorage.setItem("todo", JSON.stringify(todoSample));
localStorage.dark = JSON.stringify(false);
}
}

Expand Down Expand Up @@ -278,9 +279,18 @@ export const todoHandler = (() => {
setLocalStorage(local);
}

function darkMode(isActive){
localStorage.dark = JSON.stringify(isActive);
console.log(localStorage.dark);
}

function isOnDarkMode(){
return JSON.parse(localStorage?.dark);
}

return { toggleFav, togglePin, getFavStatus, deleteTodo, taskCheck,
deleteTask, editTitle, editDescription, editDateDue, editLabel,
createTask, getProjectsTitles, deleteProject, changePriority,
getProject, createTodo, createProject, editProjectTitle, loadSample,
moveDraggedCard }
moveDraggedCard, darkMode, isOnDarkMode }
})();

0 comments on commit 9acc6e7

Please sign in to comment.