Learning Outcomes
- use a CSS framework in an application
Resources
Lab
Assignment
- Fork; remove the fork relationship; make private; and clone this project: https://gitlab.com/langarabrian/bootstrap4
- In
bootstrap4/frontend
runyarn install
. - Run
PORT=8080 yarn start
. - In
frontend/src/Patients.tsx
create a data collection form with the following required fields:- first name
- last name
- email address
- country
- province/state
- postal/zip code
- lowest systolic blood pressure in last year
- highest systolic blood pressure in last year
- Use the Bootstrap classes to create a sensible responsive layout for the input fields. There should be at least 3 different arrangements depending on the viewport width.
- Choose the most restrictive input field type that makes sense for each field.
- Implement “country” as a “SELECT” element where there are two choices: “Canada” and “USA”.
- Implement “province/state” as a “SELECT” element where the choices depend on the current selection for “country”.
- Implement “postal/zip code” validation that is dependent on the current selection for “country”. You should support Canadian postal codes and US ZIP codes in the basic 5-digit format as well as the ZIP+4 format.
- Ensure that lowest blood pressure entered is lower than the highest blood pressure entered.
- Do as much validation as possible on the client side. Display meaningful error messages. Short-circuit the form submission if any of the fields are invalid.
- When you are ready to move to the backend, stop
PORT=8080 yarn start
and runyarn build
to build the frontend. - In
bootstrap4/backend
runyarn install
. - On the backend, validate all the input in the “before create” hook and throw an error if any of the input fields are invalid.
- Also, on the backend, throw an error if someone tries to register with an email address that has already been registered.
- Catch any server side errors on the client side and present a meaningful message to the user in the UI.
- Stage, commit, and push all changes to the project.