updated badge

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-15 08:43:16 -05:00
parent 1bd254668f
commit 5cda9843d1

View File

@ -27,7 +27,10 @@ open class Badge: View {
/// Label used to render text
open var label = Label().with {
$0.setContentHuggingPriority(.required, for: .vertical)
$0.setContentCompressionResistancePriority(.required, for: .vertical)
$0.setContentHuggingPriority(.required, for: .horizontal)
$0.setContentCompressionResistancePriority(.required, for: .horizontal)
$0.adjustsFontSizeToFitWidth = false
$0.lineBreakMode = .byTruncatingTail
$0.textPosition = .left
@ -140,12 +143,6 @@ open class Badge: View {
updateTextColorConfig()
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 {
maxWidthConstraint?.constant = maxWidth
@ -155,5 +152,11 @@ open class Badge: View {
maxWidthConstraint?.isActive = false
minWidthConstraint?.isActive = true
}
label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable()
label.numberOfLines = numberOfLines
label.text = text
label.surface = surface
label.disabled = disabled
}
}