diff --git a/Pyonsnal-Color/Pyonsnal-Color/Entity/Filter/FilterType.swift b/Pyonsnal-Color/Pyonsnal-Color/Entity/Filter/FilterType.swift index ed955b2a..c15ecdb2 100644 --- a/Pyonsnal-Color/Pyonsnal-Color/Entity/Filter/FilterType.swift +++ b/Pyonsnal-Color/Pyonsnal-Color/Entity/Filter/FilterType.swift @@ -12,6 +12,7 @@ enum FilterType: Decodable { case recommend // 상품 추천 case category // 카테고리 case event // 행사 + case productTastes // 상품 취향 case unknown init(from decoder: Decoder) throws { @@ -22,6 +23,7 @@ enum FilterType: Decodable { case "recommend": self = .recommend case "category": self = .category case "event": self = .event + case "productTastes": self = .productTastes default: self = .unknown } } @@ -36,6 +38,8 @@ enum FilterType: Decodable { return "카테고리" case .event: return "행사" + case .productTastes: + return "상품 취향" case .unknown: return "" } diff --git a/Pyonsnal-Color/Pyonsnal-Color/ProductDetail/Subview/UserTasteTagView/UserTasteTagView.swift b/Pyonsnal-Color/Pyonsnal-Color/ProductDetail/Subview/UserTasteTagView/UserTasteTagView.swift new file mode 100644 index 00000000..233b6c3c --- /dev/null +++ b/Pyonsnal-Color/Pyonsnal-Color/ProductDetail/Subview/UserTasteTagView/UserTasteTagView.swift @@ -0,0 +1,68 @@ +// +// UserTasteTagView.swift +// Pyonsnal-Color +// +// Created by 김인호 on 5/27/24. +// + +import UIKit +import SnapKit + +final class UserTasteTagView: UIView { + + // MARK: Declaration + struct Payload { + // TODO: 추가 예정 + } + + // MARK: UI Component + private let contentView: UIView = { + let view = UIView() + view.backgroundColor = .red100 + view.makeRounded(with: 1) + return view + }() + + private let userTasteTagLabel: UILabel = { + let label = UILabel() + label.textColor = .red500 + label.font = .body3r + return label + }() + + // MARK: Interface + var payload: Payload? { + didSet { updateView() } + } + + // MARK: Initializer + init() { + super.init(frame: .zero) + + configureView() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + // MARK: Private Methods + private func configureView() { + addSubview(contentView) + + contentView.addSubview(userTasteTagLabel) + + contentView.snp.makeConstraints { + $0.edges.equalToSuperview() + } + userTasteTagLabel.snp.makeConstraints { + $0.leading.equalToSuperview().offset(.spacing8) + $0.trailing.equalToSuperview().inset(.spacing8) + $0.height.equalTo(userTasteTagLabel.font.customLineHeight) + $0.centerY.equalToSuperview() + } + } + + private func updateView() { + } +} diff --git a/Pyonsnal-Color/Pyonsnal-Color/ProductFilter/Cell/RecommendFilterCell.swift b/Pyonsnal-Color/Pyonsnal-Color/ProductFilter/Cell/RecommendFilterCell.swift index a4a58546..91eb3397 100644 --- a/Pyonsnal-Color/Pyonsnal-Color/ProductFilter/Cell/RecommendFilterCell.swift +++ b/Pyonsnal-Color/Pyonsnal-Color/ProductFilter/Cell/RecommendFilterCell.swift @@ -10,15 +10,6 @@ import SnapKit final class RecommendFilterCell: UICollectionViewCell { - enum Image { - static let checkMark = "checkmark" - } - - enum Size { - static let selectedBorderWidth: CGFloat = 2 - static let unselectedBorderWidth: CGFloat = 1 - } - private let viewHolder = ViewHolder() override var isSelected: Bool { diff --git a/Pyonsnal-Color/Pyonsnal-Color/ProductFilter/ProductFilterSectionLayout.swift b/Pyonsnal-Color/Pyonsnal-Color/ProductFilter/ProductFilterSectionLayout.swift index 7eff080a..5512b989 100644 --- a/Pyonsnal-Color/Pyonsnal-Color/ProductFilter/ProductFilterSectionLayout.swift +++ b/Pyonsnal-Color/Pyonsnal-Color/ProductFilter/ProductFilterSectionLayout.swift @@ -13,6 +13,7 @@ final class ProductFilterSectionLayout { static let sortCellHeight: CGFloat = 40 static let eventCellHeight: CGFloat = 40 static let categoryCellHeight: CGFloat = 108 + static let productTastesCellHeight: CGFloat = 108 } private func createSortSection() -> NSCollectionLayoutSection { @@ -100,6 +101,30 @@ final class ProductFilterSectionLayout { let section = NSCollectionLayoutSection(group: group) return section } + + private func createProductTastesSection() -> NSCollectionLayoutSection { + let itemSize = NSCollectionLayoutSize( + widthDimension: .fractionalWidth(0.33), + heightDimension: .fractionalHeight(1) + ) + let item = NSCollectionLayoutItem(layoutSize: itemSize) + + let groupSize = NSCollectionLayoutSize( + widthDimension: .fractionalWidth(1), + heightDimension: .estimated(Size.productTastesCellHeight) + ) + let group = NSCollectionLayoutGroup.horizontal( + layoutSize: groupSize, + subitem: item, + count: 3 + ) + group.interItemSpacing = .fixed(.spacing24) + + let section = NSCollectionLayoutSection(group: group) + section.interGroupSpacing = .spacing20 + + return section + } } extension ProductFilterSectionLayout { @@ -111,6 +136,9 @@ extension ProductFilterSectionLayout { return createEventSection() case .category, .recommend: return createCategorySection() + case .productTastes: + return createProductTastesSection() + // TODO: 상품 취향 필터 추가 예정 case .unknown: return nil } diff --git a/Pyonsnal-Color/Pyonsnal-Color/ProductFilter/ProductFilterViewController.swift b/Pyonsnal-Color/Pyonsnal-Color/ProductFilter/ProductFilterViewController.swift index 57fcba98..1cc888e5 100644 --- a/Pyonsnal-Color/Pyonsnal-Color/ProductFilter/ProductFilterViewController.swift +++ b/Pyonsnal-Color/Pyonsnal-Color/ProductFilter/ProductFilterViewController.swift @@ -146,7 +146,7 @@ final class ProductFilterViewController: self?.setSelectedItemToCollectionView(at: index) } return cell - case .category, .recommend: + case .category, .recommend, .productTastes: let cell: RecommendFilterCell = collectionView.dequeueReusableCell(for: index) cell.configureCell(filterItem: item)