Skip to content

Commit 86b381a

Browse files
committed
[BOOK-358] feat: 선택 뱃지 추가 및 감상평 화면에서 버튼 항상 활성화 처리
1 parent 62d6638 commit 86b381a

File tree

2 files changed

+22
-7
lines changed

2 files changed

+22
-7
lines changed

src/Projects/BKPresentation/Sources/MainFlow/Note/View/NoteView.swift

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,13 @@ private extension NoteView {
178178

179179
func updateNextButtonEnabled() {
180180
guard pageControl.currentPage < pageViews.count else { return }
181-
let isValid = (currentView as? RegistrationFormProvidable)?.registrationForm() != nil
182-
nextButton.primaryButton?.isEnabled = isValid
181+
182+
if pageControl.currentPage == 2 {
183+
nextButton.primaryButton?.isEnabled = true
184+
} else {
185+
let isValid = (currentView as? RegistrationFormProvidable)?.registrationForm() != nil
186+
nextButton.primaryButton?.isEnabled = isValid
187+
}
183188
}
184189

185190
@objc func pageControlChanged(_ sender: BKPageControl) {

src/Projects/BKPresentation/Sources/MainFlow/Note/View/SentenceAppreciationView.swift

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import SnapKit
66
import UIKit
77

88
struct SentenceAppreciationForm {
9-
let appreciation: String
9+
let appreciation: String?
1010
}
1111

1212
final class SentenceAppreciationView: BaseView {
@@ -17,6 +17,8 @@ final class SentenceAppreciationView: BaseView {
1717
fontStyle: .heading1(weight: .bold)
1818
)
1919

20+
private let optionBadge = BadgeView(title: "선택")
21+
2022
private let subtitleLabel = BKLabel(
2123
text: "감상평 가이드로 쉽게 남길 수 있어요",
2224
fontStyle: .label1(weight: .medium),
@@ -27,6 +29,14 @@ final class SentenceAppreciationView: BaseView {
2729
placeholder: "내용을 입력해주세요."
2830
)
2931

32+
private let titleRowStack: UIStackView = {
33+
let stackView = UIStackView()
34+
stackView.axis = .horizontal
35+
stackView.spacing = LayoutConstants.titleRowStackSpacing
36+
stackView.alignment = .center
37+
return stackView
38+
}()
39+
3040
private let titleStack: UIStackView = {
3141
let stackView = UIStackView()
3242
stackView.axis = .vertical
@@ -67,7 +77,8 @@ final class SentenceAppreciationView: BaseView {
6777

6878
override func setupView() {
6979
addSubviews(titleStack, appreciationTextView, guideButton, tooltipView)
70-
[titleLabel, subtitleLabel].forEach(titleStack.addArrangedSubview(_:))
80+
[titleLabel, optionBadge].forEach(titleRowStack.addArrangedSubview(_:))
81+
[titleRowStack, subtitleLabel].forEach(titleStack.addArrangedSubview(_:))
7182
}
7283

7384
override func configure() {
@@ -134,14 +145,12 @@ extension SentenceAppreciationView: RegistrationFormProvidable, FormInputNotifia
134145

135146
func registrationForm() -> RegistrationForm? {
136147
let trimmedSentence = appreciationTextView.text.trimmingCharacters(in: .whitespacesAndNewlines)
137-
guard !trimmedSentence.isEmpty else {
138-
return nil
139-
}
140148

141149
return .appreciation(SentenceAppreciationForm(
142150
appreciation: trimmedSentence
143151
))
144152
}
153+
145154
}
146155

147156
private extension SentenceAppreciationView {
@@ -151,5 +160,6 @@ private extension SentenceAppreciationView {
151160
static let sentenceViewOffset: CGFloat = 40
152161
static let buttonOffset: CGFloat = 12
153162
static let titleStackSpacing = BKSpacing.spacing1
163+
static let titleRowStackSpacing: CGFloat = 10
154164
}
155165
}

0 commit comments

Comments
 (0)