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
|
// MARK: - Private Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
private var heightConstraint: NSLayoutConstraint?
|
||||||
private var lineHeightConstraint: NSLayoutConstraint?
|
private var lineHeightConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -44,6 +45,15 @@ open class TextLink: ButtonBase {
|
|||||||
$0.highlighted.darkColor = VDSColor.interactiveActiveOndark
|
$0.highlighted.darkColor = VDSColor.interactiveActiveOndark
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var height: CGFloat {
|
||||||
|
switch size {
|
||||||
|
case .large:
|
||||||
|
return 44
|
||||||
|
case .small:
|
||||||
|
return 32
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
@ -78,6 +88,9 @@ open class TextLink: ButtonBase {
|
|||||||
lineHeightConstraint = line.heightAnchor.constraint(equalToConstant: 1.0)
|
lineHeightConstraint = line.heightAnchor.constraint(equalToConstant: 1.0)
|
||||||
lineHeightConstraint?.isActive = true
|
lineHeightConstraint?.isActive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
heightConstraint = heightAnchor.constraint(equalToConstant: height)
|
||||||
|
heightConstraint?.isActive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
@ -91,12 +104,14 @@ open class TextLink: ButtonBase {
|
|||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
open override var intrinsicContentSize: CGSize {
|
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() {
|
open override func updateView() {
|
||||||
//need to set the properties so the super class
|
//need to set the properties so the super class
|
||||||
//can render out the label correctly
|
//can render out the label correctly
|
||||||
|
heightConstraint?.constant = height
|
||||||
lineHeightConstraint?.constant = isHighlighted ? 2.0 : 1.0
|
lineHeightConstraint?.constant = isHighlighted ? 2.0 : 1.0
|
||||||
line.backgroundColor = textColor
|
line.backgroundColor = textColor
|
||||||
|
|
||||||
|
|||||||
@ -21,6 +21,8 @@ open class TextLinkCaret: ButtonBase {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Properties
|
// MARK: - Private Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
private var heightConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
open override var typograpicalStyle: TypographicalStyle {
|
open override var typograpicalStyle: TypographicalStyle {
|
||||||
TypographicalStyle.BoldBodyLarge
|
TypographicalStyle.BoldBodyLarge
|
||||||
}
|
}
|
||||||
@ -43,6 +45,10 @@ open class TextLinkCaret: ButtonBase {
|
|||||||
|
|
||||||
open var iconPosition: TextLinkCaretPosition = .right { didSet { didChange() } }
|
open var iconPosition: TextLinkCaretPosition = .right { didSet { didChange() } }
|
||||||
|
|
||||||
|
private var height: CGFloat {
|
||||||
|
44
|
||||||
|
}
|
||||||
|
|
||||||
private var _text: String?
|
private var _text: String?
|
||||||
|
|
||||||
open override var text: String? {
|
open override var text: String? {
|
||||||
@ -89,7 +95,9 @@ open class TextLinkCaret: ButtonBase {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
|
//constraints
|
||||||
|
heightAnchor.constraint(greaterThanOrEqualToConstant: height).isActive = true
|
||||||
|
|
||||||
let size = caretView.size!.dimensions()
|
let size = caretView.size!.dimensions()
|
||||||
caretView.frame = .init(x: 0, y: 0, width: size.width, height: size.height)
|
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 {
|
if let caretWidth = caretView.size?.dimensions().width {
|
||||||
itemWidth += caretWidth
|
itemWidth += caretWidth
|
||||||
}
|
}
|
||||||
return CGSize(width: itemWidth, height: size.height)
|
return CGSize(width: itemWidth, height: height)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user