updated badge
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
1bd254668f
commit
5cda9843d1
@ -27,7 +27,10 @@ open class Badge: View {
|
|||||||
|
|
||||||
/// Label used to render text
|
/// Label used to render text
|
||||||
open var label = Label().with {
|
open var label = Label().with {
|
||||||
|
$0.setContentHuggingPriority(.required, for: .vertical)
|
||||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||||
|
$0.setContentHuggingPriority(.required, for: .horizontal)
|
||||||
|
$0.setContentCompressionResistancePriority(.required, for: .horizontal)
|
||||||
$0.adjustsFontSizeToFitWidth = false
|
$0.adjustsFontSizeToFitWidth = false
|
||||||
$0.lineBreakMode = .byTruncatingTail
|
$0.lineBreakMode = .byTruncatingTail
|
||||||
$0.textPosition = .left
|
$0.textPosition = .left
|
||||||
@ -141,12 +144,6 @@ open class Badge: View {
|
|||||||
|
|
||||||
backgroundColor = backgroundColorConfiguration.getColor(self)
|
backgroundColor = backgroundColorConfiguration.getColor(self)
|
||||||
|
|
||||||
label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable()
|
|
||||||
label.numberOfLines = numberOfLines
|
|
||||||
label.text = text
|
|
||||||
label.surface = surface
|
|
||||||
label.disabled = disabled
|
|
||||||
|
|
||||||
if let maxWidth = maxWidth, maxWidth > minWidth {
|
if let maxWidth = maxWidth, maxWidth > minWidth {
|
||||||
maxWidthConstraint?.constant = maxWidth
|
maxWidthConstraint?.constant = maxWidth
|
||||||
maxWidthConstraint?.isActive = true
|
maxWidthConstraint?.isActive = true
|
||||||
@ -155,5 +152,11 @@ open class Badge: View {
|
|||||||
maxWidthConstraint?.isActive = false
|
maxWidthConstraint?.isActive = false
|
||||||
minWidthConstraint?.isActive = true
|
minWidthConstraint?.isActive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable()
|
||||||
|
label.numberOfLines = numberOfLines
|
||||||
|
label.text = text
|
||||||
|
label.surface = surface
|
||||||
|
label.disabled = disabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user