Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import SnapKit
import UIKit

struct SentenceAppreciationForm {
let appreciation: String
let appreciation: String?
}

final class SentenceAppreciationView: BaseView {
Expand All @@ -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),
Expand All @@ -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
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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 {
Expand All @@ -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
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import BKDesign
import UIKit
import SnapKit

// 2차 작업 때, BKDesign component로 빼기
final class TooltipView: BaseView {
private let textLabel = BKLabel(
text: "예시 문장을 알려드려요",
Expand Down
Loading