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
21 changes: 15 additions & 6 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,30 @@
<meta charset="utf-8" />
<title>JobSimulator.dev</title>
<link rel="stylesheet" href="styles.css" />
<script src="script.js"></script>
</head>
<body>
<form>
<!-- TODO: Fix Logo Rendering Issue-->
<img src="/logo.png" />
<!-- todo: Fix Logo Rendering Issue-->
<img src="logo.svg" id="logo"/>
<span id="success-message" hidden="true">Success!</span>
<span id="error-message" hidden="true">Invalid Credentials</span>
<label for="email">Email</label>

<!-- TODO: Add HTML Email Validation to Email Input -->
<input id="email" type="text" placeholder="Enter your email" />
<input id="email" type="email" placeholder="Enter your email" />
<label for="password">Password</label>

<!-- TODO: Update HTML Password Input to Hide Password Visibility -->
<input id="password" type="text" placeholder="Enter your password" />
<button>Submit</button>

<input id="password" type="password" placeholder="Enter your password" />

<div class="checkbox-container" span id="show-password">
<input type="checkbox" id="show-password" />
<label for="show-password">Show Password</label>
</div>

<button id="submit-button">Submit</button>
</form>
<script src="script.js"></script>
</body>
</html>
22 changes: 21 additions & 1 deletion src/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ let resetMessage = () => {
document.getElementById("error-message").hidden = true;
};

document.getElementById("show-password").addEventListener("change", function () {
var password = document.getElementById("password");

if (this.checked) {
password.type = "text";
} else {
password.type = "password";
}
});

addEventListener("submit", (event) => {
event.preventDefault();
resetMessage();
Expand All @@ -25,9 +35,19 @@ addEventListener("submit", (event) => {
console.log(`email submitted: ${email}`);
console.log(`password submitted: ${password}`);
/*
TODO:
done:
1. Check if the email and password are valid (using the usersTable)
2. If they are, call renderSuccess()
3. If they are not, call renderError()
*/
const user = usersTable.find(
(user) => user.username === email && user.password === password
);

if (user) {
renderSuccess();
} else {
renderError();
}
});

14 changes: 8 additions & 6 deletions src/styles.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
body {
height: 100vh;
display: flex;
/* TODO: Adjust CSS so that form is centered on page */
align-items: center;
justify-content: center; /* Center the form horizontally */
align-items: center; /* Center the form vertically */
margin: 0; /* Remove default body margin */

}

form {
Expand All @@ -23,14 +25,14 @@ label {
padding: 1rem 0 0 0;
}

input {
width: 100%;
}

button {
margin: 1rem 0 0 0;
}

.checkbox-container{
padding: 1rem 0 0 0;
text-align: center;
}
#success-message {
color: green;
}
Expand Down