forked from makersacademy/acebook-java-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/origin/main'
- Loading branch information
Showing
13 changed files
with
201 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<!DOCTYPE html> | ||
<html xmlns:th="http://www.thymeleaf.org"> | ||
<head> | ||
<style> | ||
/* Light Mode Styles */ | ||
.light-mode { | ||
background-color: #f7fafc; /* Tailwind light mode bg-gray-100 */ | ||
color: #1a202c; /* Tailwind light mode text-gray-900 */ | ||
} | ||
|
||
/* Dark Mode Styles */ | ||
.dark-mode { | ||
background-color: #1a202c; /* Tailwind dark mode bg-gray-900 */ | ||
color: #cbd5e0; /* Tailwind dark mode text-gray-300 */ | ||
} | ||
|
||
/* Additional Styles for Body Element */ | ||
body.light-mode { | ||
background-color: #f7fafc; | ||
color: #1a202c; | ||
} | ||
|
||
body.dark-mode { | ||
background-color: #1a202c; | ||
color: #cbd5e0; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div th:fragment="dark-mode"> | ||
<!-- Dark Mode Toggle Button --> | ||
<button id="dark-mode-toggle" class="p-2 bg-gray-200 dark:bg-gray-800 rounded ml-4 text-gray-800 dark:text-gray-200"> | ||
<i id="dark-mode-icon" class="fas fa-moon"></i> | ||
</button> | ||
|
||
<!-- Dark Mode Script --> | ||
<script> | ||
document.addEventListener("DOMContentLoaded", function() { | ||
const toggleButton = document.getElementById('dark-mode-toggle'); | ||
const darkModeIcon = document.getElementById('dark-mode-icon'); | ||
const bodyElement = document.body; | ||
const currentTheme = localStorage.getItem('theme'); | ||
|
||
if (currentTheme === 'dark') { | ||
bodyElement.classList.remove('light-mode'); | ||
bodyElement.classList.add('dark-mode'); | ||
darkModeIcon.classList.remove('fa-moon'); | ||
darkModeIcon.classList.add('fa-sun'); | ||
} | ||
|
||
toggleButton.addEventListener('click', function() { | ||
if (bodyElement.classList.contains('dark-mode')) { | ||
bodyElement.classList.remove('dark-mode'); | ||
bodyElement.classList.add('light-mode'); | ||
localStorage.setItem('theme', 'light'); | ||
darkModeIcon.classList.remove('fa-sun'); | ||
darkModeIcon.classList.add('fa-moon'); | ||
} else { | ||
bodyElement.classList.remove('light-mode'); | ||
bodyElement.classList.add('dark-mode'); | ||
localStorage.setItem('theme', 'dark'); | ||
darkModeIcon.classList.remove('fa-moon'); | ||
darkModeIcon.classList.add('fa-sun'); | ||
} | ||
}); | ||
}); | ||
</script> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html xmlns:th="http://www.thymeleaf.org"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>My Application</title> | ||
<link rel="stylesheet" th:href="@{/css/styles.css}"> | ||
<title th:fragment="title">My Website</title> | ||
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet"> | ||
<script src="https://cdn.tailwindcss.com"></script> | ||
<script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script> | ||
</head> | ||
<body> | ||
<!-- Navigation Bar --> | ||
<body class="light-mode"> | ||
<!-- Include Navbar --> | ||
<div th:replace="fragments/navbar :: navbar"></div> | ||
|
||
<!-- Main Content --> | ||
<div th:fragment="content"> | ||
<p>Content goes here...</p> | ||
</div> | ||
|
||
<!-- Footer --> | ||
<div th:replace="fragments/footer :: footer"></div> | ||
</body> | ||
</html> | ||
<!-- Page-specific content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.