-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #45 from shubhamsharma9199/main
Reslove the merge conflict
- Loading branch information
Showing
2 changed files
with
52 additions
and
57 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,30 @@ | ||
// Toggle between light and dark mode | ||
const themeToggleBtn = document.getElementById('themeToggle'); | ||
const body = document.body; | ||
|
||
function loadProfileImage(event) { | ||
const profileImage = document.getElementById('profileImage'); | ||
const file = event.target.files[0]; | ||
|
||
if (file) { | ||
const reader = new FileReader(); | ||
reader.onload = function(e) { | ||
profileImage.src = e.target.result; | ||
}; | ||
reader.readAsDataURL(file); | ||
themeToggleBtn.addEventListener('click', () => { | ||
body.classList.toggle('dark-mode'); | ||
if (body.classList.contains('dark-mode')) { | ||
themeToggleBtn.textContent = '☀️ Light Mode'; | ||
} else { | ||
themeToggleBtn.textContent = '🌙 Dark Mode'; | ||
} | ||
} | ||
|
||
document.getElementById('profileForm').addEventListener('submit', function(event) { | ||
event.preventDefault(); | ||
const name = document.getElementById('name').value; | ||
const email = document.getElementById('email').value; | ||
const bio = document.getElementById('bio').value; | ||
console.log("Profile Updated:", { name, email, bio }); | ||
alert("Profile updated successfully!"); | ||
}); | ||
|
||
// DARK MODE | ||
const themeToggleButton = document.getElementById("themeToggle"); | ||
const body = document.body; | ||
if (localStorage.getItem("theme") === "dark") { | ||
body.classList.add("dark-mode"); | ||
themeToggleButton.textContent = "☀️ "; | ||
// Profile image upload preview. | ||
function loadProfileImage(event) { | ||
const profileImage = document.getElementById('profileImage'); | ||
profileImage.src = URL.createObjectURL(event.target.files[0]); | ||
} | ||
themeToggleButton.addEventListener("click", () => { | ||
body.classList.toggle("dark-mode"); | ||
|
||
if (body.classList.contains("dark-mode")) { | ||
themeToggleButton.textContent = "☀️"; | ||
localStorage.setItem("theme", "dark"); | ||
} else { | ||
themeToggleButton.textContent = "🌙"; | ||
localStorage.setItem("theme", "light"); | ||
} | ||
// Profile form submission with feedback. | ||
const profileForm = document.getElementById('profileForm'); | ||
const updateSuccessMessage = document.getElementById('updateSuccessMessage'); | ||
|
||
profileForm.addEventListener('submit', (event) => { | ||
event.preventDefault(); | ||
updateSuccessMessage.style.display = 'block'; | ||
setTimeout(() => { | ||
updateSuccessMessage.style.display = 'none'; | ||
}, 3000); | ||
}); |