This project was bootstrapped with NextJS.
-
By default, the 'Adult' and 'Children' drop-down fields for rooms 2, 3, and 4 should be disabled. Upon checking the checkbox of room 2, the drop-down fields associated with room 2 should be enabled.
-
Any room that is checked should have a selected state, whose presentation is identical to the 'Room 1' field, and it's corresponding Adults/Children drop-down fields should be enabled.
-
Any room that is unchecked should return to the unselected state, and it's corresponding Adults/Children drop-down fields should become disabled and return to default values.
-
If a user unchecks a room, that room and all consecutive rooms should return to its unselected, disabled state.
-
Upon clicking 'Submit', save values using localStorage, so that upon reload, all previously selected values are pre-populated.
- NextJS was chosen to build a single-page javascript app with server-side rendering. As per request. It also includes yarn for faster installation of dependencies.
- Initial room data is provided for props from the room_data.js file.
- Components contain their corresponding styles in separate scss files with the help of the @zeit/next-sass plugin.
- State management of the user inputs is handled by React's hooks using useState() and useEffects() methods.
- WAI-ARIA adherence is done using semantic html tags and corresponding for/id attributes for user inputs.
- No visual feedback is provided upon form submission as it was not in the requirements, however a page refresh will load data from localStorage if it exists.
- Note that additional config parameters were added to enable jest/enzyme testing. See
jest.config.jsandjest.setup.js.
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
Runs unit tests (verbose output) build with Jest and Enzyme.
