diff --git a/frontend/src/components/LectureHeader/LectureHeader.module.css b/frontend/src/components/LectureHeader/LectureHeader.module.css
index e98c683..b43fbb2 100644
--- a/frontend/src/components/LectureHeader/LectureHeader.module.css
+++ b/frontend/src/components/LectureHeader/LectureHeader.module.css
@@ -58,18 +58,6 @@
align-items: center;
}
-.tutorImg {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 48px;
- height: 48px;
- border-radius: 50%;
- object-fit: cover;
- stroke: var(--text-color-secondary);
- border: 1px solid var(--border-color);
-}
-
@keyframes glow {
0% {
box-shadow: 0 0 0 0 var(--error-color);
diff --git a/frontend/src/components/QuizForm/QuizCard.jsx b/frontend/src/components/QuizForm/QuizCard.jsx
index b734fc2..ab409f5 100644
--- a/frontend/src/components/QuizForm/QuizCard.jsx
+++ b/frontend/src/components/QuizForm/QuizCard.jsx
@@ -1,4 +1,4 @@
-import { useEffect, useState } from 'react';
+import { useState } from 'react';
import styles from './QuizCard.module.css';
import CloseIcon from '/src/assets/icons/close.svg?react';
import PlusIcon from '/src/assets/icons/plus.svg?react';
@@ -6,12 +6,24 @@ import { Toggle } from '../Toggle';
import { STATIC_URL } from '../../constants';
export default function QuizCard({ quiz, updateQuiz, deleteQuiz }) {
+ const isChoice = quiz.choices.length > 0;
const [question, setQuestion] = useState(quiz.question || '');
- const [answer, setAnswer] = useState(Number(quiz.answer) || '');
+ const [answer, setAnswer] = useState(isChoice ? Number(quiz.answer) || 1 : quiz.answer || '');
const [choices, setChoices] = useState(quiz.choices || [{ num: 1, content: '' }]);
const [image, setImage] = useState(quiz.image || null);
const [imagePreview, setImagePreview] = useState(quiz.image ? `${STATIC_URL}${quiz.image}` : null);
- const [quizType, setQuizType] = useState('단답식');
+ const [quizType, setQuizType] = useState(isChoice ? '객관식' : '단답식');
+
+ const handleToggle = (type) => {
+ setQuizType(type);
+ if (type === '단답식') {
+ setAnswer('');
+ setChoices([]);
+ return;
+ }
+ setAnswer(1);
+ setChoices([{ num: 1, content: '' }]);
+ };
const clearImage = () => {
setImage(null);
@@ -75,10 +87,6 @@ export default function QuizCard({ quiz, updateQuiz, deleteQuiz }) {
updateQuiz(quiz.id, { ...quiz, question, answer: choiceContent, choices, image });
};
- useEffect(() => {
- quizType === '단답식' ? setAnswer('') : setAnswer(1);
- }, [quizType]);
-
return (
@@ -131,7 +139,7 @@ export default function QuizCard({ quiz, updateQuiz, deleteQuiz }) {