Skip to content

Commit

Permalink
Merge pull request #1271 from wakmusic/1257-fix-playlist-over-flow-bug
Browse files Browse the repository at this point in the history
🔀 :: (#1257)  플레이리스트 상세 글자 넘침 버그 해결
  • Loading branch information
yongbeomkwak authored Aug 31, 2024
2 parents 3c393b5 + ced0e6b commit c47c90d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ final class MyPlaylistHeaderView: UIView {

let countLabel: WMLabel = WMLabel(
text: "",
textColor: DesignSystemAsset.BlueGrayColor.blueGray900.color.withAlphaComponent(0.6),
textColor: DesignSystemAsset.BlueGrayColor.blueGray600.color,
font: .t6_1(weight: .light),
lineHeight: UIFont.WMFontSystem.t6_1(weight: .light).lineHeight
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,46 @@ final class UnknownPlaylistHeaderView: UIView {
$0.contentMode = .scaleAspectFill
}

private let containerView: UIView = UIView().then {
private let scrollView: UIScrollView = UIScrollView().then {
$0.backgroundColor = DesignSystemAsset.BlueGrayColor.blueGray25.color.withAlphaComponent(0.4)
$0.layer.borderWidth = 1
$0.layer.cornerRadius = 8
$0.layer.borderColor = UIColor.white.cgColor
$0.clipsToBounds = true
$0.verticalScrollIndicatorInsets = .init(top: 20, left: .zero, bottom: 12, right: 6)
}

private let stackView: UIStackView = UIStackView().then {
$0.axis = .vertical
}

private let containerView: UIView = UIView()

private let titleLabel: WMLabel = WMLabel(
text: "",
textColor: DesignSystemAsset.BlueGrayColor.blueGray900.color,
font: .t3(weight: .bold),
lineHeight: UIFont.WMFontSystem.t3(weight: .bold).lineHeight
).then {
$0.numberOfLines = 0
$0.numberOfLines = .zero
}

let subtitleLabel: WMLabel = WMLabel(
let countLabel: WMLabel = WMLabel(
text: "",
textColor: DesignSystemAsset.BlueGrayColor.blueGray900.color.withAlphaComponent(0.6),
textColor: DesignSystemAsset.BlueGrayColor.blueGray600.color,
font: .t6_1(weight: .light),
lineHeight: UIFont.WMFontSystem.t6_1(weight: .light).lineHeight
)

let nickNameLabel: WMLabel = WMLabel(
text: "",
textColor: DesignSystemAsset.BlueGrayColor.blueGray600.color,
font: .t6_1(weight: .medium),
lineHeight: UIFont.WMFontSystem.t6(weight: .medium).lineHeight
).then {
$0.numberOfLines = .zero
}

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

Expand All @@ -56,8 +72,10 @@ final class UnknownPlaylistHeaderView: UIView {

extension UnknownPlaylistHeaderView {
private func addView() {
self.addSubviews(thumbnailImageView, containerView)
containerView.addSubviews(titleLabel, subtitleLabel)
self.addSubviews(thumbnailImageView, scrollView)
scrollView.addSubview(stackView)
stackView.addArrangedSubview(containerView)
containerView.addSubviews(titleLabel, countLabel, nickNameLabel)
}

private func setLayout() {
Expand All @@ -67,20 +85,35 @@ extension UnknownPlaylistHeaderView {
$0.leading.equalToSuperview().inset(20)
}

containerView.snp.makeConstraints {
scrollView.snp.makeConstraints {
$0.leading.equalTo(thumbnailImageView.snp.trailing).offset(8)
$0.top.bottom.equalToSuperview()
$0.verticalEdges.equalToSuperview()
$0.trailing.equalToSuperview().inset(20)
}

stackView.snp.makeConstraints {
$0.verticalEdges.equalToSuperview()
$0.width.equalTo(scrollView.snp.width)
}

containerView.snp.makeConstraints {
$0.edges.equalToSuperview()
}

titleLabel.snp.makeConstraints {
$0.top.equalToSuperview().inset(12)
$0.horizontalEdges.equalToSuperview().inset(16)
}

subtitleLabel.snp.makeConstraints {
countLabel.snp.makeConstraints {
$0.top.equalTo(titleLabel.snp.bottom).offset(8)
$0.leading.equalTo(titleLabel.snp.leading)
$0.horizontalEdges.equalTo(titleLabel)
}

nickNameLabel.snp.makeConstraints {
$0.top.lessThanOrEqualTo(countLabel.snp.bottom).offset(2)
$0.horizontalEdges.equalTo(titleLabel)
$0.bottom.greaterThanOrEqualToSuperview().inset(12)
}
}
}
Expand All @@ -89,16 +122,7 @@ extension UnknownPlaylistHeaderView: UnknownPlaylistHeaderStateProtocol {
func updateData(_ model: PlaylistDetailHeaderModel) {
titleLabel.text = model.title
thumbnailImageView.kf.setImage(with: URL(string: model.image))

let attributedString = NSMutableAttributedString(string: "\(model.songCount)")

let padding = NSTextAttachment()
let imageAttachment = NSTextAttachment()
imageAttachment.image = DesignSystemAsset.Playlist.smallGrayDot.image
imageAttachment.bounds = CGRect(x: 0, y: 0, width: 12, height: 12)
attributedString.append(NSAttributedString(attachment: imageAttachment))
attributedString.append(NSAttributedString(string: model.userName))

subtitleLabel.attributedText = attributedString
countLabel.text = "\(model.songCount)"
nickNameLabel.text = model.userName
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ final class WakmusicPlaylistHeaderView: UIView {

let subtitleLabel: WMLabel = WMLabel(
text: "",
textColor: DesignSystemAsset.BlueGrayColor.blueGray900.color.withAlphaComponent(0.6),
textColor: DesignSystemAsset.BlueGrayColor.blueGray600.color,
font: .t6_1(weight: .light),
lineHeight: UIFont.WMFontSystem.t6_1(weight: .light).lineHeight
)
Expand Down

0 comments on commit c47c90d

Please sign in to comment.