-
Notifications
You must be signed in to change notification settings - Fork 0
feat: 도서 등록 Flow 추가 #103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: 도서 등록 Flow 추가 #103
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f4b69fb
[BOOK-159] fix: resolve inconsistent distribution in buttonGroup layout
clxxrlove 8182f3c
[BOOK-159] chore: add TODO comments for upcoming event implementations
clxxrlove ffa6a73
[BOOK-159] feat: add BookRegistrationStatusView
clxxrlove ff3e8e2
[BOOK-159] feat: implement UI for book registration
clxxrlove 84eceee
[BOOK-159] feat: handle status selection changes in BookRegistrationS…
clxxrlove f92eeb3
[BOOK-159] feat: add reading log suggestion view
clxxrlove fcf2f7e
[BOOK-159] fix: fix typo
clxxrlove File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/Projects/BKPresentation/Sources/MainFlow/Search/View/BookRegistrationStatusView.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| // Copyright © 2025 Booket. All rights reserved | ||
|
|
||
| import BKDesign | ||
| import SnapKit | ||
| import UIKit | ||
|
|
||
| enum BookRegistrationStatus: String { | ||
| case before = "읽기 전" | ||
| case inProgress = "읽는 중" | ||
| case after = "독서 완료" | ||
| } | ||
|
|
||
| final class BookRegistrationStatusView: UIView { | ||
| private let stackView = UIStackView() | ||
| private let statuses: [BookRegistrationStatus] = [.before, .inProgress, .after] | ||
| private var buttons: [BKButton] = [] | ||
|
|
||
| var onSelected: (() -> Void)? | ||
|
|
||
| private(set) var selectedStatus: BookRegistrationStatus? { | ||
| didSet { | ||
| onSelected?() | ||
| } | ||
| } | ||
|
|
||
| override init(frame: CGRect) { | ||
| super.init(frame: frame) | ||
| setupView() | ||
| } | ||
|
|
||
| required init?(coder: NSCoder) { | ||
| super.init(coder: coder) | ||
| setupView() | ||
| } | ||
| } | ||
|
|
||
| private extension BookRegistrationStatusView { | ||
| func setupView() { | ||
| addSubview(stackView) | ||
| stackView.axis = .horizontal | ||
| stackView.spacing = BKInset.inset2 | ||
| stackView.distribution = .fillEqually | ||
| stackView.alignment = .fill | ||
|
|
||
| stackView.snp.makeConstraints { | ||
| $0.top.equalToSuperview() | ||
| .inset(BKInset.inset5) | ||
| $0.bottom.equalToSuperview() | ||
| .inset(BKInset.inset3) | ||
| $0.leading.trailing.equalToSuperview() | ||
| } | ||
|
|
||
| statuses.forEach { status in | ||
| let button = BKButton.secondary(title: status.rawValue) | ||
| button.addAction(UIAction { [weak self] _ in | ||
| self?.select(status: status) | ||
| }, for: .touchUpInside) | ||
|
|
||
| button.snp.makeConstraints { | ||
| $0.height.equalTo(LayoutConstants.buttonHeight) | ||
| } | ||
| buttons.append(button) | ||
| stackView.addArrangedSubview(button) | ||
| } | ||
| } | ||
|
|
||
| func select(status: BookRegistrationStatus) { | ||
| selectedStatus = status | ||
|
|
||
| for (index, button) in buttons.enumerated() { | ||
| if statuses[index] == status { | ||
| button.style = .tertiary | ||
| } else { | ||
| button.style = .secondary | ||
| } | ||
| } | ||
| } | ||
|
|
||
| enum LayoutConstants { | ||
| static let buttonHeight: CGFloat = 52 | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
사실 버튼 그룹은 1개 2개 조합만 있는 거였는데, 혹시 사용하실 일 있으실까봐 바텀시트 예시에 있는 3개짜리 버튼 그룹도 임시로 만들어둔거였습니다 ! 실제로 디자인에서 차이가 있었는지는 미처 고려하지 못했네요 ㅠㅠ 죄송합니다