|
| 1 | +// |
| 2 | +// HomeFeatureCollectionViewCell.swift |
| 3 | +// FeatureLayer |
| 4 | +// |
| 5 | +// Created by 최재혁 on 8/22/25. |
| 6 | +// |
| 7 | + |
| 8 | +import Base |
| 9 | +import DesignSystem |
| 10 | +import UIKit |
| 11 | + |
| 12 | +struct HomeFeatureCollectionViewCellModel: HomeCellModel { |
| 13 | + |
| 14 | +} |
| 15 | + |
| 16 | +final class HomeFeatureCollectionViewCell: BaseCollectionViewCell { |
| 17 | + private lazy var contentStackView = UIStackView().then { |
| 18 | + $0.axis = .vertical |
| 19 | + $0.spacing = 12 |
| 20 | + $0.alignment = .leading |
| 21 | + } |
| 22 | + |
| 23 | + private lazy var titleLabel = UILabel().then { |
| 24 | + $0.style = Typography.Body_18_B |
| 25 | + $0.styledText = "더 많은 정보" |
| 26 | + } |
| 27 | + |
| 28 | + private lazy var moreView = UIView().then { |
| 29 | + $0.backgroundColor = STColors.white.color |
| 30 | + $0.layer.cornerRadius = 10 |
| 31 | + $0.clipsToBounds = true |
| 32 | + } |
| 33 | + |
| 34 | + private lazy var pigImageView = UIImageView().then { |
| 35 | + $0.tintColor = STColors.gray5.color |
| 36 | + $0.image = STImages.imageMore.image |
| 37 | + $0.contentMode = .scaleAspectFit |
| 38 | + } |
| 39 | + |
| 40 | + private lazy var moreLabel = UILabel().then { |
| 41 | + $0.style = Typography.Body_14_R |
| 42 | + $0.textColor = STColors.gray5.color |
| 43 | + $0.styledText = "더 많은 기능을 준비 중이에요" |
| 44 | + } |
| 45 | + |
| 46 | + override init(frame: CGRect) { |
| 47 | + super.init(frame: frame) |
| 48 | + setupUI() |
| 49 | + } |
| 50 | + |
| 51 | + required init?(coder: NSCoder) { |
| 52 | + fatalError("init(coder:) has not been implemented") |
| 53 | + } |
| 54 | + |
| 55 | + func setupUI() { |
| 56 | + contentView.addSubview(contentStackView) |
| 57 | + |
| 58 | + contentStackView.addArrangedSubview(titleLabel) |
| 59 | + contentStackView.addArrangedSubview(moreView) |
| 60 | + |
| 61 | + moreView.addSubview(pigImageView) |
| 62 | + moreView.addSubview(moreLabel) |
| 63 | + |
| 64 | + contentStackView.snp.makeConstraints { make in |
| 65 | + make.top.bottom.equalToSuperview() |
| 66 | + make.leading.trailing.equalToSuperview() |
| 67 | + } |
| 68 | + |
| 69 | + titleLabel.snp.makeConstraints { make in |
| 70 | + make.leading.trailing.equalToSuperview() |
| 71 | + } |
| 72 | + |
| 73 | + moreView.snp.makeConstraints { make in |
| 74 | + make.height.equalTo(252) |
| 75 | + make.leading.trailing.equalToSuperview() |
| 76 | + } |
| 77 | + |
| 78 | + pigImageView.snp.makeConstraints { make in |
| 79 | + make.centerX.equalToSuperview() |
| 80 | + make.top.equalToSuperview().offset(59.5) |
| 81 | + make.width.height.equalTo(100) |
| 82 | + } |
| 83 | + |
| 84 | + moreLabel.snp.makeConstraints { make in |
| 85 | + make.centerX.equalToSuperview() |
| 86 | + make.top.equalTo(pigImageView.snp.bottom) |
| 87 | + } |
| 88 | + } |
| 89 | +} |
| 90 | + |
| 91 | +@available(iOS 17.0, *) |
| 92 | +#Preview { |
| 93 | + let cell = HomeFeatureCollectionViewCell() |
| 94 | + |
| 95 | + cell.snp.makeConstraints { make in |
| 96 | + make.height.equalTo(330) |
| 97 | + } |
| 98 | + |
| 99 | + return cell |
| 100 | +} |
0 commit comments