1.0.2 • Published 5 years ago
nyc_form v1.0.2
A React Form Module
An example library for NYC Coding Exercise.
Install
To install it, make sure you have the peer dependencies:
yarn add nyc_form evergreen-ui react prop-types
Quickstart
This library is designed to cover a common use case (collecting basic user information in a form) and be extensible enough to allow the collection of additional information.
This is done by passing an array of steps as a prop
, in this format:
const steps = [
{ title: "First step", kinds: ["email", "password"] },
{ title: "Details", kinds: ["name", "age"] },
{ title: "Final Question", kinds: ["favorite_food"] },
];
And then you can use the main FormApp
component like so
import { FormApp } from "nyc_form";
<FormApp steps={steps} title="Example Form" />;
The four standard kinds are "email"
, "password"
, "name"
, and "age"
. Any kind
that doesn't match one of those (e.g. "favorite_food"
above) will simply use a text input field.
Dev
Clone the repo, and run yarn && yarn start
or npm install && npm start
and visit http://localhost:8080/src/dev/to get started with local development.