2
2
mirror of https://github.com/mastodon/mastodon-ios synced 2025-04-11 22:58:02 +02:00

UI-Fixes (IOS-284)

This commit is contained in:
Nathan Mattes 2024-06-30 18:25:01 +02:00
parent 52ba086f94
commit d972578176
2 changed files with 11 additions and 6 deletions

View File

@ -11,14 +11,19 @@ class StatusCardAuthorControl: UIControl {
authorLabel = UILabel()
authorLabel.textAlignment = .center
authorLabel.font = UIFontMetrics(forTextStyle: .footnote).scaledFont(for: .systemFont(ofSize: 16, weight: .bold))
authorLabel.isUserInteractionEnabled = false
avatarImage = AvatarImageView()
avatarImage.translatesAutoresizingMaskIntoConstraints = false
avatarImage.configure(cornerConfiguration: AvatarImageView.CornerConfiguration(corner: .fixed(radius: 4)))
avatarImage.isUserInteractionEnabled = false
contentStackView = UIStackView(arrangedSubviews: [avatarImage, authorLabel])
contentStackView.alignment = .center
contentStackView.spacing = 6
contentStackView.translatesAutoresizingMaskIntoConstraints = false
contentStackView.layoutMargins = UIEdgeInsets(horizontal: 6, vertical: 8)
contentStackView.isUserInteractionEnabled = true
contentStackView.isUserInteractionEnabled = false
super.init(frame: frame)
@ -39,7 +44,6 @@ class StatusCardAuthorControl: UIControl {
avatarImage.widthAnchor.constraint(equalToConstant: 16),
avatarImage.widthAnchor.constraint(equalTo: avatarImage.heightAnchor),
authorLabel.heightAnchor.constraint(greaterThanOrEqualTo: avatarImage.heightAnchor)
]
NSLayoutConstraint.activate(constraints)

View File

@ -92,6 +92,8 @@ public final class StatusCardControl: UIControl {
byLabel = UILabel()
byLabel.text = "By"
byLabel.numberOfLines = 1
byLabel.textColor = .secondaryLabel
byLabel.font = UIFontMetrics(forTextStyle: .subheadline).scaledFont(for: .systemFont(ofSize: 15, weight: .regular))
authorLabel = UILabel()
authorLabel.numberOfLines = 1
@ -104,7 +106,7 @@ public final class StatusCardControl: UIControl {
authorStackView = UIStackView(arrangedSubviews: [mastodonLogoImageView, byLabel, authorLabel, authorAccountButton, UIView()])
authorStackView.alignment = .center
authorStackView.layoutMargins = .init(top: 10, left: 10, bottom: 10, right: 10)
authorStackView.layoutMargins = .init(top: 10, left: 16, bottom: 10, right: 16)
authorStackView.isLayoutMarginsRelativeArrangement = true
authorStackView.spacing = 8
authorStackView.isUserInteractionEnabled = true
@ -142,7 +144,7 @@ public final class StatusCardControl: UIControl {
labelStackView.addArrangedSubview(publisherLabel)
labelStackView.addArrangedSubview(titleLabel)
labelStackView.addArrangedSubview(descriptionLabel)
labelStackView.layoutMargins = .init(top: 10, left: 10, bottom: 10, right: 10)
labelStackView.layoutMargins = .init(top: 16, left: 16, bottom: 16, right: 16)
labelStackView.isLayoutMarginsRelativeArrangement = true
labelStackView.isUserInteractionEnabled = false
labelStackView.axis = .vertical
@ -154,6 +156,7 @@ public final class StatusCardControl: UIControl {
headerContentStackView.isUserInteractionEnabled = true
headerContentStackView.axis = .vertical
headerContentStackView.spacing = 2
headerContentStackView.setCustomSpacing(0, after: imageView)
containerStackView.addArrangedSubview(headerContentStackView)
containerStackView.addArrangedSubview(authorDivider)
@ -277,7 +280,6 @@ public final class StatusCardControl: UIControl {
super.didMoveToWindow()
if let window {
layer.borderWidth = window.screen.pixelSize
dividerConstraint?.constant = window.screen.pixelSize
authorDividerConstraint?.constant = window.screen.pixelSize
}
@ -344,7 +346,6 @@ public final class StatusCardControl: UIControl {
}
private func applyBranding() {
layer.borderColor = SystemTheme.separator.cgColor
dividerView.backgroundColor = SystemTheme.separator
imageView.backgroundColor = UIColor.tertiarySystemFill
}