diff --git a/frontend/src/questions.tsx b/frontend/src/questions.tsx
index 5d83bf9..246d72c 100644
--- a/frontend/src/questions.tsx
+++ b/frontend/src/questions.tsx
@@ -5,8 +5,9 @@ import type { QuizQuestion } from 'model/quiz-question.ts'
import * as api from 'api.ts'
import { preventDefault } from 'helpers.ts'
-const Feedback = (id: number) =>
+const Feedback = (id: number) => (
{id ? `Congratulation, Quiz ID is ${id}` : 'Oops..something went wrong :('}
+)
const Questions = (list: QuizQuestion[]) => {
const [selectedQuestions, setSelectedQuestions] = createSignal([])
@@ -29,15 +30,16 @@ const Questions = (list: QuizQuestion[]) => {
const selectQuestion = (questionIdx: number) => () => {
const isQuestion = selectedQuestions().find(id => id === questionIdx)
- if(isQuestion) { // remove question
+ if (isQuestion) {
+ // remove question
const filteredQuestions = selectedQuestions().filter(id => id !== questionIdx)
setSelectedQuestions(filteredQuestions)
- } else { //add question
+ } else {
+ //add question
setSelectedQuestions([...selectedQuestions(), questionIdx])
- }
+ }
}
-
const Question = ({ question, id }: QuizQuestion) => {
const questionId = `answer-${id}`
return (
@@ -54,7 +56,14 @@ const Questions = (list: QuizQuestion[]) => {
- setQuizName(e.currentTarget.value)} required />
+ setQuizName(e.currentTarget.value)}
+ required
+ />
)
}