From 9e6b2a2bd67e052f9ee7b372b3975bbd51c504ee Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 13 Feb 2024 09:25:27 -0600 Subject: [PATCH] created a mapping method for the old values Signed-off-by: Matt Bruce --- .../Atomic/Extensions/VDS-TextStyle.swift | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Extensions/VDS-TextStyle.swift b/MVMCoreUI/Atomic/Extensions/VDS-TextStyle.swift index 996274e3..f1fc1794 100644 --- a/MVMCoreUI/Atomic/Extensions/VDS-TextStyle.swift +++ b/MVMCoreUI/Atomic/Extensions/VDS-TextStyle.swift @@ -12,7 +12,7 @@ import VDS extension Styler.Font { //Converts Legacy Font to a VDS.TextStyle public func vdsTextStyle() -> VDS.TextStyle? { - let updatedRaw = rawValue.replacingOccurrences(of: "Regular", with: "") + let updatedRaw = mapped().rawValue.replacingOccurrences(of: "Regular", with: "") let newRaw = updatedRaw.prefix(1).lowercased() + updatedRaw.dropFirst() guard let style = VDS.TextStyle(rawValue: newRaw) else { return nil } return style @@ -27,6 +27,24 @@ extension Styler.Font { } return found } + + private func mapped() -> Styler.Font { + var mapped: Styler.Font = self + switch self { + case .Title2XLarge: mapped = .RegularTitle2XLarge + case .TitleXLarge: mapped = .RegularTitleXLarge + case .H1: mapped = .RegularTitle2XLarge + case .H32: mapped = .RegularTitleXLarge + case .H2: mapped = .RegularTitleLarge + case .B20: mapped = .RegularBodyLarge + case .H3: mapped = .BoldTitleMedium + case .B1: mapped = .BoldBodySmall + case .B2: mapped = .RegularBodySmall + case .B3: mapped = .RegularMicro + default: break + } + return mapped + } } extension VDS.Font {