From 3850dc95826b4db145ad805e19ccbf8b10b89c87 Mon Sep 17 00:00:00 2001 From: Jouureee Date: Sun, 2 Jun 2024 19:04:43 +0900 Subject: [PATCH] =?UTF-8?q?Add:=20ProductTastesTagView=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20=EB=B0=8F=20cell=EC=97=90=20=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pyonsnal-Color.xcodeproj/project.pbxproj | 4 ++ .../ProductDetail/ProductTastesTagView.swift | 52 +++++++++++++++++++ ...ductDetailInformationCell+ViewHolder.swift | 15 +++++- .../ProductDetailInformationCell.swift | 14 +++++ .../ProfileHome/ProfileHomeInteractor.swift | 2 +- 5 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 Pyonsnal-Color/Pyonsnal-Color/ProductDetail/ProductTastesTagView.swift diff --git a/Pyonsnal-Color/Pyonsnal-Color.xcodeproj/project.pbxproj b/Pyonsnal-Color/Pyonsnal-Color.xcodeproj/project.pbxproj index 07e6d79b..550945c3 100644 --- a/Pyonsnal-Color/Pyonsnal-Color.xcodeproj/project.pbxproj +++ b/Pyonsnal-Color/Pyonsnal-Color.xcodeproj/project.pbxproj @@ -278,6 +278,7 @@ F0687BED2A529679004B5EAE /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = F0687BEC2A529679004B5EAE /* Config.swift */; }; F068A9702A99E76A000AFD52 /* FilterRenderable.swift in Sources */ = {isa = PBXBuildFile; fileRef = F068A96F2A99E76A000AFD52 /* FilterRenderable.swift */; }; F069DBE62A30B9850001D3DD /* UIFont+.swift in Sources */ = {isa = PBXBuildFile; fileRef = F069DBE52A30B9850001D3DD /* UIFont+.swift */; }; + F06E3DA32C0C76F900D6C195 /* ProductTastesTagView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F06E3DA22C0C76F900D6C195 /* ProductTastesTagView.swift */; }; F06E3D982C0C428D00D6C195 /* ActionButtonCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F06E3D972C0C428D00D6C195 /* ActionButtonCell.swift */; }; F06F40292B35E2FC00897396 /* AdMobManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = F06F40282B35E2FC00897396 /* AdMobManager.swift */; }; F06F40322B35EE2800897396 /* CurationAdCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F06F40312B35EE2800897396 /* CurationAdCell.swift */; }; @@ -620,6 +621,7 @@ F069DBE92A30BA8C0001D3DD /* Pretendard-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-Regular.otf"; sourceTree = ""; }; F069DBEA2A30BA8C0001D3DD /* Pretendard-SemiBold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-SemiBold.otf"; sourceTree = ""; }; F06E3D972C0C428D00D6C195 /* ActionButtonCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionButtonCell.swift; sourceTree = ""; }; + F06E3DA22C0C76F900D6C195 /* ProductTastesTagView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductTastesTagView.swift; sourceTree = ""; }; F06F40282B35E2FC00897396 /* AdMobManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdMobManager.swift; sourceTree = ""; }; F06F40312B35EE2800897396 /* CurationAdCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurationAdCell.swift; sourceTree = ""; }; F06F40362B37361500897396 /* NativeAdView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NativeAdView.swift; sourceTree = ""; }; @@ -1305,6 +1307,7 @@ BA87E3DF2A462AD9000A9DEC /* ProductTagListView.swift */, BA87E3D42A45D400000A9DEC /* GiftItemView.swift */, BA87E3D62A45D40A000A9DEC /* GiftInformationView.swift */, + F06E3DA22C0C76F900D6C195 /* ProductTastesTagView.swift */, ); path = ProductDetail; sourceTree = ""; @@ -2223,6 +2226,7 @@ B2F258192AAF03160022013E /* DetailReviewInteractor.swift in Sources */, B2EECB772B6A896600B328C1 /* LoginPopupViewHolder.swift in Sources */, F0A8A3B02A70053D00601DAE /* FilterType.swift in Sources */, + F06E3DA32C0C76F900D6C195 /* ProductTastesTagView.swift in Sources */, F06F40322B35EE2800897396 /* CurationAdCell.swift in Sources */, BA87E3D72A45D40A000A9DEC /* GiftInformationView.swift in Sources */, F0B90DCC2ADD2167005DE34A /* FavoriteHomePageViewController.swift in Sources */, diff --git a/Pyonsnal-Color/Pyonsnal-Color/ProductDetail/ProductTastesTagView.swift b/Pyonsnal-Color/Pyonsnal-Color/ProductDetail/ProductTastesTagView.swift new file mode 100644 index 00000000..4fe1492c --- /dev/null +++ b/Pyonsnal-Color/Pyonsnal-Color/ProductDetail/ProductTastesTagView.swift @@ -0,0 +1,52 @@ +// +// ProductTastesView.swift +// Pyonsnal-Color +// +// Created by 조소정 on 6/2/24. +// + +import UIKit +import SnapKit + +final class ProductTastesTagView: UIView { + // MARK: - Initializer + init(text: String) { + super.init(frame: .zero) + configureUI() + configureView() + configureConstraint() + setText(with: text) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + private var tastesTagLabel: UILabel = { + let label = UILabel() + label.textColor = .red500 + label.font = .body3r + return label + }() + + private func setText(with text: String) { + self.tastesTagLabel.text = text + } + + private func configureUI() { + self.backgroundColor = .red100 + } + + private func configureView() { + self.addSubview(tastesTagLabel) + } + + private func configureConstraint() { + tastesTagLabel.snp.makeConstraints { + $0.top.equalToSuperview().offset(.spacing2) + $0.bottom.equalToSuperview().inset(.spacing2) + $0.leading.equalToSuperview().inset(.spacing8) + $0.trailing.equalToSuperview().inset(.spacing8) + } + } +} diff --git a/Pyonsnal-Color/Pyonsnal-Color/ProductDetail/Subview/InformationCell/ProductDetailInformationCell+ViewHolder.swift b/Pyonsnal-Color/Pyonsnal-Color/ProductDetail/Subview/InformationCell/ProductDetailInformationCell+ViewHolder.swift index f0d19d77..96d40700 100644 --- a/Pyonsnal-Color/Pyonsnal-Color/ProductDetail/Subview/InformationCell/ProductDetailInformationCell+ViewHolder.swift +++ b/Pyonsnal-Color/Pyonsnal-Color/ProductDetail/Subview/InformationCell/ProductDetailInformationCell+ViewHolder.swift @@ -69,6 +69,13 @@ extension ProductDetailInformationCell { return label }() + let productTastesTagStackView: UIStackView = { + let stackView = UIStackView() + stackView.axis = .horizontal + stackView.spacing = .spacing4 + return stackView + }() + let giftInformationView: GiftInformationView = { let giftInformationView: GiftInformationView = .init() return giftInformationView @@ -87,6 +94,7 @@ extension ProductDetailInformationCell { textContainerView.addSubview(productNameLabel) textContainerView.addSubview(productPriceLabel) textContainerView.addSubview(productDescriptionLabel) + textContainerView.addSubview(productTastesTagStackView) textContainerView.addSubview(giftInformationView) } @@ -120,8 +128,13 @@ extension ProductDetailInformationCell { make.leading.trailing.equalToSuperview() } + productTastesTagStackView.snp.makeConstraints { make in + make.top.equalTo(productDescriptionLabel.snp.bottom).offset(.spacing16) + make.leading.trailing.equalToSuperview() + } + giftInformationView.snp.makeConstraints { make in - make.top.equalTo(productDescriptionLabel.snp.bottom).offset(.spacing40) + make.top.equalTo(productTastesTagStackView.snp.bottom).offset(.spacing40) make.leading.trailing.equalToSuperview() make.bottom.equalToSuperview() } diff --git a/Pyonsnal-Color/Pyonsnal-Color/ProductDetail/Subview/InformationCell/ProductDetailInformationCell.swift b/Pyonsnal-Color/Pyonsnal-Color/ProductDetail/Subview/InformationCell/ProductDetailInformationCell.swift index 6da7c7ac..f8e14f99 100644 --- a/Pyonsnal-Color/Pyonsnal-Color/ProductDetail/Subview/InformationCell/ProductDetailInformationCell.swift +++ b/Pyonsnal-Color/Pyonsnal-Color/ProductDetail/Subview/InformationCell/ProductDetailInformationCell.swift @@ -49,6 +49,9 @@ final class ProductDetailInformationCell: UICollectionViewCell { return } + // TODO: if let has tastesTags + setTastesTag() + if let gift = payload.productDetail.gift { viewHolder.giftInformationView.isHidden = false viewHolder.productDescriptionLabel.snp.remakeConstraints { make in @@ -84,4 +87,15 @@ final class ProductDetailInformationCell: UICollectionViewCell { viewHolder.productPriceLabel.text = productDetail.price viewHolder.productDescriptionLabel.text = productDetail.description } + + private func setTastesTag() { + viewHolder.productTastesTagStackView.arrangedSubviews.forEach { $0.removeFromSuperview() } + + let tagList = ["카페인러버", "헬창", "캐릭터컬렉터", "카페인러버", "헬창", "캐릭터컬렉터"] + tagList.map { "# \($0)" } + .forEach { tagText in + let tastesTagView = ProductTastesTagView(text: tagText) + viewHolder.productTastesTagStackView.addArrangedSubview(tastesTagView) + } + } } diff --git a/Pyonsnal-Color/Pyonsnal-Color/ProfileHome/ProfileHomeInteractor.swift b/Pyonsnal-Color/Pyonsnal-Color/ProfileHome/ProfileHomeInteractor.swift index c9675fe4..ab277e20 100644 --- a/Pyonsnal-Color/Pyonsnal-Color/ProfileHome/ProfileHomeInteractor.swift +++ b/Pyonsnal-Color/Pyonsnal-Color/ProfileHome/ProfileHomeInteractor.swift @@ -38,7 +38,7 @@ protocol ProfileHomeListener: AnyObject { final class ProfileHomeInteractor: PresentableInteractor, ProfileHomeInteractable, ProfileHomePresentableListener { - + weak var router: ProfileHomeRouting? weak var listener: ProfileHomeListener? private var cancellable = Set()