fixed issues with BadgeIndicator Values on the custom styles
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
8f320a9363
commit
d93925b503
@ -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() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user