Skip to content

Commit

Permalink
[Feat] Keyneez#46 - 저장, 상세, 검색 뷰 이미지 연결
Browse files Browse the repository at this point in the history
  • Loading branch information
kpk0616 committed Jan 13, 2023
1 parent 2ba39ab commit 8af7bb7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ extension ContentDetailViewController {
benefitLabel.setLineSpacing(spacing: 8)
usageLabel.setLineSpacing(spacing: 8)
setLikeButton(isLiked: model.liked)
guard let url = model.contentImg else { return }
contentImageView.setImage(url: url)
}
}

Expand Down
26 changes: 21 additions & 5 deletions Keyneez/Keyneez/Tab/Home/Views/HomeSearchCollectionViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ final class HomeSearchCollectionViewCell: UICollectionViewCell {
let repository: ContentRepository = KeyneezContentRepository()
var searchContentId: Int = -1

private let backgroundImageView: UIImageView = .init()
private let backgroundImageView: UIImageView = .init().then {
$0.layer.cornerRadius = 4
}
private let opacityView: UIView = .init().then {
$0.backgroundColor = .gray900
$0.layer.opacity = 0.2
$0.layer.cornerRadius = 4
}
private let dateLabel: UILabel = .init().then {
$0.font = .font(.pretendardSemiBold, ofSize: 14)
$0.textColor = .gray050
Expand Down Expand Up @@ -44,9 +51,16 @@ final class HomeSearchCollectionViewCell: UICollectionViewCell {

extension HomeSearchCollectionViewCell {
private func setLayout() {
contentView.backgroundColor = .gray900
contentView.addSubviews(backgroundImageView)
contentView.layer.cornerRadius = 4
contentView.addSubviews(dateLabel, titleLabel, likeButton)
backgroundImageView.layer.cornerRadius = 4
backgroundImageView.snp.makeConstraints {
$0.top.leading.trailing.bottom.equalToSuperview()
}
backgroundImageView.addSubviews(opacityView, dateLabel, titleLabel, likeButton)
opacityView.snp.makeConstraints {
$0.top.leading.trailing.bottom.equalToSuperview()
}
dateLabel.snp.makeConstraints {
$0.top.equalToSuperview().inset(19)
$0.centerX.equalToSuperview()
Expand All @@ -65,14 +79,16 @@ extension HomeSearchCollectionViewCell {
dateLabel.text = setDateLabel(startAt: model.startAt, endAt: model.endAt)
searchContentId = model.contentKey
likeButton.isSelected = model.liked
guard let url = URL(string: model.contentImg ?? "") else { return }
guard let url = model.contentImg else { return }
backgroundImageView.setImage(url: url)
// TODO: 이미지, 버튼 값 변경
}
func bindLikedContentData(model: MyLikedContentResponseDto) {
titleLabel.text = model.contentTitle
dateLabel.text = setDateLabel(startAt: model.startAt, endAt: model.endAt)
likeButton.isHidden = true
guard let url = URL(string: model.contentImg ?? "") else { return }
guard let url = model.contentImg else { return }
backgroundImageView.setImage(url: url)
// TODO: 이미지, 버튼 값 변경
}
@objc
Expand Down

0 comments on commit 8af7bb7

Please sign in to comment.