removed anything manually setting height
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
5291de36bc
commit
d08cce4800
@ -17,7 +17,6 @@ open class TextLink: ButtonBase {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Properties
|
// MARK: - Private Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private var heightConstraint: NSLayoutConstraint?
|
|
||||||
private var lineHeightConstraint: NSLayoutConstraint?
|
private var lineHeightConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -45,15 +44,6 @@ 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
|
||||||
@ -88,9 +78,6 @@ 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() {
|
||||||
@ -102,15 +89,10 @@ open class TextLink: ButtonBase {
|
|||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
override open var intrinsicContentSize: CGSize {
|
|
||||||
return CGSize(width: super.intrinsicContentSize.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,8 +21,6 @@ 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
|
||||||
}
|
}
|
||||||
@ -45,10 +43,6 @@ 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? {
|
||||||
@ -96,9 +90,6 @@ 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)
|
||||||
}
|
}
|
||||||
@ -112,11 +103,13 @@ open class TextLinkCaret: ButtonBase {
|
|||||||
// MARK: - Overrides
|
// MARK: - Overrides
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
override open var intrinsicContentSize: CGSize {
|
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 {
|
if let caretWidth = caretView.size?.dimensions().width {
|
||||||
itemWidth += caretWidth
|
itemWidth += caretWidth
|
||||||
}
|
}
|
||||||
return CGSize(width: itemWidth, height: height)
|
return CGSize(width: itemWidth, height: size.height)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user