Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions DayZen/css/header.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ header {
margin-right: 10px;
}

/* .logo h1{
color: white;
} */

header h1 {
font-size: 2em;
font-weight: bold;
Expand Down
2 changes: 1 addition & 1 deletion DayZen/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ <h1 class="reflect mb-0">DayZen</h1>
</div>
</nav>

<script src="js/theme-toggle.js"></script>
<!-- <script src="js/theme-toggle.js"></script> -->
</header>
<section class="hero">
<div class="container">
Expand Down
35 changes: 20 additions & 15 deletions DayZen/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ let routines = [routine];
function listRoutines() {
let routineList = document.getElementById("routine-list");

// routineList.innerHTML = "";
// routineList.innerHTML = "";

routines.forEach(function (routine, index) {
routineList.innerHTML += `
Expand Down Expand Up @@ -82,20 +82,25 @@ document.addEventListener("DOMContentLoaded", function () {
});
});

const themeIcon = document.getElementById("theme-icon");
const body = document.body;

themeIcon.addEventListener("click", () => {
body.classList.toggle("dark-mode");
body.classList.toggle("light-mode");

// Toggle between sun and moon icons
if (body.classList.contains("dark-mode")) {
themeIcon.src = "assets/images/moon_1.png"; // Change to moon icon for dark mode
} else {
themeIcon.src = "assets/images/sun.png"; // Change to sun icon for light mode
}
});
// const themeIcon = document.getElementById("theme-icon");
// const body = document.body;

// themeIcon.addEventListener("click", () => {
// console.log("A runs");
// body.classList.toggle("dark-mode");
// body.classList.toggle("light-mode");
// console.log(body.classList);

// // Toggle between sun and moon icons
// if (body.classList.contains("dark-mode")) {
// console.log("turn dark");
// // themeIcon.src = "assets/images/moon_1.png"; // Change to moon icon for dark mode
// } else {
// console.log("turn light");
// // themeIcon.src = "assets/images/sun.png"; // Change to sun icon for light mode
// }
// console.log("end");
// });

// window.onload = function () {
// // Select all tour steps and the overlay
Expand Down
12 changes: 6 additions & 6 deletions DayZen/js/theme-toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ document.addEventListener('DOMContentLoaded', function() {

// Toggle theme on click
themeIcon.addEventListener('click', function() {
body.classList.toggle("dark-mode");
body.classList.toggle("light-mode");
if (body.classList.contains('dark-mode')) {
body.classList.replace('dark-mode', 'light-mode');
themeIcon.src = basePath + 'assets/images/icons/sun.png'; // Path to sun icon
localStorage.setItem('dayzen_theme', 'light');
} else {
body.classList.replace('light-mode', 'dark-mode');
themeIcon.src = basePath + 'assets/images/icons/moon_1.png'; // Path to moon icon
themeIcon.src = basePath + 'assets/images/icons/moon_1.png'; // Path to sun icon
localStorage.setItem('dayzen_theme', 'dark');
} else {
themeIcon.src = basePath + 'assets/images/icons/sun.png'; // Path to moon icon
localStorage.setItem('dayzen_theme', 'light');
}

// Log the icon path after toggle
Expand Down