Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made some modifications by adding a sign up form #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
26 changes: 22 additions & 4 deletions login-01/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
src="astronaut.jpg"
/>
<!-- optimize the image in production -->
<h1>LogIn!</h1>
<h1 id="title">LogIn!</h1>
</span>
<div class="text-field">
<label for="email">Email:</label>
Expand Down Expand Up @@ -50,14 +50,32 @@ <h1>LogIn!</h1>
src="password.svg"
>
</div>
<input type="submit" class="my-form__button" value="Login" />
<div class="text-field" id="confirmPassword">
<label for="password">Confirm Password:</label>
<input
id="password"
type="password"
aria-label="Password"
name="password"
placeholder="Your Password"
title="Minimum 6 characters at least 1 Alphabet and 1 Number"
pattern="^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{6,}$"
required
>
<img
alt="Password Icon"
title="Password Icon"
src="password.svg"
>
</div>
<input type="submit" class="my-form__button" value="Login" id="Login_button"/>
<div class="my-form__actions">
<div class="my-form__row">
<div class="my-form__row" id="resetPassword">
<span>Did you forget your password?</span>
<a href="#" title="Reset Password">Reset Password</a>
</div>
<div class="my-form__signup">
<a href="#" title="Create Account">Create Account</a>
<a href="#" title="Create Account" id="Create_account">Create Account</a>
</div>
</div>
</form>
Expand Down
15 changes: 14 additions & 1 deletion login-01/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,17 @@ loginForm.addEventListener("submit", (e) => {
console.log('Email:', email.value);
console.log('Password:', password.value);
// process and send to API
});
});

let title = document.getElementById("title");
let loginButton = document.getElementById("Login_button");
let createLink = document.getElementById("Create_account");
let reset = document.getElementById("resetPassword")

createLink.onclick = function() {
title.innerHTML = "SignUp";
loginButton.value = "Signup";
createLink.innerHTML = "Login";
confirmPassword.classList.add("show");
reset.style.display = "none"
}
13 changes: 13 additions & 0 deletions login-01/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,19 @@ h1 {
margin-top: 8px;
}

#confirmPassword {
opacity: 0;
height: 0;
overflow: hidden;
transition: opacity 0.7s ease, height 0.7s ease;
}


#confirmPassword.show {
opacity: 1;
height: auto;
}


.my-form__button:hover {
background-color: var(--primary-hover);
Expand Down