corrected components
This commit is contained in:
parent
a27087d681
commit
1bc96d830e
33 changed files with 618 additions and 247 deletions
|
|
@ -4,8 +4,9 @@ import AddAnswerButton from "../AddAnswerButton/AddAnswerButton.tsx";
|
|||
import TypeDropdown from "../TypeDropdown/TypeDropdown.tsx";
|
||||
import styles from './QuestionItem.module.css'
|
||||
|
||||
import singleChoiceIcon from '../../../public/radio_button_checked.svg'
|
||||
import multiplyChoiceIcon from '../../../public/check_box.svg'
|
||||
import SingleChoiceIcon from '../../../public/radio_button_checked.svg?react';
|
||||
import MultiplyChoiceIcon from '../../../public/check_box.svg?react';
|
||||
|
||||
|
||||
interface QuestionItemProps {
|
||||
indexQuestion: number;
|
||||
|
|
@ -21,10 +22,6 @@ const QuestionItem: React.FC<QuestionItemProps> = ({indexQuestion, initialTextQu
|
|||
setAnswerOption([...answerOption, '']);
|
||||
};
|
||||
|
||||
// const handleTypeChange = (type: string) => {
|
||||
// setQuestionType(type);
|
||||
// }
|
||||
|
||||
const handleAnswerChange = (index: number, value: string) => {
|
||||
const newAnswerOption = [...answerOption];
|
||||
newAnswerOption[index] = value;
|
||||
|
|
@ -47,9 +44,9 @@ const QuestionItem: React.FC<QuestionItemProps> = ({indexQuestion, initialTextQu
|
|||
{answerOption.map((answerText, index) => (
|
||||
<AnswerOption
|
||||
key={index}
|
||||
src={questionType === "single" ? <SingleChoiceIcon /> : <MultiplyChoiceIcon />}
|
||||
index={index + 1} // Индекс ответа
|
||||
value={answerText}
|
||||
src={questionType === "single" ? singleChoiceIcon : multiplyChoiceIcon}
|
||||
onChange={(value) => handleAnswerChange(index, value)}
|
||||
/>
|
||||
))}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue