-
Notifications
You must be signed in to change notification settings - Fork 13
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 #17 from Anushka-Pote/master
[FEAT]: Implement Dark and Light Modes for the webpage #13
- Loading branch information
Showing
4 changed files
with
188 additions
and
91 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
const toggleSwitch = document.getElementById('theme-toggle'); | ||
|
||
toggleSwitch.addEventListener('change', () => { | ||
if (toggleSwitch.checked) { | ||
document.body.classList.add('dark'); | ||
document.body.classList.remove('light'); | ||
document.querySelector('.container').classList.add('dark'); | ||
document.querySelector('.container').classList.remove('light'); | ||
} else { | ||
document.body.classList.add('light'); | ||
document.body.classList.remove('dark'); | ||
document.querySelector('.container').classList.add('light'); | ||
document.querySelector('.container').classList.remove('dark'); | ||
} | ||
}); | ||
|
||
// Check the user's preference and apply it | ||
if (localStorage.getItem('theme') === 'dark') { | ||
toggleSwitch.checked = true; | ||
document.body.classList.add('dark'); | ||
document.body.classList.remove('light'); | ||
document.querySelector('.container').classList.add('dark'); | ||
document.querySelector('.container').classList.remove('light'); | ||
} else { | ||
document.body.classList.add('light'); | ||
document.body.classList.remove('dark'); | ||
document.querySelector('.container').classList.add('light'); | ||
document.querySelector('.container').classList.remove('dark'); | ||
} | ||
|
||
// Store the user's preference | ||
toggleSwitch.addEventListener('change', () => { | ||
localStorage.setItem('theme', toggleSwitch.checked ? 'dark' : 'light'); | ||
}); | ||
|
||
function submitEmail() { | ||
const email = document.getElementById('email').value; | ||
if (email) { | ||
// Here, you can add logic to send the email to the backend for verification | ||
|
||
// After email submission, show the password input section | ||
document.getElementById('passwordSection').classList.remove('hidden'); | ||
document.getElementById('emailSubmit').classList.add('hidden'); // Hide email submit button | ||
} else { | ||
alert('Please enter your email.'); | ||
} | ||
} | ||
|
||
function submitPassword() { | ||
const password = document.getElementById('password').value; | ||
if (password) { | ||
// Here, you can add logic to handle password submission to the backend | ||
alert('Password submitted!'); | ||
} else { | ||
alert('Please enter your password.'); | ||
} | ||
} |
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,67 +1,117 @@ | ||
div{ | ||
height:650px; | ||
width:400px; | ||
background-color: White; | ||
text-align: center; | ||
color:white; | ||
background-color: black; | ||
body { | ||
background-image: url("mountains.webp"); | ||
background-size: cover; | ||
transition: background-color 0.3s ease; | ||
} | ||
|
||
body.dark { | ||
background-color: #121212; | ||
color: #ffffff; | ||
} | ||
|
||
.container { | ||
height: 650px; | ||
width: 400px; | ||
margin: auto; | ||
border-radius: 2%; | ||
text-align: center; | ||
transition: background-color 0.3s ease, opacity 0.3s ease; | ||
} | ||
body{ | ||
background-image: url("mountains.webp"); | ||
background-size: cover; | ||
|
||
.container.dark { | ||
background-color: black; | ||
color: white; | ||
} | ||
|
||
body.light { | ||
background-color: #ffffff; | ||
color: #000000; | ||
} | ||
.login{ | ||
|
||
.container.light { | ||
background-color: white; | ||
} | ||
|
||
.login { | ||
font-size: 40px; | ||
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif; | ||
} | ||
.input1{ | ||
font-size:18px; | ||
|
||
.input1, .input2 { | ||
font-size: 18px; | ||
text-align: center; | ||
height:50px; | ||
width: 70%; | ||
border-radius: 100px; | ||
border: 3px solid gold; | ||
cursor:pointer; | ||
color: darkgreen; | ||
} | ||
.input2{ | ||
font-size:18px; | ||
text-align: center; | ||
height:50px; | ||
height: 50px; | ||
width: 70%; | ||
border-radius: 100px; | ||
border: 3px solid gold; | ||
cursor: pointer; | ||
color: darkgreen; | ||
} | ||
.button{ | ||
|
||
.button { | ||
height: 40px; | ||
width:40%; | ||
width: 40%; | ||
border-radius: 100px; | ||
font-size: large; | ||
background-color: blue; | ||
color:wheat; | ||
cursor:pointer; | ||
color: wheat; | ||
cursor: pointer; | ||
} | ||
.para2{ | ||
|
||
.para2 { | ||
text-align: right; | ||
margin-right: 30px; | ||
} | ||
span{ | ||
color:blueviolet; | ||
|
||
span { | ||
color: blueviolet; | ||
} | ||
.cross{ | ||
|
||
.cross { | ||
text-align: right; | ||
margin-right: 10px; | ||
} | ||
img{ | ||
height:25px; | ||
width:25px; | ||
|
||
img { | ||
height: 25px; | ||
width: 25px; | ||
margin-bottom: 2px; | ||
} | ||
.imx{ | ||
height:60px; | ||
width:60px; | ||
|
||
/* Theme switch styles */ | ||
.theme-switch { | ||
position: absolute; | ||
top: 20px; | ||
right: 20px; | ||
display: flex; | ||
align-items: center; | ||
} | ||
.theme-switch input { | ||
display: none; | ||
} | ||
.slider { | ||
cursor: pointer; | ||
height: 24px; | ||
width: 48px; | ||
background-color: #ccc; | ||
border-radius: 50px; | ||
position: relative; | ||
transition: background-color 0.3s; | ||
} | ||
.slider:before { | ||
position: absolute; | ||
content: ""; | ||
height: 20px; | ||
width: 20px; | ||
left: 4px; | ||
bottom: 2px; | ||
background-color: white; | ||
border-radius: 50%; | ||
transition: transform 0.3s; | ||
} | ||
input:checked + .slider { | ||
background-color: #4CAF50; | ||
} | ||
input:checked + .slider:before { | ||
transform: translateX(24px); | ||
} |