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.
|
/// Dynamic TextStyle for the size.
|
||||||
public var textStyle: TextStyle {
|
public var textStyle: TextStyle {
|
||||||
let style = TextStyle.bodySmall
|
var font: Font = .edsRegular
|
||||||
var pointSize: CGFloat = VDSTypography.fontSizeBody12
|
var pointSize: CGFloat = VDSTypography.fontSizeBody12
|
||||||
var letterSpacing: CGFloat = 0.0
|
var letterSpacing: CGFloat = 0.0
|
||||||
|
var lineHeight: CGFloat = 0.0
|
||||||
|
var edgeInsets: UIEdgeInsets = .zero
|
||||||
|
|
||||||
switch self {
|
switch self {
|
||||||
case .xxlarge:
|
case .xxlarge:
|
||||||
pointSize = VDSTypography.fontSizeTitle24
|
pointSize = VDSTypography.fontSizeTitle24
|
||||||
letterSpacing = VDSTypography.letterSpacingWide
|
letterSpacing = VDSTypography.letterSpacingWide
|
||||||
|
lineHeight = VDSTypography.lineHeightTitle24
|
||||||
|
|
||||||
case .xlarge:
|
case .xlarge:
|
||||||
pointSize = VDSTypography.fontSizeTitle20
|
pointSize = VDSTypography.fontSizeTitle20
|
||||||
|
lineHeight = VDSTypography.lineHeightTitle20
|
||||||
|
|
||||||
case .large:
|
case .large:
|
||||||
pointSize = VDSTypography.fontSizeBody16
|
pointSize = VDSTypography.fontSizeBody16
|
||||||
letterSpacing = VDSTypography.letterSpacingWide
|
letterSpacing = VDSTypography.letterSpacingWide
|
||||||
|
lineHeight = VDSTypography.lineHeightBody16
|
||||||
|
|
||||||
case .medium:
|
case .medium:
|
||||||
pointSize = VDSTypography.fontSizeBody14
|
pointSize = VDSTypography.fontSizeBody14
|
||||||
letterSpacing = VDSTypography.letterSpacingWide
|
letterSpacing = VDSTypography.letterSpacingWide
|
||||||
|
lineHeight = 14.0
|
||||||
|
|
||||||
case .small:
|
case .small:
|
||||||
|
font = .etxRegular
|
||||||
pointSize = VDSTypography.fontSizeBody12
|
pointSize = VDSTypography.fontSizeBody12
|
||||||
|
lineHeight = 12.0
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TextStyle(rawValue: "\(self.rawValue)BadgeIndicator",
|
return TextStyle(rawValue: "\(self.rawValue)BadgeIndicator",
|
||||||
fontFace: style.fontFace,
|
fontFace: font,
|
||||||
pointSize: pointSize,
|
pointSize: pointSize,
|
||||||
lineHeight: 0,
|
lineHeight: lineHeight,
|
||||||
letterSpacing: letterSpacing)
|
letterSpacing: letterSpacing,
|
||||||
|
edgeInsets: edgeInsets)
|
||||||
}
|
}
|
||||||
|
|
||||||
//EdgeInsets for the label.
|
//EdgeInsets for the label.
|
||||||
public var edgeInset: UIEdgeInsets {
|
public var edgeInset: UIEdgeInsets {
|
||||||
var horizontalPadding: CGFloat = VDSLayout.Spacing.space1X.value
|
var horizontalPadding: CGFloat = 0.0
|
||||||
let verticalPadding: CGFloat = 0
|
let verticalPadding: CGFloat = 2.0
|
||||||
|
|
||||||
switch self {
|
switch self {
|
||||||
case .xxlarge:
|
case .xxlarge:
|
||||||
horizontalPadding = VDSLayout.Spacing.space2X.value
|
horizontalPadding = VDSLayout.Spacing.space2X.value
|
||||||
case .xlarge, .large,.medium:
|
case .xlarge, .large, .medium:
|
||||||
horizontalPadding = 6.0
|
horizontalPadding = 6.0
|
||||||
case .small:
|
case .small:
|
||||||
break
|
horizontalPadding = VDSLayout.Spacing.space1X.value
|
||||||
}
|
}
|
||||||
return .axis(horizontal: horizontalPadding, vertical: verticalPadding)
|
return .axis(horizontal: horizontalPadding, vertical: verticalPadding)
|
||||||
}
|
}
|
||||||
@ -345,6 +357,7 @@ open class BadgeIndicator: View {
|
|||||||
label.sizeToFit()
|
label.sizeToFit()
|
||||||
setNeedsLayout()
|
setNeedsLayout()
|
||||||
layoutIfNeeded()
|
layoutIfNeeded()
|
||||||
|
label.debugBorder(color: .green)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func layoutSubviews() {
|
open override func layoutSubviews() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user