diff --git a/components/FormGenerator.tsx b/components/FormGenerator.tsx index 3ea8eb9..333dc2c 100644 --- a/components/FormGenerator.tsx +++ b/components/FormGenerator.tsx @@ -14,6 +14,7 @@ import { Radio, RadioGroup, Select, + Stack, Textarea, } from "@chakra-ui/react"; import { type Dispatch, type SetStateAction, useState } from "react"; @@ -106,6 +107,37 @@ export default function ({ ); } + function renderRadioElements( + c: component, + state: { [k: string]: string | string[] }, + setState: Dispatch> + ) { + if (!c.options) throw new Error("Options for radio buttons are undefined!"); + const buttons = []; + + for (const option of c.options) { + buttons.push( + + {option.value} + + ); + } + + return ( + { + const newState = { ...state }; + newState[c.id] = e; + + setState(newState); + }} + > + {buttons} + + ); + } + function generateReactComponents( components: component[], state: { [k: string]: string | string[] }, @@ -169,6 +201,9 @@ export default function ({ ); break; + + case "select": + fragmentsList.push(); } fragmentsList.push(
,
,
);