feat: Change layout for base container card (center title)

This commit is contained in:
Andrea Busi
2025-03-06 10:17:08 +01:00
parent b12f83680a
commit 5edcaaad99
@@ -20,8 +20,12 @@ extension CGFloat {
static let cardVerticalSpacing: CGFloat = 10.0 static let cardVerticalSpacing: CGFloat = 10.0
} }
@objc
class EQNBaseContainerTableViewCell: UITableViewCell { class EQNBaseContainerTableViewCell: UITableViewCell {
/// Inset to apply to enclosing table view. Used to adjust spacing around the cells (for instance, top space is smaller that the space between the cards)
@objc static let EdgeInsets: UIEdgeInsets = .init(top: CGFloat.cardHorizontalMargin - CGFloat.cardVerticalMargin, left: 0, bottom: 0, right: 0)
// MARK: - UI // MARK: - UI
private lazy var internalContainerView: UIView = { private lazy var internalContainerView: UIView = {
@@ -46,11 +50,11 @@ class EQNBaseContainerTableViewCell: UITableViewCell {
}() }()
private lazy var headerLabel: UILabel = { private lazy var headerLabel: UILabel = {
let label = EQNEdgeInsetLabel() let label = UILabel()
label.translatesAutoresizingMaskIntoConstraints = false label.translatesAutoresizingMaskIntoConstraints = false
label.backgroundColor = AppTheme.Colors.lightBlue label.textAlignment = .center
label.font = .systemFont(ofSize: 17.0, weight: .medium) label.font = .preferredFont(forTextStyle: .title2)
label.textColor = .white label.textColor = AppTheme.shared.cardTextColor
return label return label
}() }()
@@ -136,9 +140,9 @@ class EQNBaseContainerTableViewCell: UITableViewCell {
if isHeaderVisible { if isHeaderVisible {
containerView.addSubview(headerLabel) containerView.addSubview(headerLabel)
headerLabel.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true headerLabel.topAnchor.constraint(equalTo: containerView.topAnchor, constant: .cardPadding).isActive = true
headerLabel.leadingAnchor.constraint(equalTo: containerView.leadingAnchor).isActive = true headerLabel.leadingAnchor.constraint(equalTo: containerView.leadingAnchor).isActive = true
headerLabel.heightAnchor.constraint(equalToConstant: 26.0).isActive = true headerLabel.trailingAnchor.constraint(equalTo: containerView.trailingAnchor).isActive = true
} else { } else {
containerView.addSubview(emptyTopView) containerView.addSubview(emptyTopView)
emptyTopView.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true emptyTopView.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true