Skip to content

Commit

Permalink
Merge pull request #21 from Vibranium1/dark-mode-logo-align
Browse files Browse the repository at this point in the history
Added dark mode logo
  • Loading branch information
Exar04 authored Oct 24, 2023
2 parents a7461d8 + 4439c3e commit 00bf1e3
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
7 changes: 3 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
<body>
<div id="app">
<h1>Simple To-Do List</h1>
<div id="dark-mode-toggle">
<label for="dark-mode-checkbox">Dark Mode</label>
<input type="checkbox" id="dark-mode-checkbox">
</div>
<div id="dark-mode-toggle" class="dark-mode-toggle">
<img src="moon.png" id="dark-mode-logo" alt="Dark Mode Feature" class="mode-logo">
</div>
<ul class="todo-list" id="todo-list">
</ul>
<input type="text" id="new-task" placeholder="New task" class="ToDoSearchBar">
Expand Down
Binary file added moon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 9 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
const darkModeToggle = document.getElementById("dark-mode-toggle");
const darkModeLogo = document.getElementById("dark-mode-logo");
const todoList = document.getElementById("todo-list");
const newTaskInput = document.getElementById("new-task");
const addButton = document.getElementById("add-button");
const darkModeToggle = document.getElementById("dark-mode-checkbox");

darkModeToggle.addEventListener("change", toggleDarkMode);

darkModeToggle.addEventListener("click", toggleDarkMode);

function toggleDarkMode() {
document.body.classList.toggle("dark-mode");
if (document.body.classList.contains("dark-mode")) {
darkModeLogo.src = "sun.png"; // Switch to light mode
} else {
darkModeLogo.src = "moon.png"; // Switch to dark mode
}
}

addButton.addEventListener("click", addTask);
Expand Down
12 changes: 12 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ body {

}

.dark-mode-toggle {
position: absolute;
top: 20px;
right: 20px;
cursor: pointer;
}

.mode-logo {
width: 30px;
height: 30px;
}

h1 {
text-align: center;
}
Expand Down
Binary file added sun.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 00bf1e3

Please sign in to comment.