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

Submission #1 #51

Open
wants to merge 4 commits 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
139 changes: 65 additions & 74 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -1,83 +1,74 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>JobSimulator.Dev</title>
<link rel="stylesheet" href="styles.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
<script src="script.js"></script>
</head>

<body>
<!-- Navbar -->
<!-- TODO: Fix Issue, Nav Buttons Don't Work (Desktop & Mobile) -->
<nav class="top">
<div class="bar blue card left-align large">
<a
class="bar-item button hide-medium hide-large right padding-large hover-white large blue"
href="javascript:void(0);"
id="hamburger-button"
onclick="toggleNav()"
title="Toggle Navigation Menu"
><i class="fa fa-bars"></i
></a>
<!-- TODO: Fix Issue, Desktop Nav Is Visible on Mobile -->
<a id="nav-logo" class="bar-item button padding-large white">JobSimulator.Dev</a>
<a id="nav-challenges" class="bar-item button padding-large hover-white">Browse Challenges</a>
<a id="nav-signup" class="bar-item button padding-large hover-white">Sign Up</a>
</div>
<head>
<meta charset="utf-8" />
<title>JobSimulator.Dev</title>
<link rel="stylesheet" href="styles.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
<script src="script.js"></script>
</head>

<!-- Navbar on small screens -->
<div id="mobile-nav" class="bar-block white hide hide-large hide-medium large">
<a id="mobile-nav-challenges" class="bar-item button padding-large">Browse Challenges</a>
<a id="mobile-nav-signup" class="bar-item button padding-large">Sign Up</a>
</div>
</nav>
<body>
<!-- Navbar -->
<!-- TODO: Fix Issue, Nav Buttons Don't Work (Desktop & Mobile) -->
<nav class="top">
<div class="bar blue card left-align large">
<a class="bar-item button hide-medium hide-large right padding-large hover-white large blue"
href="javascript:void(0);" id="hamburger-button" onclick="toggleNav()" title="Toggle Navigation Menu"><i
class="fa fa-bars"></i></a>
<!-- TODO: Fix Issue, Desktop Nav Is Visible on Mobile -->
<a id="nav-logo" href="#header" class="bar-item button padding-large white">JobSimulator.Dev</a>
<a id="nav-challenges" href="#challenges" class="bar-item button padding-large hover-white hide-small">Browse
Challenges</a>
<a id="nav-signup" href="#signup" class="bar-item button padding-large hover-white hide-small">Sign Up</a>
</div>

<!-- Header -->
<header id="header" class="container white center" style="padding: 128px 16px">
<img id="jumbo-image" src="./banner-image.png" />
<h1 class="margin jumbo">Want to test your software dev skills?</h1>
<a href="#signup" class="button blue padding-large large margin-top">Sign Up</a>
</header>
<!-- Navbar on small screens -->
<div id="mobile-nav" class="bar-block white hide hide-large hide-medium large">
<a id="mobile-nav-challenges" href="#challenges" class="bar-item button padding-large">Browse Challenges</a>
<a id="mobile-nav-signup" href="#signup" class="bar-item button padding-large">Sign Up</a>
</div>
</nav>

<section id="challenges" class="row-padding pink padding-256 container">
<div class="content">
<h1>Browse Our Challenges</h1>
<div id="challenge-grid">
<a
class="challenge-tile"
target="_blank"
href="https://github.com/developer-job-simulation/vanilla-login-form"
>Vanilla Login Form</a
>
<a target="_blank" class="challenge-tile" href="https://github.com/developer-job-simulation/vanilla-table"
>Vanilla Table</a
>
<a target="_blank" class="challenge-tile" href="https://github.com/developer-job-simulation/react-ecommerce"
>React Ecommerce</a
>
<a target="_blank" class="challenge-tile" href="https://github.com/developer-job-simulation/react-mui-table"
>React Table</a
>
</div>
<!-- Header -->
<header id="header" class="container white center" style="padding: 128px 16px">
<img id="jumbo-image" src="./banner-image.png" />
<h1 class="margin jumbo">Want to test your software dev skills?</h1>
<a href="#signup" class="button blue padding-large large margin-top">Sign Up</a>
</header>

