diff --git a/Keyneez/Keyneez/Global/Views/CategoryView.swift b/Keyneez/Keyneez/Global/Views/CategoryView.swift index c13b04c..dc67dc3 100644 --- a/Keyneez/Keyneez/Global/Views/CategoryView.swift +++ b/Keyneez/Keyneez/Global/Views/CategoryView.swift @@ -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) { @@ -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 + } + } } diff --git a/Keyneez/Keyneez/Tab/Home/Views/HomeContentCollectionViewCell.swift b/Keyneez/Keyneez/Tab/Home/Views/HomeContentCollectionViewCell.swift index 64de62d..d6bed4f 100644 --- a/Keyneez/Keyneez/Tab/Home/Views/HomeContentCollectionViewCell.swift +++ b/Keyneez/Keyneez/Tab/Home/Views/HomeContentCollectionViewCell.swift @@ -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 ""}