removed anything manually setting height

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2022-12-02 09:53:08 -06:00
parent 5291de36bc
commit d08cce4800
2 changed files with 5 additions and 30 deletions

View File

@ -17,7 +17,6 @@ open class TextLink: ButtonBase {
//--------------------------------------------------
// MARK: - Private Properties
//--------------------------------------------------
private var heightConstraint: NSLayoutConstraint?
private var lineHeightConstraint: NSLayoutConstraint?
//--------------------------------------------------
@ -45,15 +44,6 @@ open class TextLink: ButtonBase {
$0.highlighted.darkColor = VDSColor.interactiveActiveOndark
}
private var height: CGFloat {
switch size {
case .large:
return 44
case .small:
return 32
}
}
//--------------------------------------------------
// MARK: - Initializers
@ -88,9 +78,6 @@ open class TextLink: ButtonBase {
lineHeightConstraint = line.heightAnchor.constraint(equalToConstant: 1.0)
lineHeightConstraint?.isActive = true
}
heightConstraint = heightAnchor.constraint(equalToConstant: height)
heightConstraint?.isActive = true
}
open override func reset() {
@ -102,15 +89,10 @@ open class TextLink: ButtonBase {
//--------------------------------------------------
// MARK: - Overrides
//--------------------------------------------------
override open var intrinsicContentSize: CGSize {
return CGSize(width: super.intrinsicContentSize.width, height: height)
}
//--------------------------------------------------
open override func updateView() {
//need to set the properties so the super class
//can render out the label correctly
heightConstraint?.constant = height
lineHeightConstraint?.constant = isHighlighted ? 2.0 : 1.0
line.backgroundColor = textColor

View File

@ -21,8 +21,6 @@ open class TextLinkCaret: ButtonBase {
//--------------------------------------------------
// MARK: - Private Properties
//--------------------------------------------------
private var heightConstraint: NSLayoutConstraint?
open override var typograpicalStyle: TypographicalStyle {
TypographicalStyle.BoldBodyLarge
}
@ -45,10 +43,6 @@ open class TextLinkCaret: ButtonBase {
open var iconPosition: TextLinkCaretPosition = .right { didSet { didChange() } }
private var height: CGFloat {
44
}
private var _text: String?
open override var text: String? {
@ -96,9 +90,6 @@ open class TextLinkCaret: ButtonBase {
open override func setup() {
super.setup()
//constraints
heightAnchor.constraint(greaterThanOrEqualToConstant: height).isActive = true
let size = caretView.size!.dimensions()
caretView.frame = .init(x: 0, y: 0, width: size.width, height: size.height)
}
@ -112,11 +103,13 @@ open class TextLinkCaret: ButtonBase {
// MARK: - Overrides
//--------------------------------------------------
override open var intrinsicContentSize: CGSize {
var itemWidth = super.intrinsicContentSize.width
let size = super.intrinsicContentSize
var itemWidth = size.width
if let caretWidth = caretView.size?.dimensions().width {
itemWidth += caretWidth
}
return CGSize(width: itemWidth, height: height)
return CGSize(width: itemWidth, height: size.height)
}
open override func updateView() {