Skip to content

Commit

Permalink
[Feat] Keyneez#46 - 홈뷰 카테고리뷰 변경 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
kpk0616 committed Jan 13, 2023
1 parent 31f5603 commit d90ee11
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
32 changes: 27 additions & 5 deletions Keyneez/Keyneez/Global/Views/CategoryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ final class CategoryView: NiblessView {
self.layer.borderColor = UIColor.mint500.cgColor
}

private let category = UILabel().then {
private let categoryLabel = UILabel().then {
$0.text = "문화"
$0.textColor = UIColor.mint500
$0.font = UIFont.font(.pretendardBold, ofSize: 14)
$0.textColor = .mint500
$0.font = .font(.pretendardBold, ofSize: 14)
}

override init(frame: CGRect) {
Expand All @@ -34,9 +34,31 @@ final class CategoryView: NiblessView {

extension CategoryView {
private func setLayout() {
self.addSubviews(category)
category.snp.makeConstraints {
self.addSubviews(categoryLabel)
categoryLabel.snp.makeConstraints {
$0.centerX.centerY.equalToSuperview()
}
}
func setCategory(with category: String) {
switch(category) {
case "진로" :
categoryLabel.text = "진로"
categoryLabel.textColor = .green600
self.layer.borderColor = UIColor.green600.cgColor
case "봉사":
categoryLabel.text = "봉사"
categoryLabel.textColor = .purple500
self.layer.borderColor = UIColor.purple500.cgColor
case "여행":
categoryLabel.text = "여행"
categoryLabel.textColor = .pink500
self.layer.borderColor = UIColor.pink500.cgColor
case "경제":
categoryLabel.text = "경제"
categoryLabel.textColor = .red500
self.layer.borderColor = UIColor.red500.cgColor
default:
break
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ extension HomeContentCollectionViewCell {
likeButton.isSelected = model.liked
contentImageView.setImage(url: model.contentImg)
setCategoryCard(category: model.category[0])
categoryView.setCategory(with: model.category[0])
}
private func setTitle(fullTitle: String) -> String {
guard let title = fullTitle as? String else {return ""}
Expand Down

0 comments on commit d90ee11

Please sign in to comment.