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 // MARK: - Private Properties
//-------------------------------------------------- //--------------------------------------------------
private var lineHeightConstraint: NSLayoutConstraint? private var lineHeightConstraint: NSLayoutConstraint?
private var line = UIView().with {
$0.translatesAutoresizingMaskIntoConstraints = false
}
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // MARK: - Properties
@ -72,7 +76,13 @@ open class TextLink: ButtonBase {
isAccessibilityElement = true isAccessibilityElement = true
accessibilityTraits = .link accessibilityTraits = .link
if let titleLabel { 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() super.reset()
shouldUpdateView = false shouldUpdateView = false
text = nil text = nil
size = .large size = .large
accessibilityCustomActions = [] accessibilityCustomActions = []
isAccessibilityElement = true isAccessibilityElement = true
accessibilityTraits = .link accessibilityTraits = .link
@ -95,9 +105,14 @@ open class TextLink: ButtonBase {
open override var intrinsicContentSize: CGSize { open override var intrinsicContentSize: CGSize {
return titleLabel?.intrinsicContentSize ?? super.intrinsicContentSize 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() { //always call last so the label is rendered
super.layoutSubviews() super.updateView()
addBorder(side: .bottom, width: 1, color: textColor)
} }
} }