updated to fix label issue

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-01-25 18:22:10 -06:00
parent eacee20fe9
commit 5c8ef10eed

View File

@ -65,10 +65,10 @@ public enum TextStyle: String, CaseIterable {
//MARK: FontCategory
extension TextStyle {
public enum FontCategory: String, CaseIterable {
case feature = "Feature"
case title = "Title"
case body = "Body"
case micro = "micro"
case feature
case title
case body
case micro
public var sizes: [FontSize] {
switch self {
@ -84,7 +84,13 @@ extension TextStyle {
}
public func style(for fontSize: FontSize?, isBold: Bool = false) -> TextStyle? {
let styleName = "\(isBold ? "Bold" : "")\(self.rawValue)\(fontSize?.rawValue ?? "")"
var styleName = ""
if isBold {
let newRaw = rawValue.prefix(1).description.uppercased() + rawValue.dropFirst()
styleName = "\(isBold ? "bold" : "")\(newRaw)\(fontSize?.rawValue ?? "")"
} else {
styleName = "\(newRaw)\(fontSize?.rawValue ?? "")"
}
guard let style = TextStyle(rawValue: styleName) else {
return nil
}