<section id="challenges" class="row-padding pink padding-256 container">
<div class="content">
<h1>Browse Our Challenges</h1>
<div id="challenge-grid">
<a class="challenge-tile" target="_blank"
href="https://github.com/developer-job-simulation/vanilla-login-form">Vanilla Login Form</a>
<a target="_blank" class="challenge-tile"
href="https://github.com/developer-job-simulation/vanilla-table">Vanilla Table</a>
<a target="_blank" class="challenge-tile"
href="https://github.com/developer-job-simulation/react-ecommerce">React Ecommerce</a>
<a target="_blank" class="challenge-tile"
href="https://github.com/developer-job-simulation/react-mui-table">React Table</a>
</div>
</section>
</div>
</section>

<section id="signup" class="row-padding light-grey padding-256 container">
<div class="content">
<div id="signup-form">
<h1>Sign Up & Get Started</h1>
<form>
<span id="success-message" class="success-message" hidden="true">Success!</span>
<span id="taken-error-message" class="error-message" hidden="true">Error: Email Already Taken</span>
<span id="empty-error-message" class="error-message" hidden="true">Error: Email Address Empty.</span>
<input id="email" type="email" placeholder="Enter your email" />
<button>Submit</button>
</form>
</div>
<section id="signup" class="row-padding light-grey padding-256 container">
<div class="content">
<div id="signup-form">
<h1>Sign Up & Get Started</h1>
<form>
<span id="success-message" class="success-message" hidden="true">Success!</span>
<span id="taken-error-message" class="error-message" hidden="true">Error: Email Already Taken</span>
<span id="empty-error-message" class="error-message" hidden="true">Error: Email Address Empty.</span>
<input id="email" type="email" placeholder="Enter your email" />
<button>Submit</button>
</form>
</div>
</section>
</body>
</html>
</div>
</section>
</body>

</html>
64 changes: 39 additions & 25 deletions src/script.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,56 @@
const usersTable = [
// Note: This is a fake table for educational purposes. Never store user credentials in plain text.
{ username: "[email protected]" },
{ username: "[email protected]" },
{ username: "[email protected]" },
// Note: This is a fake table for educational purposes. Never store user credentials in plain text.
{ username: '[email protected]' },
{ username: '[email protected]' },
{ username: '[email protected]' },
];
let renderSuccess = () => {
document.getElementById("success-message").hidden = false;
document.getElementById('success-message').hidden = false;
};
let renderEmailTakenError = () => {
document.getElementById("taken-error-message").hidden = false;
document.getElementById('taken-error-message').hidden = false;
};
let renderEmailEmptyError = () => {
document.getElementById("empty-error-message").hidden = false;
document.getElementById('empty-error-message').hidden = false;
};
let resetMessage = () => {
document.getElementById("success-message").hidden = true;
document.getElementById("taken-error-message").hidden = true;
document.getElementById("empty-error-message").hidden = true;
document.getElementById('success-message').hidden = true;
document.getElementById('taken-error-message').hidden = true;
document.getElementById('empty-error-message').hidden = true;
};

addEventListener("submit", (event) => {
event.preventDefault();
resetMessage();
addEventListener('submit', (event) => {
event.preventDefault();
resetMessage();

let email = document.getElementById("email").value;
let email = document.getElementById('email').value;

// TODO: Show Correct Status Messages on Signup Form
// 1. successful signup
// 2. empty email
// 3. taken email
// 4. repeat email
// TODO: Show Correct Status Messages on Signup Form
// 1. successful signup
// 2. empty email
// 3. taken email
// 4. repeat email

if (email === '') {
return renderEmailEmptyError();
}
for (user of usersTable) {
if (user.username === email) {
return renderEmailTakenError();
}
}
let newUser = {
username: email,
};
usersTable.push(newUser);
return renderSuccess();
});

let toggleNav = () => {
var nav = document.getElementById("mobile-nav");
if (nav.className.indexOf("show") == -1) {
nav.className += " show";
} else {
nav.className = nav.className.replace(" show", "");
}
var nav = document.getElementById('mobile-nav');
if (nav.className.indexOf('show') == -1) {
nav.className += ' show';
} else {
nav.className = nav.className.replace(' show', '');
}
};
Loading