Skip to content

Commit e5dfdaa

Browse files
committed
closeBth
1 parent fbf63ce commit e5dfdaa

5 files changed

Lines changed: 21 additions & 16 deletions

File tree

src/game/stage1.jsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ const Stage1 = ({ onClose }) => {
134134
style={{
135135
position: 'relative',
136136
width: '1200px',
137-
height: '450px',
137+
height: '480px',
138138
border: '2px dashed #000',
139139
margin: '20px auto',
140140
backgroundImage: 'url(/images/stage1.png)',
@@ -187,9 +187,6 @@ const Stage1 = ({ onClose }) => {
187187
<button onClick={handleReset} style={{ margin: '5px' }}>
188188
리셋
189189
</button>
190-
<button onClick={onClose} style={{ margin: '5px' }}>
191-
돌아가기
192-
</button>
193190
<button onClick={() => handleHint(1)}>힌트1</button>
194191
<button
195192
onClick={() => handleHint(2)}

src/game/stage2.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,12 @@ p, h2 {
3030
border: 1px solid #8B4513;
3131
border-radius: 5px;
3232
margin: 10px;
33-
max-width: 90%;
33+
max-width: 70%;
34+
margin-left: 200px;
3435
}
3536

3637
.problem-image {
37-
width: 100%;
38+
width: 70%;
3839
height: auto;
3940
border: 2px solid #8B4513;
4041
border-radius: 5px;

src/game/stage2.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ const Stage2 = ({ onClose }) => {
200200
<button className='stage2btn' onClick={handleSubmit}>정답 확인</button>
201201
<button className='stage2btn' onClick={handleHint}>힌트</button>
202202
<button className='stage2btn' onClick={handleReset}>다시하기</button>
203-
<button className='stage2btn' onClick={handleGoBack}>돌아가기</button> {/* Call handleGoBack to close the dashboard */}
204203
</div>
205204

206205
{message && <p id="message">{message}</p>}

src/game/stage3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ const Stage3 = ({ onClose }) => { // Add onClose prop
126126

127127
{/* Back Button Positioned Below */}
128128
<div className="back-button-container">
129-
<button onClick={handleBackToMap}>돌아가기</button> {/* Close the dashboard */}
129+
<button >숫자들을 누르면 단소 소리가 나요!</button> {/* Close the dashboard */}
130130
</div>
131131

132132
<div className="bubble-container">

src/imageslider.js

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,22 @@ const ImageSlider = () => {
9797
};
9898

9999
const startGame = () => {
100-
if (currentIndex === 0) {
101-
setShowStage1(true); // Show Stage1 for map1
102-
} else if (currentIndex === 1) {
103-
setShowStage2(true); // Show Stage2 for map2
104-
} else if (currentIndex === 2) {
105-
setShowStage3(true); // Show Stage3 for map3
100+
if (showStage1 || showStage2 || showStage3) {
101+
// If any stage is already open, close all stages
102+
setShowStage1(false);
103+
setShowStage2(false);
104+
setShowStage3(false);
106105
} else {
107-
navigate(`/game/stage${currentIndex + 1}`, { state: { stageIndex: currentIndex } });
106+
// Otherwise, start the game based on the current index
107+
if (currentIndex === 0) {
108+
setShowStage1(true); // Show Stage1 for map1
109+
} else if (currentIndex === 1) {
110+
setShowStage2(true); // Show Stage2 for map2
111+
} else if (currentIndex === 2) {
112+
setShowStage3(true); // Show Stage3 for map3
113+
} else {
114+
navigate(`/game/stage${currentIndex + 1}`, { state: { stageIndex: currentIndex } });
115+
}
108116
}
109117
};
110118

@@ -242,7 +250,7 @@ const ImageSlider = () => {
242250
</map>
243251
</div>
244252
<button onClick={startGame} style={{ marginTop: '10px', marginBottom: '10px' }}>
245-
미니 게임 시작
253+
{showStage1 || showStage2 || showStage3 ? '미니 게임 닫기' : '미니 게임 시작'}
246254
</button>
247255
{currentIndex > 0 && (
248256
<button

0 commit comments

Comments
 (0)