-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f5b2da2
commit 855666f
Showing
5 changed files
with
120 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
Projects/Features/CommonFeature/Sources/Views/ChartUpdateTimeView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// | ||
// PlayButtonForNewSongsView.swift | ||
// CommonFeature | ||
// | ||
// Created by KTH on 2023/11/16. | ||
// Copyright © 2023 yongbeomkwak. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import DesignSystem | ||
import RxRelay | ||
import RxSwift | ||
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 updateTimeImageView = UIImageView().then { | ||
$0.image = DesignSystemAsset.Chart.check.image | ||
} | ||
|
||
public override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
self.setupView() | ||
} | ||
|
||
required init?(coder aDecoder: NSCoder) { | ||
super.init(coder: aDecoder) | ||
self.setupView() | ||
} | ||
|
||
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 | ||
} | ||
} | ||
|
||
extension ChartUpdateTimeView { | ||
private func setupView() { | ||
self.backgroundColor = DesignSystemAsset.GrayColor.gray100.color | ||
|
||
[updateTimeImageView, updateTimeLabel].forEach { self.addSubview($0) } | ||
|
||
updateTimeImageView.snp.makeConstraints { | ||
$0.top.equalTo(1) | ||
$0.width.height.equalTo(16) | ||
$0.leading.equalTo(20) | ||
} | ||
|
||
updateTimeLabel.snp.makeConstraints { | ||
$0.top.equalTo(0) | ||
$0.height.equalTo(18) | ||
$0.leading.equalTo(updateTimeImageView.snp.trailing).offset(2) | ||
} | ||
} | ||
} |