-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from Busan-Dinosaur/feature/127-follower-paging
[FEAT] 팔로워/팔로잉 페이징 구현
- Loading branch information
Showing
22 changed files
with
920 additions
and
374 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 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 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
117 changes: 117 additions & 0 deletions
117
FoodBowl/Presentation/Common/Component/View/Cell/UserInfoCollectionViewCell.swift
This file contains 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,117 @@ | ||
// | ||
// UserInfoCollectionViewCell.swift | ||
// FoodBowl | ||
// | ||
// Created by COBY_PRO on 2023/01/18. | ||
// | ||
|
||
import Combine | ||
import UIKit | ||
|
||
import Kingfisher | ||
import SnapKit | ||
import Then | ||
|
||
final class UserInfoCollectionViewCell: UICollectionViewCell, BaseViewType { | ||
|
||
// MARK: - ui component | ||
|
||
let userImageButton = UIButton().then { | ||
$0.backgroundColor = .grey003 | ||
$0.layer.cornerRadius = 20 | ||
$0.layer.masksToBounds = true | ||
$0.layer.borderColor = UIColor.grey002.cgColor | ||
$0.layer.borderWidth = 1 | ||
} | ||
let userNameButton = UIButton().then { | ||
$0.setTitleColor(.mainTextColor, for: .normal) | ||
$0.titleLabel?.font = .preferredFont(forTextStyle: .subheadline, weight: .medium) | ||
} | ||
let userFollowerLabel = UILabel().then { | ||
$0.font = UIFont.preferredFont(forTextStyle: .footnote, weight: .light) | ||
$0.textColor = .subTextColor | ||
$0.text = "팔로워 100명" | ||
} | ||
let followButton = FollowButton() | ||
|
||
// MARK: - property | ||
|
||
var userButtonTapAction: ((UserInfoCollectionViewCell) -> Void)? | ||
var followButtonTapAction: ((UserInfoCollectionViewCell) -> Void)? | ||
|
||
// MARK: - init | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
self.baseInit() | ||
self.setupAction() | ||
} | ||
|
||
@available(*, unavailable) | ||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
func setupLayout() { | ||
contentView.addSubviews(userImageButton, userNameButton, userFollowerLabel, followButton) | ||
|
||
userImageButton.snp.makeConstraints { | ||
$0.leading.equalToSuperview().inset(SizeLiteral.horizantalPadding) | ||
$0.top.bottom.equalToSuperview().inset(12) | ||
$0.width.height.equalTo(40) | ||
} | ||
|
||
userNameButton.snp.makeConstraints { | ||
$0.leading.equalTo(userImageButton.snp.trailing).offset(12) | ||
$0.top.equalToSuperview().inset(14) | ||
$0.height.equalTo(18) | ||
} | ||
|
||
userFollowerLabel.snp.makeConstraints { | ||
$0.leading.equalTo(userImageButton.snp.trailing).offset(12) | ||
$0.top.equalTo(userNameButton.snp.bottom).offset(2) | ||
} | ||
|
||
followButton.snp.makeConstraints { | ||
$0.trailing.equalToSuperview().inset(SizeLiteral.horizantalPadding) | ||
$0.centerY.equalToSuperview() | ||
$0.width.equalTo(50) | ||
$0.height.equalTo(30) | ||
} | ||
} | ||
|
||
func configureUI() { | ||
self.backgroundColor = .mainBackgroundColor | ||
} | ||
|
||
private func setupAction() { | ||
userImageButton.addAction(UIAction { _ in self.userButtonTapAction?(self) }, for: .touchUpInside) | ||
userNameButton.addAction(UIAction { _ in self.userButtonTapAction?(self) }, for: .touchUpInside) | ||
followButton.addAction(UIAction { _ in self.followButtonTapAction?(self) }, for: .touchUpInside) | ||
} | ||
} | ||
|
||
// MARK: - Public - func | ||
extension UserInfoCollectionViewCell { | ||
func setupData(_ member: Member) { | ||
if let url = member.profileImageUrl { | ||
userImageButton.kf.setImage(with: URL(string: url), for: .normal) | ||
} else { | ||
userImageButton.setImage(ImageLiteral.defaultProfile, for: .normal) | ||
} | ||
|
||
userNameButton.setTitle(member.nickname, for: .normal) | ||
userFollowerLabel.text = "팔로워 \(member.followerCount.prettyNumber)명" | ||
} | ||
|
||
func setupDataByMemberByFollow(_ member: MemberByFollow) { | ||
if let url = member.profileImageUrl { | ||
userImageButton.kf.setImage(with: URL(string: url), for: .normal) | ||
} else { | ||
userImageButton.setImage(ImageLiteral.defaultProfile, for: .normal) | ||
} | ||
|
||
userNameButton.setTitle(member.nickname, for: .normal) | ||
userFollowerLabel.text = "팔로워 \(member.followerCount.prettyNumber)명" | ||
} | ||
} |
This file contains 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
42 changes: 0 additions & 42 deletions
42
FoodBowl/Presentation/Common/Component/View/Feed/EmptyView.swift
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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 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 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 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
Oops, something went wrong.