Git Product home page Git Product logo

pod-request-acess's Introduction

Frontend Mentor - Pod request access landing page solution

This is a solution to the Pod request access landing page challenge on Frontend Mentor. Frontend Mentor challenges help you improve your coding skills by building realistic projects.

Table of contents

Overview

The challenge

Users should be able to:

  • View the optimal layout depending on their device's screen size
  • See hover states for interactive elements
  • Receive an error message when the form is submitted if:
    • The Email address field is empty should show "Oops! Please add your email"
    • The email is not formatted correctly should show "Oops! Please check your email"

Screenshot

Links

My process

My process started with getting create-react-up working. Once I have that running localy, I oraganize my folders and build my components. I focus heavily on the basic CSS. Once I get every in order(90% the way there), I start to work on the logic. Once I figure out the logic, I focus on the touch ups in Css and responsive design. Lastly, I run my site their Lighthouse to test the performance and other factors.

Built with

-HTML -CSS -Create-react-app -Validator

What I learned

This was a great project to practice my react skills. It was tricky to create an error on the form. I ended up using form validation.

  function handleSubmit(event) {
    event.preventDefault();
    const validEmail = validator.isEmail(formData.email);

    // takes previous state and updates boolen base on validator
    setData((prev) => ({
      ...prev,
      valid: validEmail,
    }));
  }

This code above allows the validator to validator the form data when the submit button is clicked.

{formData.valid === false && (
              <p className="form-error">Oops! Please Check your email</p>

This code above is a conditional render if the form data is false. So if not valid, the "oops" info will show up.

 React.useEffect(() => {
    const handlemediaWidth = () => {
      setMediaWidth(window.innerWidth);
    };

    window.addEventListener("resize", handlemediaWidth);

     // Allows unmounting of the event listener 
    return () => {
      window.removeEventListener("resize", handlemediaWidth);
    };
  }, []);

Lastly, using useEffect for media querys worked great for backgrounds. I could of possibilty used pure CSS for this, however, this code help me reenforce react more.

Continued development

I want to focus on more React hooks and how to simplify my code in the future. Also, working on the CSS of background images.

Author

pod-request-acess's People

Contributors

coltensiemer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.