Skip to content

Commit 17f72a1

Browse files
committed
๐Ÿงฉ :: BannerCell ์ˆ˜์ •
1 parent dc34fc8 commit 17f72a1

File tree

1 file changed

+94
-1
lines changed

1 file changed

+94
-1
lines changed

โ€ŽProjects/Presentation/Sources/Home/Components/Cell/BannerCollectionViewCell.swiftโ€Ž

Lines changed: 94 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,57 @@ final class BannerCollectionViewCell: BaseCollectionViewCell<FetchBannerEntity>
1111
$0.layer.cornerRadius = 16
1212
$0.clipsToBounds = true
1313
}
14+
private let passTitleLabel = UILabel().then {
15+
$0.numberOfLines = 0
16+
$0.setJobisText(
17+
"9๊ธฐ ๋Œ€๋งˆ๊ณ \nํ•™์ƒ๋“ค์˜ ์ทจ์—…๋ฅ ",
18+
font: .headLine,
19+
color: .GrayScale.gray90
20+
)
21+
}
22+
private let passLabel = UILabel().then {
23+
$0.setJobisText(
24+
" - ",
25+
font: .headLine,
26+
color: .Primary.blue20
27+
)
28+
}
29+
private let prePassCountTitleLabel = UILabel().then {
30+
$0.setJobisText(
31+
"ํ˜„์žฌ",
32+
font: .subHeadLine,
33+
color: .GrayScale.gray60
34+
)
35+
}
36+
private let sufPassCountTitleLabel = UILabel().then {
37+
$0.setJobisText(
38+
"๋ช…์ด ์ทจ์—…ํ–ˆ์–ด์š”",
39+
font: .subHeadLine,
40+
color: .GrayScale.gray60
41+
)
42+
}
43+
private let passCountLabel = UILabel().then {
44+
$0.setJobisText(
45+
" - ",
46+
font: .subHeadLine,
47+
color: .GrayScale.gray70
48+
)
49+
}
50+
private let fileImageView = UIImageView().then {
51+
$0.contentMode = .scaleAspectFill
52+
$0.clipsToBounds = true
53+
$0.image = UIImage.jobisIcon(.fileImage)
54+
}
1455

1556
override func addView() {
1657
[
17-
imageView
58+
imageView,
59+
passTitleLabel,
60+
passLabel,
61+
prePassCountTitleLabel,
62+
sufPassCountTitleLabel,
63+
passCountLabel,
64+
fileImageView
1865
].forEach(contentView.addSubview(_:))
1966
}
2067

@@ -24,12 +71,58 @@ final class BannerCollectionViewCell: BaseCollectionViewCell<FetchBannerEntity>
2471
}
2572
}
2673

74+
func totalPassSetLayout() {
75+
passTitleLabel.snp.makeConstraints {
76+
$0.top.leading.equalToSuperview().inset(24)
77+
}
78+
79+
passLabel.snp.makeConstraints {
80+
$0.top.equalTo(passTitleLabel.snp.bottom)
81+
$0.leading.equalToSuperview().inset(24)
82+
}
83+
84+
prePassCountTitleLabel.snp.makeConstraints {
85+
$0.bottom.leading.equalToSuperview().inset(24)
86+
}
87+
88+
passCountLabel.snp.makeConstraints {
89+
$0.top.equalTo(prePassCountTitleLabel.snp.top)
90+
$0.leading.equalTo(prePassCountTitleLabel.snp.trailing).offset(4)
91+
}
92+
93+
sufPassCountTitleLabel.snp.makeConstraints {
94+
$0.bottom.equalToSuperview().inset(24)
95+
$0.leading.equalTo(passCountLabel.snp.trailing).offset(4)
96+
}
97+
98+
fileImageView.snp.makeConstraints {
99+
$0.width.height.equalTo(180)
100+
$0.top.trailing.equalToSuperview()
101+
}
102+
}
103+
27104
override func configureView() {
28105
self.layer.cornerRadius = 12
29106
self.backgroundColor = .GrayScale.gray30
30107
}
31108

32109
override func adapt(model: FetchBannerEntity) {
110+
setLayout()
33111
self.imageView.setJobisImage(urlString: model.bannerURL)
34112
}
113+
114+
func totalPassAdapt(model: TotalPassStudentEntity) {
115+
totalPassSetLayout()
116+
passLabel.setJobisText(
117+
"\(Int(Double(model.passedCount) / Double(model.totalStudentCount) * 100.0))%",
118+
font: .headLine,
119+
color: .Primary.blue20
120+
)
121+
122+
passCountLabel.setJobisText(
123+
"\(model.passedCount)/\(model.totalStudentCount)",
124+
font: .subHeadLine,
125+
color: .GrayScale.gray70
126+
)
127+
}
35128
}

0 commit comments

Comments
ย (0)