GithubHelp home page GithubHelp logo

project-survey's Introduction

Survey form with React

This week's project was to use React to build a survey form. The main focus with this project was to practice using React state and controlling forms, with accessibility in mind.

I aimed for the blue requirements for this week but decided to try out some of the red requirements as well.

My project

  • I wanted to have my App component as clean as possible so most of the main functionality is in the form component. I created seperate components for each question in the form, the summary and the submitbutton.
  • The useState hooks and the onChange eventhandlers are declared in the Form component and then passed on to each part of the form as props.
  • I used ternery operators to show/hide different parts of the website.
  • In the summary I tried out a switch statement that changes the image src depending on the value picked from the radio buttons.
  • I used the required attribute for validation on the text input and the radio buttons. For the select dropdown I used the disabled attribute on the submit button instead. The range slider however doesn't have any validation yet.
  • designed it with mobile first in mind.

Accessibility testing:

  • screen reader with ChromeVox
  • lighthouse

The website was tested in Chrome, Safari, Firefox on desktop and Safar on mobile. The main content looks the same, but there are som minor differences in the design for the different form elements.

TECH

  • React
  • JSX
  • Javascript
  • CSS
  • HTML

If I had more time:

  • I would have made a dynamic form! I would like to display one question at a time and scroll down/show next if the user clicks on a button. I will go back to this project and update this later!
  • Add validation text to the select dropdown. The functionality is there, but I couldn't figure out how to add a message to the user that the answer from the dropdown is missing.
  • Look in to how you can validate a range slider since it already has a value from the start?

View it live

https://wonderful-tesla-389576.netlify.app/

project-survey's People

Contributors

ellenbjo avatar emolsz avatar dependabot[bot] avatar idlefingers avatar jenniedalgren avatar puj 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.