revert back to original

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-23 09:54:24 -05:00
parent ee48532cce
commit cfe0f6135b

View File

@ -18,6 +18,10 @@ open class TextLink: ButtonBase {
// MARK: - Private Properties
//--------------------------------------------------
private var lineHeightConstraint: NSLayoutConstraint?
private var line = UIView().with {
$0.translatesAutoresizingMaskIntoConstraints = false
}
//--------------------------------------------------
// MARK: - Properties
@ -72,7 +76,13 @@ open class TextLink: ButtonBase {
isAccessibilityElement = true
accessibilityTraits = .link
if let titleLabel {
titleLabel.debugBorder(show: true)
addSubview(line)
line.pinLeading(titleLabel.leadingAnchor)
line.pinTrailing(titleLabel.trailingAnchor)
line.pinTop(titleLabel.bottomAnchor)
line.pinBottom(bottomAnchor, 0, .defaultHigh)
lineHeightConstraint = line.heightAnchor.constraint(equalToConstant: 1.0)
lineHeightConstraint?.isActive = true
}
}
@ -81,7 +91,7 @@ open class TextLink: ButtonBase {
super.reset()
shouldUpdateView = false
text = nil
size = .large
size = .large
accessibilityCustomActions = []
isAccessibilityElement = true
accessibilityTraits = .link
@ -95,9 +105,14 @@ open class TextLink: ButtonBase {
open override var intrinsicContentSize: CGSize {
return titleLabel?.intrinsicContentSize ?? super.intrinsicContentSize
}
/// Function used to make changes to the View based off a change events or from local properties.
open override func updateView() {
//need to set the properties so the super class
//can render out the label correctly
line.backgroundColor = textColor
open override func layoutSubviews() {
super.layoutSubviews()
addBorder(side: .bottom, width: 1, color: textColor)
//always call last so the label is rendered
super.updateView()
}
}