Skip to content

Commit 5ea05f0

Browse files
committed
학습 실행기에 활성 레슨 맥락 표시
레슨 카드를 누르면 실행기 위에 그 레슨 제목과 학습 방향을 amber 배지로 보여준다. 브라우즈 -> 레슨 선택 -> 무엇을 배우는지 확인 -> 코드 실행의 학습 루프 완결.
1 parent 4bda399 commit 5ea05f0

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

landing/src/pages/learn.jsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export function LearnPage() {
1515
const [loaded, setLoaded] = useState(null);
1616
const nonceRef = useRef(0);
1717

18-
function runLesson(code) {
19-
if (!code) return;
20-
setLoaded({ code, nonce: (nonceRef.current += 1) });
18+
function runLesson(lesson) {
19+
if (!lesson || !lesson.code) return;
20+
setLoaded({ code: lesson.code, title: lesson.title, direction: lesson.direction, nonce: (nonceRef.current += 1) });
2121
if (typeof document !== "undefined") {
2222
const el = document.getElementById("py-runner");
2323
if (el) el.scrollIntoView({ behavior: "smooth", block: "start" });
@@ -63,6 +63,15 @@ export function LearnPage() {
6363
불러오세요. 이 탭 안에서 진짜 CPython이 돕니다.
6464
</Text>
6565
</div>
66+
{loaded && loaded.title && (
67+
<div className="learnActiveLesson">
68+
<Badge variant="accent" label="레슨" />
69+
<div>
70+
<Text type="body-sm" weight="600">{loaded.title}</Text>
71+
{loaded.direction && <Text type="body-sm" color="muted">{loaded.direction}</Text>}
72+
</div>
73+
</div>
74+
)}
6675
<PythonRunner load={loaded} />
6776
</section>
6877

@@ -93,7 +102,7 @@ export function LearnPage() {
93102
className="learnLessonButton"
94103
disabled={!lesson.code}
95104
title={lesson.code ? "이 레슨의 코드를 실행기로 불러오기" : "실행 코드 없음"}
96-
onClick={() => runLesson(lesson.code)}
105+
onClick={() => runLesson(lesson)}
97106
>
98107
<Card padding={4}>
99108
<div className="learnLessonCard">

landing/src/styles/homeAstryx.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,17 @@
230230
flex: none;
231231
}
232232

233+
.learnActiveLesson {
234+
display: flex;
235+
gap: 12px;
236+
align-items: flex-start;
237+
padding: 12px 14px;
238+
margin-bottom: 12px;
239+
border-radius: 10px;
240+
border: 1px solid var(--color-accent, #f5a524);
241+
background: var(--color-accent-muted, rgba(245, 165, 36, 0.08));
242+
}
243+
233244
/* 브라우저 Python 실행기 */
234245
.pyRunner {
235246
border: 1px solid var(--color-border, rgba(120, 120, 130, 0.3));

0 commit comments

Comments
 (0)