updated to fix label issue
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
eacee20fe9
commit
5c8ef10eed
@ -65,10 +65,10 @@ public enum TextStyle: String, CaseIterable {
|
|||||||
//MARK: FontCategory
|
//MARK: FontCategory
|
||||||
extension TextStyle {
|
extension TextStyle {
|
||||||
public enum FontCategory: String, CaseIterable {
|
public enum FontCategory: String, CaseIterable {
|
||||||
case feature = "Feature"
|
case feature
|
||||||
case title = "Title"
|
case title
|
||||||
case body = "Body"
|
case body
|
||||||
case micro = "micro"
|
case micro
|
||||||
|
|
||||||
public var sizes: [FontSize] {
|
public var sizes: [FontSize] {
|
||||||
switch self {
|
switch self {
|
||||||
@ -84,7 +84,13 @@ extension TextStyle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func style(for fontSize: FontSize?, isBold: Bool = false) -> 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 {
|
guard let style = TextStyle(rawValue: styleName) else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user