From 5cda9843d1825788a57f9f3a692504c6e87a60a9 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 15 Aug 2023 08:43:16 -0500 Subject: [PATCH] updated badge Signed-off-by: Matt Bruce --- VDS/Components/Badge/Badge.swift | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/VDS/Components/Badge/Badge.swift b/VDS/Components/Badge/Badge.swift index 5f997c45..70111855 100644 --- a/VDS/Components/Badge/Badge.swift +++ b/VDS/Components/Badge/Badge.swift @@ -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 } }