diff --git a/src/Projects/BKPresentation/Sources/MainFlow/Note/View/BadgeView.swift b/src/Projects/BKPresentation/Sources/MainFlow/Note/View/BadgeView.swift new file mode 100644 index 00000000..fa167ae1 --- /dev/null +++ b/src/Projects/BKPresentation/Sources/MainFlow/Note/View/BadgeView.swift @@ -0,0 +1,46 @@ +// Copyright © 2025 Booket. All rights reserved + +import BKDesign +import SnapKit +import UIKit + +final class BadgeView: UIView { + private let label = BKLabel( + fontStyle: .caption1(weight: .medium), + color: .bkContentColor(.brand), + alignment: .center + ) + + public var title: String { + didSet { + label.setText(text: title) + } + } + + public init(title: String) { + self.title = title + super.init(frame: .zero) + + setupUI() + setupLayout() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private func setupUI() { + self.backgroundColor = .bkBackgroundColor(.tertiary) + self.layer.cornerRadius = BKRadius.xsmall + label.setText(text: title) + } + + private func setupLayout() { + addSubview(label) + + label.snp.makeConstraints { + $0.leading.trailing.equalToSuperview().inset(BKSpacing.spacing2) + $0.top.bottom.equalToSuperview().inset(BKSpacing.spacing05) + } + } +} diff --git a/src/Projects/BKPresentation/Sources/MainFlow/Note/View/NoteView.swift b/src/Projects/BKPresentation/Sources/MainFlow/Note/View/NoteView.swift index 5fa4477a..034f7eec 100644 --- a/src/Projects/BKPresentation/Sources/MainFlow/Note/View/NoteView.swift +++ b/src/Projects/BKPresentation/Sources/MainFlow/Note/View/NoteView.swift @@ -178,8 +178,13 @@ private extension NoteView { func updateNextButtonEnabled() { guard pageControl.currentPage < pageViews.count else { return } - let isValid = (currentView as? RegistrationFormProvidable)?.registrationForm() != nil - nextButton.primaryButton?.isEnabled = isValid + + if pageControl.currentPage == 2 { + nextButton.primaryButton?.isEnabled = true + } else { + let isValid = (currentView as? RegistrationFormProvidable)?.registrationForm() != nil + nextButton.primaryButton?.isEnabled = isValid + } } @objc func pageControlChanged(_ sender: BKPageControl) { diff --git a/src/Projects/BKPresentation/Sources/MainFlow/Note/View/SentenceAppreciationView.swift b/src/Projects/BKPresentation/Sources/MainFlow/Note/View/SentenceAppreciationView.swift index 34373d86..ab5d9b2f 100644 --- a/src/Projects/BKPresentation/Sources/MainFlow/Note/View/SentenceAppreciationView.swift +++ b/src/Projects/BKPresentation/Sources/MainFlow/Note/View/SentenceAppreciationView.swift @@ -6,7 +6,7 @@ import SnapKit import UIKit struct SentenceAppreciationForm { - let appreciation: String + let appreciation: String? } final class SentenceAppreciationView: BaseView { @@ -17,6 +17,8 @@ final class SentenceAppreciationView: BaseView { fontStyle: .heading1(weight: .bold) ) + private let optionBadge = BadgeView(title: "선택") + private let subtitleLabel = BKLabel( text: "감상평 가이드로 쉽게 남길 수 있어요", fontStyle: .label1(weight: .medium), @@ -27,6 +29,14 @@ final class SentenceAppreciationView: BaseView { placeholder: "내용을 입력해주세요." ) + private let titleRowStack: UIStackView = { + let stackView = UIStackView() + stackView.axis = .horizontal + stackView.spacing = LayoutConstants.titleRowStackSpacing + stackView.alignment = .center + return stackView + }() + private let titleStack: UIStackView = { let stackView = UIStackView() stackView.axis = .vertical @@ -67,7 +77,8 @@ final class SentenceAppreciationView: BaseView { override func setupView() { addSubviews(titleStack, appreciationTextView, guideButton, tooltipView) - [titleLabel, subtitleLabel].forEach(titleStack.addArrangedSubview(_:)) + [titleLabel, optionBadge].forEach(titleRowStack.addArrangedSubview(_:)) + [titleRowStack, subtitleLabel].forEach(titleStack.addArrangedSubview(_:)) } override func configure() { @@ -134,14 +145,12 @@ extension SentenceAppreciationView: RegistrationFormProvidable, FormInputNotifia func registrationForm() -> RegistrationForm? { let trimmedSentence = appreciationTextView.text.trimmingCharacters(in: .whitespacesAndNewlines) - guard !trimmedSentence.isEmpty else { - return nil - } return .appreciation(SentenceAppreciationForm( appreciation: trimmedSentence )) } + } private extension SentenceAppreciationView { @@ -151,5 +160,6 @@ private extension SentenceAppreciationView { static let sentenceViewOffset: CGFloat = 40 static let buttonOffset: CGFloat = 12 static let titleStackSpacing = BKSpacing.spacing1 + static let titleRowStackSpacing: CGFloat = 10 } } diff --git a/src/Projects/BKPresentation/Sources/MainFlow/Note/View/SentenceListCell.swift b/src/Projects/BKPresentation/Sources/MainFlow/Note/View/SentenceListCell.swift index 0cacd409..a4557c89 100644 --- a/src/Projects/BKPresentation/Sources/MainFlow/Note/View/SentenceListCell.swift +++ b/src/Projects/BKPresentation/Sources/MainFlow/Note/View/SentenceListCell.swift @@ -53,19 +53,22 @@ final class SentenceListCell: UICollectionViewCell { // MARK: - Configuration func configure(with sentence: RecognizedTextViewModel.SentenceItem) { sentenceLabel.setText(text: sentence.text) - updateSelectionState(isSelected: sentence.isSelected) + sentenceLabel.setColor(color: .bkContentColor(.primary)) + UIView.animate(withDuration: 0.2) { [weak self] in + self?.updateSelectionState(isSelected: sentence.isSelected) + } } private func updateSelectionState(isSelected: Bool) { if isSelected { + sentenceLabel.setFontStyle(style: .body1(weight: .medium)) contentView.backgroundColor = .bkBackgroundColor(.tertiary) contentView.layer.borderWidth = 1 contentView.layer.borderColor = UIColor.bkBorderColor(.brand).cgColor - sentenceLabel.setColor(color: .bkContentColor(.brand)) } else { + sentenceLabel.setFontStyle(style: .body1(weight: .regular)) contentView.backgroundColor = .bkBackgroundColor(.secondary) contentView.layer.borderColor = UIColor.clear.cgColor - sentenceLabel.setColor(color: .bkContentColor(.primary)) } UIView.animate(withDuration: 0.2) { diff --git a/src/Projects/BKPresentation/Sources/MainFlow/Note/View/TooltipView.swift b/src/Projects/BKPresentation/Sources/MainFlow/Note/View/TooltipView.swift index 6fe890d6..c005ccba 100644 --- a/src/Projects/BKPresentation/Sources/MainFlow/Note/View/TooltipView.swift +++ b/src/Projects/BKPresentation/Sources/MainFlow/Note/View/TooltipView.swift @@ -4,6 +4,7 @@ import BKDesign import UIKit import SnapKit +// 2차 작업 때, BKDesign component로 빼기 final class TooltipView: BaseView { private let textLabel = BKLabel( text: "예시 문장을 알려드려요",