This PR aims to enhance the existing Builder component in order to generate HTML content with questions. The current implementation only generates JSON from an input field. The modifications include creating a dynamic form with input fields for each question and answer type, allowing users to add or remove questions. Additionally, the JsonBuilder class is updated to generate JSON from the form data, iterating over the form fields to create JSON objects for each question and its answers. The survey data from the JSON file is also loaded into the form when the Builder component is mounted.
Summary of Changes
Modified components/Builder.tsx to create a dynamic form with input fields for questions and answer types.
Updated helper/json-builder.ts to generate JSON from the form data.
Fetched survey data from the JSON file and set the form fields with the data when the Builder component is mounted.
Fixes #1.
To checkout this PR branch, run the following command in your terminal:
git checkout sweep/survey-builder
To get Sweep to edit this pull request, leave a comment below or in the code. Leaving a comment in the code will only modify the file but commenting below can change the entire PR.
Description
This PR aims to enhance the existing Builder component in order to generate HTML content with questions. The current implementation only generates JSON from an input field. The modifications include creating a dynamic form with input fields for each question and answer type, allowing users to add or remove questions. Additionally, the JsonBuilder class is updated to generate JSON from the form data, iterating over the form fields to create JSON objects for each question and its answers. The survey data from the JSON file is also loaded into the form when the Builder component is mounted.
Summary of Changes
Fixes #1.
To checkout this PR branch, run the following command in your terminal:
To get Sweep to edit this pull request, leave a comment below or in the code. Leaving a comment in the code will only modify the file but commenting below can change the entire PR.