aboutsummaryrefslogtreecommitdiffstats
path: root/src/components
diff options
context:
space:
mode:
Diffstat (limited to 'src/components')
-rw-r--r--src/components/InputTypes/index.tsx48
-rw-r--r--src/components/Question.tsx64
2 files changed, 56 insertions, 56 deletions
diff --git a/src/components/InputTypes/index.tsx b/src/components/InputTypes/index.tsx
index d75fbdc..5154f9c 100644
--- a/src/components/InputTypes/index.tsx
+++ b/src/components/InputTypes/index.tsx
@@ -33,37 +33,37 @@ export default function create_input({ question, public_state }: QuestionProp, h
/* eslint-disable react/react-in-jsx-scope */
switch (question.type) {
- case QuestionType.TextArea:
- result = <TextArea handler={handler}/>;
- break;
+ case QuestionType.TextArea:
+ result = <TextArea handler={handler}/>;
+ break;
- case QuestionType.Checkbox:
- result = options.map((option, index) => <Checkbox index={index} option={option} handler={handler} key={index}/>);
- break;
+ case QuestionType.Checkbox:
+ result = options.map((option, index) => <Checkbox index={index} option={option} handler={handler} key={index}/>);
+ break;
- case QuestionType.Radio:
- result = options.map((option, index) => <Radio option={option} question_id={question.id} handler={handler} key={index}/>);
- break;
+ case QuestionType.Radio:
+ result = options.map((option, index) => <Radio option={option} question_id={question.id} handler={handler} key={index}/>);
+ break;
- case QuestionType.Select:
- result = <Select options={options} state_dict={public_state}/>;
- break;
+ case QuestionType.Select:
+ result = <Select options={options} state_dict={public_state}/>;
+ break;
- case QuestionType.ShortText:
- result = <ShortText handler={handler}/>;
- break;
+ case QuestionType.ShortText:
+ result = <ShortText handler={handler}/>;
+ break;
- case QuestionType.Range:
- result = <Range question_id={question.id} options={options} handler={handler}/>;
- break;
+ case QuestionType.Range:
+ result = <Range question_id={question.id} options={options} handler={handler}/>;
+ break;
- case QuestionType.Code:
- // TODO: Implement
- result = <Code handler={handler}/>;
- break;
+ case QuestionType.Code:
+ // TODO: Implement
+ result = <Code handler={handler}/>;
+ break;
- default:
- result = <TextArea handler={handler}/>;
+ default:
+ result = <TextArea handler={handler}/>;
}
/* eslint-enable react/react-in-jsx-scope */
diff --git a/src/components/Question.tsx b/src/components/Question.tsx
index e1472e4..34d12f7 100644
--- a/src/components/Question.tsx
+++ b/src/components/Question.tsx
@@ -46,24 +46,24 @@ class RenderedQuestion extends React.Component<QuestionProp> {
let value: string | boolean;
switch (event.target.type) {
- case "checkbox":
- target = event.target.name;
- value = event.target.checked;
- break;
-
- case "radio":
- // This handles radios and ranges, as they are both based on the same fundamental input type
- target = "value";
- if (event.target.parentElement) {
- value = event.target.parentElement.innerText.trimEnd();
- } else {
- value = event.target.value;
- }
- break;
+ case "checkbox":
+ target = event.target.name;
+ value = event.target.checked;
+ break;
+
+ case "radio":
+ // This handles radios and ranges, as they are both based on the same fundamental input type
+ target = "value";
+ if (event.target.parentElement) {
+ value = event.target.parentElement.innerText.trimEnd();
+ } else {
+ value = event.target.value;
+ }
+ break;
- default:
- target = "value";
- value = event.target.value;
+ default:
+ target = "value";
+ value = event.target.value;
}
this._setState(target, value);
@@ -85,21 +85,21 @@ class RenderedQuestion extends React.Component<QuestionProp> {
if (this.props.public_state.size === 0) {
switch (this.props.question.type) {
- case QuestionType.Checkbox:
- if (typeof options === "string") {
- return;
- }
-
- options.forEach((option, index) => {
- this._setState(`${("000" + index).slice(-4)}. ${option}`, false);
- });
- break;
-
- case QuestionType.Range:
- case QuestionType.Radio:
- case QuestionType.Select:
- this._setState("value", null);
- break;
+ case QuestionType.Checkbox:
+ if (typeof options === "string") {
+ return;
+ }
+
+ options.forEach((option, index) => {
+ this._setState(`${("000" + index).slice(-4)}. ${option}`, false);
+ });
+ break;
+
+ case QuestionType.Range:
+ case QuestionType.Radio:
+ case QuestionType.Select:
+ this._setState("value", null);
+ break;
}
}
}