-
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 #23 from boostcampwm-2022/feature/BrowseView
BrowseView 구성
- Loading branch information
Showing
6 changed files
with
101 additions
and
24 deletions.
There are no files selected for viewing
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
63 changes: 63 additions & 0 deletions
63
DailyQuest/DailyQuest/Presentation/Browse/View/UserInfoView.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,63 @@ | ||
// | ||
// UserInfoView.swift | ||
// DailyQuest | ||
// | ||
// Created by jinwoong Kim on 2022/11/16. | ||
// | ||
|
||
import UIKit | ||
|
||
import SnapKit | ||
|
||
final class UserInfoView: UIStackView { | ||
|
||
// MARK: - Components | ||
private lazy var userImage: UIImageView = { | ||
let userImage = UIImageView() | ||
userImage.image = UIImage(systemName: "heart.fill") | ||
userImage.clipsToBounds = true | ||
userImage.backgroundColor = .white | ||
|
||
return userImage | ||
}() | ||
|
||
private lazy var welcomeLabel: UILabel = { | ||
let welcomeLabel = UILabel() | ||
|
||
return welcomeLabel | ||
}() | ||
|
||
// MARK: - Methods | ||
convenience init() { | ||
self.init(frame: .zero) | ||
|
||
axis = .horizontal | ||
alignment = .center | ||
spacing = 10 | ||
isLayoutMarginsRelativeArrangement = true | ||
layoutMargins = UIEdgeInsets(top: 0, left: 10, bottom: 0, right: 10) | ||
|
||
configureUI() | ||
} | ||
|
||
override func layoutSubviews() { | ||
super.layoutSubviews() | ||
userImage.layer.cornerRadius = userImage.frame.height / 2 | ||
} | ||
|
||
private func configureUI() { | ||
addArrangedSubview(userImage) | ||
addArrangedSubview(welcomeLabel) | ||
|
||
userImage.snp.makeConstraints { make in | ||
make.height.equalToSuperview().offset(-40) | ||
make.width.equalTo(userImage.snp.height) | ||
} | ||
} | ||
|
||
func setup(with user: User) { | ||
welcomeLabel.text = user.nickName + "님의 퀘스트" | ||
guard let image = UIImage(data: user.profile) else { return } | ||
userImage.image = image | ||
} | ||
} |
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