Skip to content

Commit

Permalink
Refactor newChoice and newQuestion
Browse files Browse the repository at this point in the history
  • Loading branch information
leung018 committed Dec 4, 2023
1 parent 193ab40 commit 6bc3a32
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/app/components/mc/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,22 @@ interface ChoiceInput {
isCorrect: boolean
}

const newChoice = (): ChoiceInput => ({
answer: '',
isFixedPosition: false,
isCorrect: false,
})

const newQuestion = (): QuestionInput => ({
description: '',
choices: [newChoice(), newChoice()],
})

function QuestionSetEditor({
onSave,
}: {
onSave: (questionSet: QuestionSet) => void
}) {
const newChoice = () => ({
answer: '',
isFixedPosition: false,
isCorrect: false,
})

const newQuestion = () => ({
description: '',
choices: [newChoice(), newChoice()],
})

const [questionSetInput, setQuestionSetInput] = useState<QuestionSetInput>({
name: '',
questions: [newQuestion()],
Expand Down

0 comments on commit 6bc3a32

Please sign in to comment.