Skip to content

nicolasfig/ping-coming-soon-page

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Frontend Mentor - Ping coming soon page solution

This is a solution to the Ping coming soon page challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Note: Delete this note and update the table of contents based on what sections you keep.

Overview

The challenge

Users should be able to:

  • View the optimal layout for the site depending on their device's screen size
  • See hover states for all interactive elements on the page
  • Submit their email address using an input field
  • Receive an error message when the form is submitted if:
    • The input field is empty. The message for this error should say "Whoops! It looks like you forgot to add your email"
    • The email address is not formatted correctly (i.e. a correct email address should have this structure: name@host.tld). The message for this error should say "Please provide a valid email address"

Screenshots

Desktop

Mobile

Links

My process

Built with

  • Semantic HTML5 markup
  • CSS custom properties
  • Flexbox
  • Vanilla Javascript

What I learned

How to add interactivity to the html, basic DOM manipulation, how to add and remove classes using javascript and more flexbox

let validate = () => {
  if (email.value === "") {
    error.style.display = "block";
    email.classList.remove("success-input");
    email.classList.add("form-error");
    error.style.color = "var(--light-red)";
    error.innerHTML = "Whoops! It looks like you forgot to add your email";
  } else if (!pattern.test(email.value)) {
    email.classList.remove("success-input");
    email.classList.add("form-error");
    error.style.display = "block";
    error.style.color = "var(--light-red)";
    error.innerHTML = "Please provide a valid email address";
  } else if (pattern.test(email.value)) {
    email.classList.remove("form-error");
    email.classList.add("success-input");
    error.style.display = "block";
    error.style.color = "var(--green)";
    error.innerHTML = "Thank you for your support!";
  }
};

Useful resources

  • Flexbox Malven - Useful flexbox reference as always
  • MDN - MDN the best documentation

Author

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published