From d90ee11ed6c9b796c719263f39bf15529d3d2a16 Mon Sep 17 00:00:00 2001 From: kpk0616 Date: Sat, 14 Jan 2023 04:05:12 +0900 Subject: [PATCH] =?UTF-8?q?[Feat]=20#46=20-=20=ED=99=88=EB=B7=B0=20?= =?UTF-8?q?=EC=B9=B4=ED=85=8C=EA=B3=A0=EB=A6=AC=EB=B7=B0=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Keyneez/Global/Views/CategoryView.swift | 32 ++++++++++++++++--- .../Views/HomeContentCollectionViewCell.swift | 1 + 2 files changed, 28 insertions(+), 5 deletions(-) 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 ""}