Skip to content

Commit

Permalink
[Fix] #275 - review cell UI 로직 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
jeongdung-eo committed Jul 22, 2024
1 parent 9060306 commit 044305b
Showing 1 changed file with 41 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import UIKit

import Kingfisher
import SnapKit
import Then

final class HomeReviewCollectionViewCell: UICollectionViewCell {

Expand All @@ -20,21 +19,52 @@ final class HomeReviewCollectionViewCell: UICollectionViewCell {

// MARK: - UI Property

private lazy var bakeryImage = GradientImageView(colors: [UIColor.clear.cgColor, UIColor.black.withAlphaComponent(0.5).cgColor])
private let reviewTitle = UILabel()
private let bakeryTitle = UILabel()
private lazy var bakeryImage: GradientImageView = {
let view = GradientImageView(colors: [UIColor.clear.cgColor, UIColor.black.withAlphaComponent(0.5).cgColor])
view.contentMode = .scaleAspectFill
view.clipsToBounds = true
return view
}()

private let reviewTitle: UILabel = {
let label = UILabel()
label.font = .bodyB2
label.textColor = .gbbWhite
label.textAlignment = .left
label.numberOfLines = 2
return label
}()

private let bakeryTitle: UILabel = {
let label = UILabel()
label.font = .bodyB1
label.textColor = .gbbGray700
label.textAlignment = .left
label.numberOfLines = 1
return label
}()

private lazy var collectionView: UICollectionView = {
let collectionView = UICollectionView(frame: .zero, collectionViewLayout: OptionsCollectionViewFlowLayout())
collectionView.register(DescriptionCollectionViewCell.self,
forCellWithReuseIdentifier: DescriptionCollectionViewCell.identifier)
collectionView.isScrollEnabled = false
collectionView.backgroundColor = .clear
collectionView.delegate = self
collectionView.dataSource = self
return collectionView
}()

private let reviewCount = IconWithTextView(.reviews)
private let bookmarkCount = IconWithTextView(.bookmark)
private lazy var collectionView = UICollectionView(frame: .zero, collectionViewLayout: OptionsCollectionViewFlowLayout())

// MARK: - Life Cycle
// MARK: - init

override init(frame: CGRect) {
super.init(frame: .zero)

setLayout()
setUI()
setRegister()
}

required init?(coder: NSCoder) {
Expand Down Expand Up @@ -87,38 +117,10 @@ final class HomeReviewCollectionViewCell: UICollectionViewCell {

private func setUI() {

self.do {
$0.layer.applyShadow(alpha: 0.1, x: 0, y: 0, blur: 10)
$0.contentView.backgroundColor = .white
$0.contentView.makeCornerRound(radius: 5)
$0.contentView.clipsToBounds = true
}

bakeryImage.do {
$0.contentMode = .scaleAspectFill
$0.clipsToBounds = true
}

reviewTitle.do {
$0.basic(font: .bodyB2!, color: .white)
$0.textAlignment = .left
$0.numberOfLines = 2
}

collectionView.do {
$0.isScrollEnabled = false
$0.backgroundColor = .clear
$0.delegate = self
$0.dataSource = self
}

bakeryTitle.do {
$0.numberOfLines = 1
$0.basic(font: .bodyB1!, color: .gbbGray700!)
$0.textAlignment = .left

}

self.layer.applyShadow(alpha: 0.1, x: 0, y: 0, blur: 10)
self.contentView.backgroundColor = .white
self.contentView.makeCornerRound(radius: 5)
self.contentView.clipsToBounds = true
}

func configureCellUI(data: BestReview) {
Expand All @@ -139,15 +141,6 @@ final class HomeReviewCollectionViewCell: UICollectionViewCell {
}
}

// MARK: - CollectionView Register

extension HomeReviewCollectionViewCell {
private func setRegister() {

collectionView.register(cell: DescriptionCollectionViewCell.self)
}
}

// MARK: - UICollectionViewDataSource

extension HomeReviewCollectionViewCell: UICollectionViewDataSource {
Expand Down

0 comments on commit 044305b

Please sign in to comment.