Skip to content

Commit 53e9bd9

Browse files
authored
[#260] TodoEditorView의 UX를 개선한다 (#264)
* ui: 텍스트필드 폰트 및 문구 수정 * ui: TodoEditorView가 마크다운을 지원함을 사용자가 알 수 있도록 개선
1 parent a4c1017 commit 53e9bd9

2 files changed

Lines changed: 53 additions & 17 deletions

File tree

DevLog/Resource/Localizable.xcstrings

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@
3232
}
3333
}
3434
}
35+
},
36+
"Markdown 미리보기" : {
37+
38+
},
39+
"Markdown 지원 · 예: # 제목, - 목록, **굵게**" : {
40+
3541
},
3642
"night_sky" : {
3743
"extractionState" : "manual",
@@ -324,7 +330,7 @@
324330
"생성일" : {
325331

326332
},
327-
"설명(선택 사항)" : {
333+
"설명(선택)" : {
328334

329335
},
330336
"설정" : {
@@ -400,7 +406,7 @@
400406
}
401407
}
402408
},
403-
"제목" : {
409+
"제목(필수)" : {
404410

405411
},
406412
"주간 추세" : {
@@ -453,6 +459,9 @@
453459
},
454460
"편집" : {
455461

462+
},
463+
"편집 탭에서 Markdown으로 작성하면 여기에서 서식이 적용되어 보여요." : {
464+
456465
},
457466
"푸시 알람 활성화" : {
458467

DevLog/UI/Home/TodoEditorView.swift

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,10 @@ struct TodoEditorView: View {
6363
get: { viewModel.state.title },
6464
set: { viewModel.send(.setTitle($0)) }
6565
),
66-
prompt: Text("제목").foregroundColor(Color.gray)
66+
prompt: Text("제목(필수)").foregroundColor(Color.secondary),
6767
)
68-
.frame(height: 22)
68+
.font(.title2)
69+
.frame(height: 30)
6970
.focused($field, equals: .title)
7071
.padding(.horizontal)
7172
}
@@ -96,32 +97,58 @@ struct TodoEditorView: View {
9697
}
9798
}
9899
.padding(.vertical, 10)
99-
.background(Color(UIColor.systemBackground))
100+
.background(Color(.systemBackground))
100101
}
101102
}
102103

103104
private var tabView: some View {
104105
Group {
105106
if viewModel.state.tabViewTag == .editor {
106-
TextField(
107-
"",
108-
text: Binding(
109-
get: { viewModel.state.content },
110-
set: { viewModel.send(.setContent($0)) }
111-
),
112-
prompt: Text("설명(선택 사항)").font(.callout),
113-
axis: .vertical
114-
)
115-
.focused($field, equals: .description)
107+
VStack(alignment: .leading, spacing: 8) {
108+
markdownHint
109+
TextField(
110+
"",
111+
text: Binding(
112+
get: { viewModel.state.content },
113+
set: { viewModel.send(.setContent($0)) }
114+
),
115+
prompt: Text("설명(선택)").foregroundColor(Color.secondary),
116+
axis: .vertical
117+
)
118+
.font(.callout)
119+
.focused($field, equals: .description)
120+
}
116121
} else {
117-
Markdown(viewModel.state.content)
118-
.markdownTheme(.basic)
122+
if viewModel.state.content.isEmpty {
123+
previewPlaceholder
124+
} else {
125+
Markdown(viewModel.state.content)
126+
.markdownTheme(.basic)
127+
}
119128
}
120129
}
121130
.padding(.horizontal)
122131
.padding(.top, 10)
123132
}
124133

134+
private var markdownHint: some View {
135+
Text("Markdown 지원 · 예: # 제목, - 목록, **굵게**")
136+
.font(.caption)
137+
.foregroundStyle(.secondary)
138+
}
139+
140+
private var previewPlaceholder: some View {
141+
VStack(alignment: .leading, spacing: 6) {
142+
Text("Markdown 미리보기")
143+
.font(.subheadline.weight(.semibold))
144+
Text("편집 탭에서 Markdown으로 작성하면 여기에서 서식이 적용되어 보여요.")
145+
.font(.footnote)
146+
.foregroundStyle(.secondary)
147+
}
148+
.frame(maxWidth: .infinity, alignment: .leading)
149+
.padding(.vertical, 8)
150+
}
151+
125152
private var accessoryBar: some View {
126153
HStack {
127154
Button {

0 commit comments

Comments
 (0)