Skip to content

Commit

Permalink
[Fix] QA 리스트 반영 (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
elesahich authored Jan 11, 2024
1 parent d0f92b1 commit cd7d0b4
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Domain
final public class PokeBottomSheetMessageView: UIView {
private enum Metrics {
static let containerLeadingTrailing = 20.f
static let containerHeight = 40.f
static let maximumContainerHeight = 50.f

static let contentLeadingTrailing = 8.f
static let contentTopBottom = 12.f
Expand Down Expand Up @@ -49,7 +49,6 @@ final public class PokeBottomSheetMessageView: UIView {
private let contentView = UIView()
private let leftTitleLabel = UILabel().then {
$0.textColor = DSKitAsset.Colors.gray10.color
$0.font = DSKitFontFamily.Suit.medium.font(size: 16)
$0.textAlignment = .left
$0.numberOfLines = 1
}
Expand Down Expand Up @@ -85,7 +84,7 @@ extension PokeBottomSheetMessageView {
self.containerStackView.snp.makeConstraints {
$0.top.bottom.equalToSuperview()
$0.leading.trailing.equalToSuperview().inset(Metrics.containerLeadingTrailing)
$0.height.equalTo(Metrics.containerHeight)
$0.height.lessThanOrEqualTo(Metrics.maximumContainerHeight)
}
self.contentView.snp.makeConstraints {
$0.leading.trailing.equalToSuperview().inset(Metrics.contentLeadingTrailing)
Expand All @@ -99,7 +98,7 @@ extension PokeBottomSheetMessageView {
extension PokeBottomSheetMessageView {
public func configure(with messageModel: PokeMessageModel) {
self.messageModel = messageModel
self.leftTitleLabel.text = messageModel.content
self.leftTitleLabel.attributedText = messageModel.content.applyMDSFont()
}

public func signalForClick() ->Driver<PokeMessageModel> {
Expand Down Expand Up @@ -140,3 +139,45 @@ extension PokeBottomSheetMessageView: UIGestureRecognizerDelegate {
return true
}
}

// NOTE(@승호): MDSFont 적용하고 DSKit으로 옮기고 적용하기.
private extension String {
func applyMDSFont() -> NSMutableAttributedString {
self.applyMDSFont(
height: 22.f,
font: DSKitFontFamily.Suit.medium.font(size: 16),
color: DSKitAsset.Colors.gray30.color,
letterSpacing: 0.f
)
}

func applyMDSFont(
height: CGFloat,
font: UIFont,
color: UIColor,
letterSpacing: CGFloat,
alignment: NSTextAlignment = .left,
lineBreakMode: NSLineBreakMode = .byTruncatingTail
) -> NSMutableAttributedString {
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineBreakMode = lineBreakMode
paragraphStyle.minimumLineHeight = height
paragraphStyle.alignment = alignment

if lineBreakMode == .byWordWrapping {
paragraphStyle.lineBreakStrategy = .hangulWordPriority
}

let attributes: [NSAttributedString.Key: Any] = [
.foregroundColor: color,
.font: font,
.kern: letterSpacing,
.paragraphStyle: paragraphStyle,
.baselineOffset: (paragraphStyle.minimumLineHeight - font.lineHeight) / 4
]

let attrText = NSMutableAttributedString(string: self)
attrText.addAttributes(attributes, range: NSRange(location: 0, length: self.utf16.count))
return attrText
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ final public class PokeNotificationListContentView: UIView, PokeCompatible {
frame: CGRect
) {
self.isDetailView = isDetailView

super.init(frame: frame)

self.initializeViews()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public final class PokeNotificationViewController: UIViewController, PokeNotific

// MARK: TableViews
private lazy var tableView = UITableView().then {
$0.separatorStyle = .singleLine
$0.separatorStyle = .none
$0.showsVerticalScrollIndicator = false
$0.delegate = self
$0.dataSource = self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ public final class PokeNotificationContentCell: UITableViewCell {
private enum Metric {
static let contentTopBottom = 10.f
static let contentLeadingTrailing = 20.f

static let bottomSeperatorHeight = 1.f
}

private lazy var notificationListContentView = PokeNotificationListContentView(frame: self.frame)


private lazy var dividerView = UIView().then {
$0.backgroundColor = DSKitAsset.Colors.gray700.color
}

// MARK: - View LifeCycle
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
Expand All @@ -40,22 +45,26 @@ public final class PokeNotificationContentCell: UITableViewCell {

private(set) var cancelBag = CancelBag()


public override func prepareForReuse() {
self.cancelBag = CancelBag()
}
}

extension PokeNotificationContentCell {
private func initializeViews() {
self.contentView.addSubview(self.notificationListContentView)
self.contentView.addSubviews(self.notificationListContentView, self.dividerView)
}

private func setupConstraints() {
self.notificationListContentView.snp.makeConstraints {
$0.top.bottom.equalToSuperview().inset(Metric.contentTopBottom)
$0.leading.trailing.equalToSuperview().inset(Metric.contentLeadingTrailing)
}

self.dividerView.snp.makeConstraints {
$0.height.equalTo(Metric.bottomSeperatorHeight)
$0.leading.trailing.bottom.equalToSuperview()
}
}
}

Expand Down

0 comments on commit cd7d0b4

Please sign in to comment.