Skip to content

Commit

Permalink
fix/#388 약속 정보 뷰 약속 참여 인원 텍스트 색 변경 안되는 오류 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
youz2me committed Sep 16, 2024
1 parent b00d445 commit 1d3a774
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 14 deletions.
15 changes: 12 additions & 3 deletions KkuMulKum/Source/Promise/PromiseInfo/View/PromiseInfoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ class PromiseInfoView: BaseView {
$0.backgroundColor = .white
}

let participantLabel: UILabel = UILabel().then {
$0.setText("약속 참여 인원", style: .body05, color: .maincolor)
}

let participantNumberLabel: UILabel = UILabel().then {
$0.setText("약속 참여 인원 n명", style: .body05, color: .maincolor)
$0.setHighlightText("n명", style: .body05, color: .gray3)
$0.setText("n명", style: .body05, color: .gray3)
}

let participantCollectionView: UICollectionView = UICollectionView(
Expand Down Expand Up @@ -117,6 +120,7 @@ class PromiseInfoView: BaseView {
)

backgroundView.addSubviews(
participantLabel,
participantNumberLabel,
participantCollectionView,
locationInfoLabel,
Expand Down Expand Up @@ -165,11 +169,16 @@ class PromiseInfoView: BaseView {
$0.bottom.equalToSuperview()
}

participantNumberLabel.snp.makeConstraints {
participantLabel.snp.makeConstraints {
$0.top.equalToSuperview().offset(18)
$0.leading.equalToSuperview().offset(20)
}

participantNumberLabel.snp.makeConstraints {
$0.centerY.equalTo(participantLabel)
$0.leading.equalTo(participantLabel.snp.trailing).offset(4)
}

participantCollectionView.snp.makeConstraints {
$0.top.equalTo(participantNumberLabel.snp.bottom).offset(8.5)
$0.horizontalEdges.equalToSuperview()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ extension PromiseInfoViewController {
owner.rootView.timeContentLabel.setText(info.time, style: .body04)
}

viewModel.participantList.bindOnMain(with: self) { owner, list in
owner.rootView.participantNumberLabel.setText("\(list.count)", style: .body05, color: .gray3)
owner.rootView.participantCollectionView.reloadData()
}

viewModel.dDay.bindOnMain(with: self) { owner, dDay in
guard let dDay else { return }

Expand All @@ -94,22 +99,21 @@ extension PromiseInfoViewController {
case 0:
owner.rootView.dDayLabel.setText("D-DAY", style: .body05, color: .mainorange)
case ..<0:
owner.rootView.dDayLabel.setText("D+\(-dDay)", style: .body05, color: .gray4)
owner.rootView.promiseImageView.image = .imgPromiseGray
owner.rootView.promiseNameLabel.textColor = .gray4
owner.rootView.locationInfoLabel.textColor = .gray4
owner.rootView.timeInfoLabel.textColor = .gray4
owner.rootView.readyLevelInfoLabel.textColor = .gray4
owner.rootView.penaltyLevelInfoLabel.textColor = .gray4
owner.rootView.do {
$0.dDayLabel.setText("D+\(-dDay)", style: .body05, color: .gray4)
$0.promiseImageView.image = .imgPromiseGray
$0.participantLabel.textColor = .gray4
$0.promiseNameLabel.textColor = .gray4
$0.locationInfoLabel.textColor = .gray4
$0.timeInfoLabel.textColor = .gray4
$0.readyLevelInfoLabel.textColor = .gray4
$0.penaltyLevelInfoLabel.textColor = .gray4
}
default:
break
}
}

viewModel.participantList.bindOnMain(with: self) { owner, _ in
owner.rootView.participantCollectionView.reloadData()
}

viewModel.isPastDue.bindOnMain(with: self) { owner, _ in
owner.rootView.editButton.isHidden = owner.viewModel.isEditButtonHidden()
}
Expand Down

0 comments on commit 1d3a774

Please sign in to comment.