Revert "removed anything manually setting height"
This reverts commit d08cce4800.
# Conflicts:
# VDS/Components/Buttons/TextLink/TextLink.swift
# VDS/Components/Buttons/TextLinkCaret/TextLinkCaret.swift
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
5567c1174a
commit
b67cda26f1
@ -17,6 +17,7 @@ open class TextLink: ButtonBase {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Private Properties
|
||||
//--------------------------------------------------
|
||||
private var heightConstraint: NSLayoutConstraint?
|
||||
private var lineHeightConstraint: NSLayoutConstraint?
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -44,6 +45,15 @@ 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
|
||||
@ -78,6 +88,9 @@ 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() {
|
||||
@ -91,12 +104,14 @@ open class TextLink: ButtonBase {
|
||||
// MARK: - Overrides
|
||||
//--------------------------------------------------
|
||||
open override var intrinsicContentSize: CGSize {
|
||||
return titleLabel?.intrinsicContentSize ?? super.intrinsicContentSize
|
||||
let size = titleLabel?.intrinsicContentSize ?? super.intrinsicContentSize
|
||||
return CGSize(width: size.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
|
||||
|
||||
|
||||
@ -21,6 +21,8 @@ open class TextLinkCaret: ButtonBase {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Private Properties
|
||||
//--------------------------------------------------
|
||||
private var heightConstraint: NSLayoutConstraint?
|
||||
|
||||
open override var typograpicalStyle: TypographicalStyle {
|
||||
TypographicalStyle.BoldBodyLarge
|
||||
}
|
||||
@ -43,6 +45,10 @@ 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? {
|
||||
@ -89,7 +95,9 @@ 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)
|
||||
}
|
||||
@ -111,7 +119,7 @@ open class TextLinkCaret: ButtonBase {
|
||||
if let caretWidth = caretView.size?.dimensions().width {
|
||||
itemWidth += caretWidth
|
||||
}
|
||||
return CGSize(width: itemWidth, height: size.height)
|
||||
return CGSize(width: itemWidth, height: height)
|
||||
}
|
||||
|
||||
open override func updateView() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user