import React, { useState, useEffect, useCallback } from 'react'; import { Trophy, Clock, CheckCircle2, XCircle, ChevronRight, RotateCcw, Download, User, Hash } from 'lucide-react'; const QUIZ_DATA = [ { question: "다음 영영풀이에 해당하는 단어는 무엇인가요?\n'to share information with others by speaking, writing, moving your body, etc.'", options: ["apologize", "communicate", "expression", "understand", "repeat"], answer: 1, rationale: "말하기, 쓰기, 몸짓 등을 통해 정보를 공유하는 것은 'communicate(의사소통하다)'입니다." }, { question: "다음 단어 중 '민감한, 예민한'이라는 의미를 가진 형용사는 무엇인가요?", options: ["simple", "casual", "correctly", "sensitive", "probable"], answer: 3, rationale: "'sensitive'는 주변 환경에 의해 쉽게 상처받거나 영향을 받는 '민감한' 상태를 뜻합니다." }, { question: "문장의 빈칸에 알맞은 단어를 고르세요.\n'A smile is an __________ of happiness.'", options: ["arrival", "expression", "emoji", "misunderstanding", "meaning"], answer: 1, rationale: "미소는 행복의 'expression(표현)'입니다." }, { question: "다음 단어의 관계가 '영어-우리말'로 잘못 짝지어진 것은?", options: ["capital - 수도", "arrival - 도착", "gift - 선물", "wonder - 궁금하다", "spell - 말하다"], answer: 4, rationale: "'spell'은 '철자를 말하다(쓰다)'라는 의미입니다. 단순히 '말하다'는 'talk'나 'say'가 적절합니다." }, { question: "다음 중 '남의 뒷말을 하다(험담하다)'라는 의미의 숙어는?", options: ["sign up for", "in addition", "talk behind one's back", "apologize for", "repeat after me"], answer: 2, rationale: "'talk behind one's back'은 말 그대로 등 뒤에서 말한다는 뜻으로, 험담하다라는 의미입니다." } ]; const App = () => { const [gameState, setGameState] = useState('START'); // START, PLAYING, RESULT const [currentIdx, setCurrentIdx] = useState(0); const [score, setScore] = useState(0); const [timeLeft, setTimeLeft] = useState(60); const [selectedIdx, setSelectedIdx] = useState(null); const [showRationale, setShowRationale] = useState(false); const [isCorrect, setIsCorrect] = useState(false); // 타이머 로직 useEffect(() => { let timer; if (gameState === 'PLAYING' && timeLeft > 0 && !showRationale) { timer = setInterval(() => { setTimeLeft((prev) => prev - 1); }, 1000); } else if (timeLeft === 0 && !showRationale) { handleAnswer(-1); // 시간 초과 시 오답 처리 } return () => clearInterval(timer); }, [gameState, timeLeft, showRationale]); const handleStart = () => { setGameState('PLAYING'); setCurrentIdx(0); setScore(0); setTimeLeft(60); setSelectedIdx(null); setShowRationale(false); }; const handleAnswer = (index) => { if (showRationale) return; setSelectedIdx(index); const correct = index === QUIZ_DATA[currentIdx].answer; setIsCorrect(correct); if (correct) { setScore(prev => prev + 10 + timeLeft); } setShowRationale(true); }; const handleNext = () => { if (currentIdx < QUIZ_DATA.length - 1) { setCurrentIdx(prev => prev + 1); setTimeLeft(60); setSelectedIdx(null); setShowRationale(false); } else { setGameState('RESULT'); } }; const handlePrint = () => { window.print(); }; if (gameState === 'START') { return (

Lesson 2. How Teens Talk Now

핵심 영어 단어 및 숙어 퀴즈

); } if (gameState === 'PLAYING') { const currentQuiz = QUIZ_DATA[currentIdx]; return (
{/* Progress Bar */}
문항 {currentIdx + 1} / {QUIZ_DATA.length}
{timeLeft}s
{score} pts

{currentQuiz.question}

{currentQuiz.options.map((option, idx) => { let buttonStyle = "border-slate-200 hover:border-indigo-300 hover:bg-indigo-50"; let icon = {idx + 1}; if (showRationale) { if (idx === currentQuiz.answer) { buttonStyle = "border-emerald-500 bg-emerald-50 ring-2 ring-emerald-500 ring-offset-2"; icon = ; } else if (idx === selectedIdx) { buttonStyle = "border-rose-500 bg-rose-50 ring-2 ring-rose-500 ring-offset-2"; icon = ; } else { buttonStyle = "opacity-50 border-slate-200 grayscale"; } } return ( ); })}
{/* Rationale Overlay */} {showRationale && (

{isCorrect ? "정답입니다!" : "아쉬워요!"}

{currentQuiz.rationale}

)}
); } if (gameState === 'RESULT') { return (

학습 완료!

수고하셨습니다. 단어 실력이 쑥쑥 늘었네요!

Final Score
{score}
{/* Hidden Print Section */}

Lesson 2 Vocabulary Quiz

How Teens Talk Now - Worksheet

학번: ________
이름: ________
{QUIZ_DATA.map((quiz, qIdx) => (

{qIdx + 1}. {quiz.question}

{quiz.options.map((opt, oIdx) => (
{oIdx + 1}
{opt}
))}
))}
Gusan Middle School - English Class Grade 2
); } }; export default App;