Make timeline load more button more prominent
This commit is contained in:
parent
e042754be1
commit
b6f32ca6be
|
@ -14,12 +14,13 @@ class TimelineGapCollectionViewCell: UICollectionViewCell {
|
||||||
|
|
||||||
private let indicator = UIActivityIndicatorView(style: .medium)
|
private let indicator = UIActivityIndicatorView(style: .medium)
|
||||||
private let chevronView = AnimatingChevronView()
|
private let chevronView = AnimatingChevronView()
|
||||||
|
private let fillView = UIView()
|
||||||
|
|
||||||
var fillGap: ((TimelineGapDirection) async -> Void)?
|
var fillGap: ((TimelineGapDirection) async -> Void)?
|
||||||
|
|
||||||
override var isHighlighted: Bool {
|
override var isHighlighted: Bool {
|
||||||
didSet {
|
didSet {
|
||||||
backgroundColor = isHighlighted ? .appFill : .appGroupedBackground
|
backgroundColor = isHighlighted ? .appFill : .appSecondaryBackground
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,17 +39,22 @@ class TimelineGapCollectionViewCell: UICollectionViewCell {
|
||||||
override init(frame: CGRect) {
|
override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
|
|
||||||
backgroundColor = .appGroupedBackground
|
backgroundColor = .appSecondaryBackground
|
||||||
|
|
||||||
indicator.isHidden = true
|
fillView.backgroundColor = .tintColor
|
||||||
indicator.color = .tintColor
|
fillView.alpha = 0.75
|
||||||
|
fillView.layer.masksToBounds = true
|
||||||
|
fillView.layer.cornerRadius = 8
|
||||||
|
fillView.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
contentView.addSubview(fillView)
|
||||||
|
|
||||||
let label = UILabel()
|
let label = UILabel()
|
||||||
label.text = "Load more"
|
label.text = "Load more"
|
||||||
label.font = .preferredFont(forTextStyle: .headline)
|
label.font = .preferredFont(forTextStyle: .headline)
|
||||||
label.adjustsFontForContentSizeCategory = true
|
label.adjustsFontForContentSizeCategory = true
|
||||||
label.textColor = .tintColor
|
label.textColor = .white
|
||||||
|
|
||||||
|
chevronView.tintColor = .white
|
||||||
chevronView.update(direction: .above)
|
chevronView.update(direction: .above)
|
||||||
|
|
||||||
let stack = UIStackView(arrangedSubviews: [
|
let stack = UIStackView(arrangedSubviews: [
|
||||||
|
@ -60,15 +66,25 @@ class TimelineGapCollectionViewCell: UICollectionViewCell {
|
||||||
stack.translatesAutoresizingMaskIntoConstraints = false
|
stack.translatesAutoresizingMaskIntoConstraints = false
|
||||||
contentView.addSubview(stack)
|
contentView.addSubview(stack)
|
||||||
|
|
||||||
|
indicator.isHidden = true
|
||||||
|
indicator.color = .tintColor
|
||||||
indicator.translatesAutoresizingMaskIntoConstraints = false
|
indicator.translatesAutoresizingMaskIntoConstraints = false
|
||||||
contentView.addSubview(indicator)
|
contentView.addSubview(indicator)
|
||||||
|
|
||||||
NSLayoutConstraint.activate([
|
NSLayoutConstraint.activate([
|
||||||
stack.centerXAnchor.constraint(equalTo: contentView.centerXAnchor),
|
stack.centerXAnchor.constraint(equalTo: contentView.centerXAnchor),
|
||||||
stack.centerYAnchor.constraint(equalTo: contentView.centerYAnchor),
|
stack.centerYAnchor.constraint(equalTo: contentView.centerYAnchor),
|
||||||
indicator.trailingAnchor.constraint(equalTo: stack.leadingAnchor, constant: -8),
|
|
||||||
|
fillView.leadingAnchor.constraint(equalTo: stack.leadingAnchor, constant: -8),
|
||||||
|
// optical centering, babey
|
||||||
|
fillView.trailingAnchor.constraint(equalTo: stack.trailingAnchor, constant: 10),
|
||||||
|
fillView.topAnchor.constraint(equalTo: stack.topAnchor, constant: -4),
|
||||||
|
fillView.bottomAnchor.constraint(equalTo: stack.bottomAnchor, constant: 4),
|
||||||
|
|
||||||
|
indicator.trailingAnchor.constraint(equalTo: stack.leadingAnchor, constant: -12),
|
||||||
indicator.centerYAnchor.constraint(equalTo: contentView.centerYAnchor),
|
indicator.centerYAnchor.constraint(equalTo: contentView.centerYAnchor),
|
||||||
contentView.heightAnchor.constraint(equalToConstant: 44),
|
|
||||||
|
contentView.heightAnchor.constraint(equalToConstant: 52),
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue