Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

๐Ÿ”€ :: ๋ชจ๋“  Feature์— WMFontSystem ์ ์šฉ #395

Merged
merged 6 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,9 @@ import CommonFeature

public final class ChartContentTableViewCell: UITableViewCell {
// MARK: - UI
private let rankingLabel = UILabel().then {
$0.textAlignment = .center
$0.textColor = DesignSystemAsset.GrayColor.gray900.color
$0.font = DesignSystemFontFamily.Pretendard.medium.font(size: 16)
}

private let rankingLabel = WMLabel(text: "0", textColor: DesignSystemAsset.GrayColor.gray900.color, font: .t5(weight: .medium), alignment: .center, lineHeight: UIFont.WMFontSystem.t5().lineHeight, kernValue: -0.5)

private let nonImageView = UIImageView().then {
$0.image = DesignSystemAsset.Chart.non.image
}
Expand All @@ -27,28 +25,21 @@ public final class ChartContentTableViewCell: UITableViewCell {
private let decreaseRateImageView = UIImageView().then {
$0.image = DesignSystemAsset.Chart.down.image
}
private let newRateLabel = UILabel().then {
$0.textColor = DesignSystemAsset.PrimaryColor.new.color
$0.text = "NEW"
$0.font = DesignSystemFontFamily.Pretendard.medium.font(size: 11)
}
private let rateLabel = UILabel().then {
$0.textAlignment = .center
$0.font = DesignSystemFontFamily.Pretendard.medium.font(size: 11)
}

private let newRateLabel = WMLabel(text: "NEW", textColor: DesignSystemAsset.PrimaryColor.new.color, font: .t8(weight: .medium), alignment: .left, lineHeight: UIFont.WMFontSystem.t8().lineHeight, kernValue: -0.5)

private let rateLabel = WMLabel(text: "0", textColor: DesignSystemAsset.PrimaryColor.new.color, font: .t8(weight: .medium), alignment: .center, lineHeight: UIFont.WMFontSystem.t8().lineHeight, kernValue: -0.5)

private let albumImageView = UIImageView().then {
$0.clipsToBounds = true
$0.layer.cornerRadius = 4
$0.contentMode = .scaleAspectFill
}
private let titleStringLabel = UILabel().then {
$0.textColor = DesignSystemAsset.GrayColor.gray900.color
$0.font = DesignSystemFontFamily.Pretendard.medium.font(size: 14)
}
private let groupStringLabel = UILabel().then {
$0.textColor = DesignSystemAsset.GrayColor.gray900.color
$0.font = DesignSystemFontFamily.Pretendard.light.font(size: 12)
}

private let titleStringLabel = WMLabel(text: "์ œ๋ชฉ", textColor: DesignSystemAsset.GrayColor.gray900.color, font: .t6(weight: .medium), alignment: .left, lineHeight: UIFont.WMFontSystem.t6().lineHeight, kernValue: -0.5)

private let groupStringLabel = WMLabel(text: "์•„ํ‹ฐ์ŠคํŠธ", textColor: DesignSystemAsset.GrayColor.gray900.color, font: .t7(weight: .light), alignment: .left, lineHeight: UIFont.WMFontSystem.t7().lineHeight, kernValue: -0.5)

private let hitsLabel = UILabel().then {
$0.textAlignment = .right
$0.textColor = DesignSystemAsset.GrayColor.gray900.color
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ public final class PlayButtonForChartView: UIView {
range: NSRange(location: 0, length: attributedString.string.count))
$0.setAttributedTitle(attributedString, for: .normal)
}
private let updateTimeLabel = UILabel().then {
$0.font = DesignSystemFontFamily.Pretendard.light.font(size: 12)
$0.textColor = DesignSystemAsset.GrayColor.gray600.color
}

private let updateTimeLabel = WMLabel(text: "์—…๋ฐ์ดํŠธ", textColor: DesignSystemAsset.GrayColor.gray600.color, font: .t7(weight: .light), alignment: .left, lineHeight: UIFont.WMFontSystem.t7().lineHeight, kernValue: -0.5)

private let updateTimeImageView = UIImageView().then {
$0.image = DesignSystemAsset.Chart.check.image
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ import SnapKit
import Then

public final class ChartUpdateTimeView: UIView {
private let updateTimeLabel = UILabel().then {
$0.font = DesignSystemFontFamily.Pretendard.light.font(size: 12)
$0.textColor = DesignSystemAsset.GrayColor.gray600.color
}
private let updateTimeLabel = WMLabel(text: "์—…๋ฐ์ดํŠธ", textColor: DesignSystemAsset.GrayColor.gray600.color, font: .t7(weight: .light), alignment: .left, lineHeight: UIFont.WMFontSystem.t7().lineHeight, kernValue: -0.5)

private let updateTimeImageView = UIImageView().then {
$0.image = DesignSystemAsset.Chart.check.image
}
Expand All @@ -33,12 +31,7 @@ public final class ChartUpdateTimeView: UIView {
}

public func setUpdateTime(updateTime: String) {
let attributedString = NSMutableAttributedString(string: updateTime)
attributedString.addAttributes([.font: DesignSystemFontFamily.Pretendard.light.font(size: 12),
.foregroundColor: DesignSystemAsset.GrayColor.gray600.color,
.kern: -0.5],
range: NSRange(location: 0, length: attributedString.string.count))
updateTimeLabel.attributedText = attributedString
updateTimeLabel.text = updateTime
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,10 @@ final class MiniPlayerView: UIView {
$0.axis = .vertical
$0.distribution = .fill
}

internal lazy var titleLabel = MarqueeLabel().then {
$0.font = .init(font: DesignSystemFontFamily.Pretendard.medium, size: 14)
$0.textColor = DesignSystemAsset.GrayColor.gray900.color
$0.text = "์ œ๋ชฉ"
$0.setTextWithAttributes(lineHeight: 24, kernValue: -0.5)
$0.leadingBuffer = 0
$0.trailingBuffer = 35
$0.fadeLength = 3
$0.animationDelay = 1
$0.speed = .rate(30)
}

internal lazy var artistLabel = MarqueeLabel().then {
$0.font = .init(font: DesignSystemFontFamily.Pretendard.light, size: 12)
$0.textColor = DesignSystemAsset.GrayColor.gray900.color
$0.text = "์•„ํ‹ฐ์ŠคํŠธ"
$0.setTextWithAttributes(lineHeight: 18, kernValue: -0.5)
$0.leadingBuffer = 0
$0.trailingBuffer = 20
$0.fadeLength = 3
$0.animationDelay = 1
$0.speed = .rate(30)
}

lazy var titleLabel = WMFlowLabel(text: "์ œ๋ชฉ", textColor: DesignSystemAsset.GrayColor.gray900.color, font: .t6(weight: .medium), alignment: .left, lineHeight: UIFont.WMFontSystem.t6().lineHeight, kernValue: -0.5, leadingBuffer: 0, trailingBuffer: 35, animationDelay: 1, animationSpeed: 30, fadeLength: 3)

lazy var artistLabel = WMFlowLabel(text: "์•„ํ‹ฐ์ŠคํŠธ", textColor: DesignSystemAsset.GrayColor.gray900.color, font: .t7(weight: .light), alignment: .left, lineHeight: UIFont.WMFontSystem.t6().lineHeight, kernValue: -0.5, leadingBuffer: 0, trailingBuffer: 20, animationDelay: 1, animationSpeed: 30, fadeLength: 3)

internal lazy var playButton = UIButton().then {
$0.setImage(DesignSystemAsset.Player.miniPlay.image, for: .normal)
Expand Down
31 changes: 4 additions & 27 deletions Projects/Features/PlayerFeature/Sources/Views/PlayerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import Utility
import DesignSystem
import SnapKit
import Then
import MarqueeLabel

public final class PlayerView: UIView {
private lazy var backgroundView = UIView().then {
Expand Down Expand Up @@ -44,21 +43,9 @@ public final class PlayerView: UIView {
$0.distribution = .fill
}

internal lazy var titleLabel = WMFlowLabel(text: "์ œ๋ชฉ", textColor: DesignSystemAsset.GrayColor.gray900.color, font: .t5(weight: .medium), alignment: .center, lineHeight: UIFont.WMFontSystem.t5().lineHeight, kernValue: -0.5, leadingBuffer: 0, trailingBuffer: 35)
lazy var titleLabel = WMFlowLabel(text: "์ œ๋ชฉ", textColor: DesignSystemAsset.GrayColor.gray900.color, font: .t5(weight: .medium), alignment: .center, lineHeight: UIFont.WMFontSystem.t5().lineHeight, kernValue: -0.5, leadingBuffer: 0, trailingBuffer: 35)

internal lazy var artistLabel = MarqueeLabel().then {
$0.font = .init(font: DesignSystemFontFamily.Pretendard.medium, size: 14)
$0.textColor = DesignSystemAsset.GrayColor.gray900.color
$0.alpha = 0.6
$0.text = "์•„ํ‹ฐ์ŠคํŠธ"
$0.setTextWithAttributes(lineHeight: 20, kernValue: -0.5)
$0.textAlignment = .center
$0.leadingBuffer = 0
$0.trailingBuffer = 20
$0.fadeLength = 3
$0.animationDelay = 1
$0.speed = .rate(30)
}
lazy var artistLabel = WMFlowLabel(text: "์•„ํ‹ฐ์ŠคํŠธ", textColor: DesignSystemAsset.GrayColor.gray900.color, font: .t6_1(weight: .medium), alignment: .center, lineHeight: UIFont.WMFontSystem.t6_1().lineHeight, kernValue: -0.5, leadingBuffer: 0, trailingBuffer: 20)

internal lazy var thumbnailImageView = UIImageView().then {
$0.image = DesignSystemAsset.Player.dummyThumbnailLarge.image
Expand Down Expand Up @@ -91,19 +78,9 @@ public final class PlayerView: UIView {

private lazy var playTimeView: UIView = UIView()

internal lazy var currentPlayTimeLabel = UILabel().then {
$0.font = .init(font: DesignSystemFontFamily.Pretendard.medium, size: 12)
$0.textColor = DesignSystemAsset.PrimaryColor.point.color
$0.text = "-:--"
$0.setTextWithAttributes(lineHeight: 18, kernValue: -0.5, lineHeightMultiple: 1.26)
}
lazy var currentPlayTimeLabel = WMLabel(text: "-:--", textColor: DesignSystemAsset.PrimaryColor.point.color, font: .t7(weight: .medium), alignment: .left, lineHeight: UIFont.WMFontSystem.t7().lineHeight, kernValue: -0.5)

internal lazy var totalPlayTimeLabel = UILabel().then {
$0.font = .init(font: DesignSystemFontFamily.Pretendard.medium, size: 12)
$0.textColor = DesignSystemAsset.GrayColor.gray400.color
$0.text = "-:--"
$0.setTextWithAttributes(lineHeight: 18, kernValue: -0.5, lineHeightMultiple: 1.26)
}
lazy var totalPlayTimeLabel = WMLabel(text: "-:--", textColor: DesignSystemAsset.GrayColor.gray400.color, font: .t7(weight: .medium), alignment: .left, lineHeight: UIFont.WMFontSystem.t7().lineHeight, kernValue: -0.5)

private lazy var buttonBarView: UIView = UIView()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,11 @@ internal class PlaylistTableViewCell: UITableViewCell {
$0.distribution = .fill
}

internal lazy var titleLabel = UILabel().then {
$0.font = .init(font: DesignSystemFontFamily.Pretendard.medium, size: 14)
$0.textColor = DesignSystemAsset.GrayColor.gray900.color
$0.text = "๊ณก ์ œ๋ชฉ"
$0.setTextWithAttributes(lineHeight: 24, kernValue: -0.5)

$0.textAlignment = .left
lazy var titleLabel = WMLabel(text: "๊ณก ์ œ๋ชฉ", textColor: DesignSystemAsset.GrayColor.gray900.color, font: .t6(weight: .medium), alignment: .left, lineHeight: UIFont.WMFontSystem.t6().lineHeight, kernValue: -0.5).then {
$0.lineBreakMode = .byTruncatingTail
}

internal lazy var artistLabel = UILabel().then {
$0.font = .init(font: DesignSystemFontFamily.Pretendard.light, size: 12)
$0.textColor = DesignSystemAsset.GrayColor.gray900.color
$0.text = "์•„ํ‹ฐ์ŠคํŠธ๋ช…"
$0.setTextWithAttributes(lineHeight: 18, kernValue: -0.5)
$0.textAlignment = .left
lazy var artistLabel = WMLabel(text: "์•„ํ‹ฐ์ŠคํŠธ๋ช…", textColor: DesignSystemAsset.GrayColor.gray900.color, font: .t7(weight: .light), alignment: .left, lineHeight: UIFont.WMFontSystem.t7().lineHeight, kernValue: -0.5).then {
$0.lineBreakMode = .byTruncatingTail
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,9 @@ public final class PlaylistView: UIView {
$0.spacing = 4
}

// internal lazy var titleLabel = UILabel().then {
// $0.font = .init(font: DesignSystemFontFamily.Pretendard.medium, size: 16)
// $0.textColor = DesignSystemAsset.GrayColor.gray900.color
// $0.text = "์žฌ์ƒ๋ชฉ๋ก"
// $0.setTextWithAttributes(lineHeight: 24, kernValue: -0.5)
// $0.textAlignment = .center
// }
lazy var titleLabel = WMLabel(text: "์žฌ์ƒ๋ชฉ๋ก", textColor: DesignSystemAsset.GrayColor.gray900.color, font: .t5(weight: .medium), alignment: .center, lineHeight: UIFont.WMFontSystem.t5().lineHeight, kernValue: -0.5)

lazy var titleLabel = WMLabel(text: "์žฌ์ƒ๋ชฉ๋ก", textColor: DesignSystemAsset.GrayColor.gray900.color, font: .t5(weight: .medium), alignment: .center, lineHeight: 24, kernValue: -0.5)

internal lazy var countLabel = UILabel().then {
$0.font = .init(font: DesignSystemFontFamily.Pretendard.bold, size: 18)
$0.textColor = DesignSystemAsset.PrimaryColor.point.color
$0.text = "0"
$0.setTextWithAttributes(lineHeight: 28, kernValue: -0.5)
$0.textAlignment = .center
}
lazy var countLabel = WMLabel(text: "์žฌ์ƒ๋ชฉ๋ก", textColor: DesignSystemAsset.GrayColor.gray900.color, font: .t4(weight: .bold), alignment: .center, lineHeight: UIFont.WMFontSystem.t4().lineHeight, kernValue: -0.5)

internal lazy var editButton = RectangleButton(type: .custom).then {
$0.setBackgroundColor(.clear, for: .normal)
Expand Down
16 changes: 16 additions & 0 deletions Projects/UsertInterfaces/DesignSystem/Sources/WMFlowLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,22 @@ public final class WMFlowLabel: MarqueeLabel {
self.animationDelay = animationDelay
}

convenience init(
text: String,
textColor: UIColor = .init(),
font: UIFont.WMFontSystem,
alignment: NSTextAlignment = .left,
lineHeight: CGFloat? = nil,
kernValue: Double? = nil,
leadingBuffer: CGFloat = 0,
trailingBuffer: CGFloat = 0,
animationDelay: CGFloat = 1,
animationSpeed: CGFloat = 30,
fadeLength: CGFloat = 3
) {
self.init(text: text, textColor: textColor, font: font, alignment: alignment, lineHeight: lineHeight, kernValue: kernValue, lineSpacing: nil, lineHeightMultiple: nil, leadingBuffer: leadingBuffer, trailingBuffer: trailingBuffer, animationDelay: animationDelay, animationSpeed: animationSpeed, fadeLength: fadeLength)
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public extension UIFont {
case t4(weight: WMFontWeight = .medium)
/// size: 16 height: 24
case t5(weight: WMFontWeight = .medium)
/// size: 14 height: 14
/// size: 14 height: 24
case t6(weight: WMFontWeight = .medium)
/// size: 14 height: 20
case t6_1(weight: WMFontWeight = .medium)
Expand Down
Loading