Skip to content
4 changes: 4 additions & 0 deletions Pyonsnal-Color/Pyonsnal-Color/Entity/Filter/FilterType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ enum FilterType: Decodable {
case recommend // 상품 추천
case category // 카테고리
case event // 행사
case productTastes // 상품 취향
case unknown

init(from decoder: Decoder) throws {
Expand All @@ -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
}
}
Expand All @@ -36,6 +38,8 @@ enum FilterType: Decodable {
return "카테고리"
case .event:
return "행사"
case .productTastes:
return "상품 취향"
case .unknown:
return ""
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
//
// UserTasteTagView.swift
// Pyonsnal-Color
//
// Created by 김인호 on 5/27/24.
//

import UIKit
import SnapKit

final class UserTasteTagView: UIView {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

소정님이 구현해주신 ProductTastesTagView랑 겹쳐서 파일이랑 경로 삭제해서 커밋했는데,, 왜 같이 올라갔는지 모르겠네요...
일단 경로는 달라서 추후에 디벨롭 브렌치에서 삭제해도 될것같습니다..!


// 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() {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand All @@ -111,6 +136,9 @@ extension ProductFilterSectionLayout {
return createEventSection()
case .category, .recommend:
return createCategorySection()
case .productTastes:
return createProductTastesSection()
// TODO: 상품 취향 필터 추가 예정
case .unknown:
return nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down