refactor: Migrate AlertsPriorityServiceTableViewCell to code

This commit is contained in:
Andrea Busi
2024-06-14 13:11:47 +02:00
parent 52142486cf
commit 975f5ed5bc
5 changed files with 64 additions and 112 deletions
@@ -37,9 +37,15 @@ class EQNBaseContainerTableViewCell: UITableViewCell {
label.textColor = .white
return label
}()
private lazy var emptyTopView: UIView = {
let view = UIView(frame: .zero)
view.backgroundColor = .clear
return view
}()
var topView: UIView {
isHeaderVisible ? headerLabel : containerView
isHeaderVisible ? headerLabel : emptyTopView
}
var isHeaderVisible: Bool { true }
@@ -77,6 +83,12 @@ class EQNBaseContainerTableViewCell: UITableViewCell {
headerLabel.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true
headerLabel.leadingAnchor.constraint(equalTo: containerView.leadingAnchor).isActive = true
headerLabel.heightAnchor.constraint(equalToConstant: 26.0).isActive = true
} else {
containerView.addSubview(emptyTopView)
emptyTopView.topAnchor.constraint(equalTo: containerView.topAnchor).isActive = true
emptyTopView.leadingAnchor.constraint(equalTo: containerView.leadingAnchor).isActive = true
emptyTopView.trailingAnchor.constraint(equalTo: containerView.trailingAnchor).isActive = true
emptyTopView.heightAnchor.constraint(equalToConstant: 0.0).isActive = true
}
}