Skip to content

Commit e1e9994

Browse files
i18n(ko-KR): update tutorial/ (withastro#12425)
Co-authored-by: Yan <[email protected]>
1 parent 8cfa498 commit e1e9994

File tree

7 files changed

+98
-74
lines changed

7 files changed

+98
-74
lines changed

src/content/docs/ko/tutorial/2-pages/4.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Astro `<style>` 태그는 `define:vars={ {...} }` 지시어를 사용하여 프
107107
const finished = false;
108108
const goal = 3;
109109
110-
const skillColor = "navy";
110+
const skillColor = "crimson";
111111
---
112112
```
113113

@@ -127,7 +127,7 @@ Astro `<style>` 태그는 `define:vars={ {...} }` 지시어를 사용하여 프
127127
</style>
128128
```
129129

130-
3. 브라우저 미리보기에서 정보 페이지를 확인하세요. 이제 `define:vars` 지시어에 전달된 `skillColor` 변수에 따라 스킬이 네이비 블루로 표시되는 것을 볼 수 있습니다.
130+
3. 브라우저 미리보기에서 정보 페이지를 확인하세요. 이제 `define:vars` 지시어에 전달된 `skillColor` 변수에 따라 스킬이 진홍색으로 표시되는 것을 볼 수 있습니다.
131131
</Steps>
132132

133133
<Box icon="puzzle-piece">
@@ -152,7 +152,7 @@ Astro `<style>` 태그는 `define:vars={ {...} }` 지시어를 사용하여 프
152152
```
153153

154154
2. 새로운 `<style>` 태그가 기술 목록에 이러한 스타일을 성공적으로 적용할 수 있도록 프런트매터 스크립트에 누락된 변수 정의를 추가하세요.
155-
- 텍스트 색상은 네이비 블루입니다.
155+
- 텍스트 색상은 진홍색입니다.
156156
- 텍스트가 굵게 표시됩니다.
157157
- 목록 항목은 모두 대문자입니다.
158158
</Steps>
@@ -176,7 +176,7 @@ const happy = true;
176176
const finished = false;
177177
const goal = 3;
178178
179-
const skillColor = "navy";
179+
const skillColor = "crimson";
180180
const fontWeight = "bold";
181181
const textCase = "uppercase";
182182
---
@@ -199,4 +199,4 @@ const textCase = "uppercase";
199199

200200
- [Astro `<style>` 태그](/ko/guides/styling/#astro에서-스타일링하기)
201201

202-
- [Astro의 CSS 변수](/ko/guides/styling/#css-변수)
202+
- [Astro의 CSS 변수](/ko/guides/styling/#css-변수)

src/content/docs/ko/tutorial/2-pages/5.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Astro에서 스타일을 **전역으로** 정의하는 몇 가지 방법이 있
7575
const finished = false;
7676
const goal = 3;
7777
78-
const skillColor = "navy";
78+
const skillColor = "crimson";
7979
const fontWeight = "bold";
8080
const textCase = "uppercase";
8181
---
@@ -151,4 +151,4 @@ import '../styles/global.css';
151151

152152
- [Astro `<style>` 태그](/ko/guides/styling/#astro에서-스타일링하기)
153153

154-
- [Astro의 CSS 변수](/ko/guides/styling/#css-변수)
154+
- [Astro의 CSS 변수](/ko/guides/styling/#css-변수)

src/content/docs/ko/tutorial/3-components/3.mdx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ import Badge from "~/components/Badge.astro"
8989
## 반응형 스타일 추가
9090

9191
<Steps>
92-
1. 탐색 링크를 제어하려면 CSS 클래스로 `Navigation.astro`를 업데이트하세요. `nav-links` 클래스를 사용하여 `<div>`에 기존 탐색 링크를 래핑합니다.
92+
1. 탐색 링크를 제어하려면 CSS 클래스로 `Navigation.astro`를 업데이트하세요. 기존 네비게이션 링크를 `nav-links` 클래스와 `main-menu` id 속성을 가진 `<div>` 태그로 감싸세요.
9393

9494
```astro title="src/components/Navigation.astro" ins={3,7}
9595
---
9696
---
97-
<div class="nav-links">
97+
<div id="main-menu" class="nav-links">
9898
<a href="/">Home</a>
9999
<a href="/about">About</a>
100100
<a href="/blog">Blog</a>
@@ -111,7 +111,7 @@ import Badge from "~/components/Badge.astro"
111111
먼저 작은 화면 크기에서 어떤 일이 발생해야 하는지 정의하는 것부터 시작하세요! 화면 크기가 작을수록 더 간단한 레이아웃이 필요합니다. 그런 다음 더 큰 장치에 맞게 스타일을 조정하세요. 복잡한 케이스를 먼저 디자인했다면, 다시 단순하게 만들려고 노력해야 합니다.
112112
:::
113113

114-
```css title="src/styles/global.css" ins={23-100}
114+
```css title="src/styles/global.css" ins={23-60}
115115
html {
116116
background-color: #f1f5f9;
117117
font-family: sans-serif;
@@ -138,9 +138,6 @@ import Badge from "~/components/Badge.astro"
138138

139139
.nav-links {
140140
width: 100%;
141-
top: 5rem;
142-
left: 48px;
143-
background-color: #ff9776;
144141
display: none;
145142
margin: 0;
146143
}
@@ -153,17 +150,14 @@ import Badge from "~/components/Badge.astro"
153150
font-size: 1.2rem;
154151
font-weight: bold;
155152
text-transform: uppercase;
153+
color: #0d0950;
156154
}
157155

158156
.nav-links a:hover,
159157
.nav-links a:focus {
160158
background-color: #ff9776;
161159
}
162160

163-
.expanded {
164-
display: unset;
165-
}
166-
167161
@media screen and (min-width: 636px) {
168162
.nav-links {
169163
margin-left: 5em;
@@ -177,7 +171,6 @@ import Badge from "~/components/Badge.astro"
177171
display: inline-block;
178172
padding: 15px 20px;
179173
}
180-
181174
}
182175
```
183176
</Steps>

src/content/docs/ko/tutorial/3-components/4.mdx

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ description: >-
55
튜토리얼: 첫 번째 Astro 블로그 구축 — Astro 스크립트 태그를 사용하여 모바일 탐색에 클라이언트 측 상호 작용 기능 추가
66
i18nReady: true
77
---
8-
9-
108
import Blanks from '~/components/tutorial/Blanks.astro';
119
import Box from '~/components/tutorial/Box.astro';
1210
import Checklist from '~/components/Checklist.astro';
@@ -15,74 +13,65 @@ import Option from '~/components/tutorial/Option.astro';
1513
import PreCheck from '~/components/tutorial/PreCheck.astro';
1614
import { Steps } from '@astrojs/starlight/components';
1715

18-
클라이언트 측 상호 작용이 필요한 모바일 화면 크기에서 링크를 열고 닫을 수 있는 햄버거 메뉴를 추가해 보겠습니다.
16+
클라이언트 측 상호 작용이 필요한 모바일 화면 크기에서 탐색 메뉴를 열고 닫을 수 있는 버튼을 추가해 보겠습니다.
1917

2018
<PreCheck>
21-
- 햄버거 메뉴 컴포넌트 만들기
19+
- 메뉴 컴포넌트 만들기
2220
- 사이트 방문자가 탐색 메뉴를 열고 닫을 수 있도록 `<script>` 작성
2321
- JavaScript를 `.js` 파일로 이동
2422
</PreCheck>
2523

26-
## 햄버거 컴포넌트 구축
24+
## 메뉴 컴포넌트 구축
2725

28-
모바일 메뉴를 열고 닫을 수 있는 `<Hamburger />` 컴포넌트를 만듭니다.
26+
모바일 메뉴를 열고 닫을 수 있는 `<Menu />` 컴포넌트를 만듭니다.
2927

3028
<Steps>
31-
1. `src/components/``Hamburger.astro`라는 파일을 생성합니다.
29+
1. `src/components/``Menu.astro`라는 파일을 생성합니다.
3230

33-
2. 다음 코드를 컴포넌트에 복사합니다. 이는 모바일에서 탐색 링크를 열고 닫는 3줄 "햄버거" 메뉴를 나타냅니다. (나중에 `global.css`에 새 CSS 스타일을 추가할 것입니다.)
31+
2. 다음 코드를 컴포넌트에 복사합니다. 이는 모바일 기기에서 탐색 링크의 표시 여부를 전환하는 데 사용될 버튼을 생성합니다. (나중에 `global.css`에 새 CSS 스타일을 추가할 것입니다.)
3432

35-
```astro title="src/components/Hamburger.astro"
33+
```astro title="src/components/Menu.astro"
3634
---
3735
---
38-
<div class="hamburger">
39-
<span class="line"></span>
40-
<span class="line"></span>
41-
<span class="line"></span>
42-
</div>
36+
<button aria-expanded="false" aria-controls="main-menu" class="menu">
37+
Menu
38+
</button>
4339
```
4440

45-
3. 이 새로운 `<Hamburger />` 컴포넌트를 `Header.astro``<Navigation />` 컴포넌트 바로 앞에 배치하세요.
41+
3. 이 새로운 `<Menu />` 컴포넌트를 `Header.astro``<Navigation />` 컴포넌트 바로 앞에 배치하세요.
4642

4743
<details>
4844
<summary>코드를 확인하세요!</summary>
4945

5046
```astro title="src/components/Header.astro" ins={2,7}
5147
---
52-
import Hamburger from './Hamburger.astro';
48+
import Menu from './Menu.astro';
5349
import Navigation from './Navigation.astro';
5450
---
5551
<header>
5652
<nav>
57-
<Hamburger />
53+
<Menu />
5854
<Navigation />
5955
</nav>
6056
</header>
6157
```
6258
</details>
6359

64-
4. 햄버거 컴포넌트에 다음 스타일을 추가합니다.
60+
4. 메뉴 컴포넌트에 다음 스타일을 추가하세요. 여기에는 반응형 스타일도 포함됩니다.
6561

66-
```css title="src/styles/global.css" ins={2-13, 56-58}
62+
```css title="src/styles/global.css" ins={2-9, 33-35, 51-53}
6763
/* nav 스타일 */
68-
.hamburger {
69-
padding-right: 20px;
70-
cursor: pointer;
71-
}
72-
73-
.hamburger .line {
74-
display: block;
75-
width: 40px;
76-
height: 5px;
77-
margin-bottom: 10px;
78-
background-color: #ff9776;
64+
.menu {
65+
background-color: #0d0950;
66+
border: none;
67+
color: #fff;
68+
font-size: 1.2rem;
69+
font-weight: bold;
70+
padding: 5px 10px;
7971
}
8072

8173
.nav-links {
8274
width: 100%;
83-
top: 5rem;
84-
left: 48px;
85-
background-color: #ff9776;
8675
display: none;
8776
margin: 0;
8877
}
@@ -95,13 +84,15 @@ import { Steps } from '@astrojs/starlight/components';
9584
font-size: 1.2rem;
9685
font-weight: bold;
9786
text-transform: uppercase;
87+
color: #0d0950;
9888
}
99-
100-
.nav-links a:hover, a:focus {
89+
90+
.nav-links a:hover,
91+
.nav-links a:focus {
10192
background-color: #ff9776;
10293
}
10394

104-
.expanded {
95+
:has(.menu[aria-expanded="true"]) .nav-links {
10596
display: unset;
10697
}
10798

@@ -119,7 +110,7 @@ import { Steps } from '@astrojs/starlight/components';
119110
padding: 15px 20px;
120111
}
121112

122-
.hamburger {
113+
.menu {
123114
display: none;
124115
}
125116
}
@@ -128,18 +119,21 @@ import { Steps } from '@astrojs/starlight/components';
128119

129120
## 첫 번째 스크립트 태그 작성
130121

131-
탐색 링크를 표시하거나 숨기기 위해 햄버거 메뉴를 클릭하는 등의 사용자 입력에 응답할 수 없기 때문에 헤더는 아직 **대화형**이 아닙니다.
122+
탐색 링크를 표시하거나 숨기기 위해 메뉴를 클릭하는 등의 사용자 입력에 응답할 수 없기 때문에 헤더는 아직 **대화형**이 아닙니다.
132123

133124
`<script>` 태그를 추가하면 클라이언트 측 JavaScript가 사용자 이벤트를 '수신'한 후 그에 따라 응답합니다.
134125

135126
<Steps>
136127
1. `index.astro`의 닫는 `</body>` 태그 바로 앞에 다음 `<script>` 태그를 추가합니다.
137128

138-
```astro title="src/pages/index.astro" ins={2-6}
129+
```astro title="src/pages/index.astro" ins={2-9}
139130
<Footer />
140131
<script>
141-
document.querySelector('.hamburger')?.addEventListener('click', () => {
142-
document.querySelector('.nav-links')?.classList.toggle('expanded');
132+
const menu = document.querySelector('.menu');
133+
134+
menu.addEventListener('click', () => {
135+
const isExpanded = menu.getAttribute('aria-expanded') === 'true';
136+
menu.setAttribute('aria-expanded', !isExpanded);
143137
});
144138
</script>
145139
</body>
@@ -156,26 +150,32 @@ import { Steps } from '@astrojs/starlight/components';
156150
1. `src/scripts/menu.js`를 생성하고 (새 `/scripts/` 폴더를 생성해야 함) JavaScript를 해당 폴더로 이동합니다.
157151

158152
```js title="src/scripts/menu.js"
159-
document.querySelector('.hamburger').addEventListener('click', () => {
160-
document.querySelector('.nav-links').classList.toggle('expanded');
153+
const menu = document.querySelector('.menu');
154+
155+
menu.addEventListener('click', () => {
156+
const isExpanded = menu.getAttribute('aria-expanded') === 'true';
157+
menu.setAttribute('aria-expanded', !isExpanded);
161158
});
162159
```
163160

164161
2. `index.astro``<script>` 태그 내용을 다음 파일 가져오기로 바꿉니다.
165162

166-
```astro title="src/pages/index.astro" ins={7} del={3-5}
163+
```astro title="src/pages/index.astro" ins={7} del={3-8}
167164
<Footer />
168165
<script>
169-
document.querySelector('.hamburger')?.addEventListener('click', () => {
170-
document.querySelector('.nav-links')?.classList.toggle('expanded');
166+
const menu = document.querySelector('.menu');
167+
168+
menu.addEventListener('click', () => {
169+
const isExpanded = menu.getAttribute('aria-expanded') === 'true';
170+
menu.setAttribute('aria-expanded', !isExpanded);
171171
});
172172
173173
import "../scripts/menu.js";
174174
</script>
175175
</body>
176176
```
177177

178-
3. 더 작은 크기로 브라우저 미리보기를 다시 확인하고 햄버거 메뉴가 여전히 탐색 링크를 열고 닫는지 확인하세요.
178+
3. 더 작은 크기로 브라우저 미리보기를 다시 확인하고 메뉴가 여전히 탐색 링크를 열고 닫는지 확인하세요.
179179

180180
4. 가져오기와 동일한 `<script>`를 다른 두 페이지인 `about.astro``blog.astro`에 추가하고 각 페이지에 반응형 대화형 헤더가 있는지 확인하세요.
181181

src/content/docs/ko/tutorial/3-components/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import Option from '~/components/tutorial/Option.astro';
2424
- 페이지 링크 메뉴를 표시하는 탐색 컴포넌트
2525
- 각 페이지 하단에 포함할 바닥글 컴포넌트
2626
- 프로필 페이지로 연결되는 바닥글에 사용되는 소셜 미디어 컴포넌트
27-
- 모바일에서 탐색을 전환하는 대화형 햄버거 컴포넌트
27+
- 모바일에서 탐색을 전환하는 대화형 메뉴 컴포넌트
2828

2929
그 과정에서 CSS와 JavaScript를 사용하여 화면 크기와 사용자 입력에 반응하는 반응형 디자인을 구축하게 됩니다.
3030

0 commit comments

Comments
 (0)