fix size components
This commit is contained in:
parent
08f827267d
commit
e6e2f68eb0
32 changed files with 238 additions and 175 deletions
|
|
@ -24,6 +24,7 @@ interface QuestionItemProps {
|
|||
initialQuestionType: 'SingleAnswerQuestion' | 'MultipleAnswerQuestion';
|
||||
onQuestionTypeChange: (type: 'SingleAnswerQuestion' | 'MultipleAnswerQuestion') => void;
|
||||
surveyId?: number;
|
||||
onAnswerSelect?: (questionId: number, answerText: string) => void;
|
||||
}
|
||||
|
||||
const QuestionItem: React.FC<QuestionItemProps> = ({
|
||||
|
|
@ -36,7 +37,8 @@ const QuestionItem: React.FC<QuestionItemProps> = ({
|
|||
onDeleteQuestion,
|
||||
initialQuestionType,
|
||||
onQuestionTypeChange,
|
||||
surveyId
|
||||
surveyId,
|
||||
onAnswerSelect
|
||||
}) => {
|
||||
const [textQuestion, setTextQuestion] = useState(initialTextQuestion);
|
||||
const [isEditingQuestion, setIsEditingQuestion] = useState(false);
|
||||
|
|
@ -165,7 +167,25 @@ const QuestionItem: React.FC<QuestionItemProps> = ({
|
|||
}
|
||||
};
|
||||
|
||||
// const toggleSelect = (index: number) => {
|
||||
// if (initialQuestionType === 'SingleAnswerQuestion') {
|
||||
// setSelectedAnswers([index]);
|
||||
// } else {
|
||||
// setSelectedAnswers(prev =>
|
||||
// prev.includes(index)
|
||||
// ? prev.filter(i => i !== index)
|
||||
// : [...prev, index]
|
||||
// );
|
||||
// }
|
||||
// };
|
||||
|
||||
const toggleSelect = (index: number) => {
|
||||
const answerText = initialAnswerVariants[index].text;
|
||||
|
||||
if (onAnswerSelect) {
|
||||
onAnswerSelect(questionId, answerText);
|
||||
}
|
||||
|
||||
if (initialQuestionType === 'SingleAnswerQuestion') {
|
||||
setSelectedAnswers([index]);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue