From d93925b503d1fc56405ad7a0868a4dcf2618c44c Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 7 Mar 2024 14:59:20 -0600 Subject: [PATCH] fixed issues with BadgeIndicator Values on the custom styles Signed-off-by: Matt Bruce --- .../BadgeIndicator/BadgeIndicator.swift | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/VDS/Components/BadgeIndicator/BadgeIndicator.swift b/VDS/Components/BadgeIndicator/BadgeIndicator.swift index 45432458..bcacfe84 100644 --- a/VDS/Components/BadgeIndicator/BadgeIndicator.swift +++ b/VDS/Components/BadgeIndicator/BadgeIndicator.swift @@ -84,47 +84,59 @@ open class BadgeIndicator: View { /// Dynamic TextStyle for the size. public var textStyle: TextStyle { - let style = TextStyle.bodySmall + var font: Font = .edsRegular var pointSize: CGFloat = VDSTypography.fontSizeBody12 var letterSpacing: CGFloat = 0.0 + var lineHeight: CGFloat = 0.0 + var edgeInsets: UIEdgeInsets = .zero + switch self { case .xxlarge: pointSize = VDSTypography.fontSizeTitle24 letterSpacing = VDSTypography.letterSpacingWide - + lineHeight = VDSTypography.lineHeightTitle24 + case .xlarge: pointSize = VDSTypography.fontSizeTitle20 + lineHeight = VDSTypography.lineHeightTitle20 case .large: pointSize = VDSTypography.fontSizeBody16 letterSpacing = VDSTypography.letterSpacingWide + lineHeight = VDSTypography.lineHeightBody16 case .medium: pointSize = VDSTypography.fontSizeBody14 letterSpacing = VDSTypography.letterSpacingWide + lineHeight = 14.0 + case .small: + font = .etxRegular pointSize = VDSTypography.fontSizeBody12 + lineHeight = 12.0 } + return TextStyle(rawValue: "\(self.rawValue)BadgeIndicator", - fontFace: style.fontFace, + fontFace: font, pointSize: pointSize, - lineHeight: 0, - letterSpacing: letterSpacing) + lineHeight: lineHeight, + letterSpacing: letterSpacing, + edgeInsets: edgeInsets) } //EdgeInsets for the label. public var edgeInset: UIEdgeInsets { - var horizontalPadding: CGFloat = VDSLayout.Spacing.space1X.value - let verticalPadding: CGFloat = 0 + var horizontalPadding: CGFloat = 0.0 + let verticalPadding: CGFloat = 2.0 switch self { case .xxlarge: horizontalPadding = VDSLayout.Spacing.space2X.value - case .xlarge, .large,.medium: + case .xlarge, .large, .medium: horizontalPadding = 6.0 case .small: - break + horizontalPadding = VDSLayout.Spacing.space1X.value } return .axis(horizontal: horizontalPadding, vertical: verticalPadding) } @@ -345,6 +357,7 @@ open class BadgeIndicator: View { label.sizeToFit() setNeedsLayout() layoutIfNeeded() + label.debugBorder(color: .green) } open override func layoutSubviews() {