import React from "react"; import { MatchSentencesExercise } from "@/interfaces/exam"; import Input from "@/components/Low/Input"; import Select from "@/components/Low/Select"; interface Props { exercise: MatchSentencesExercise; updateExercise: (data: any) => void; } const MatchSentencesEdit = (props: Props) => { const { exercise, updateExercise } = props; const selectOptions = exercise.options.map((option) => ({ value: option.id, label: option.id, })); return ( <> updateExercise({ prompt: value, }) } />

Solutions

{exercise.sentences.map((sentence, index) => (
updateExercise({ sentences: exercise.sentences.map((iSol) => iSol.id === sentence.id ? { ...iSol, sentence: value, } : iSol ), }) } className="px-2" />
updateExercise({ options: exercise.options.map((iSol) => iSol.id === option.id ? { ...iSol, sentence: value, } : iSol ), }) } className="px-2" />