diff --git a/Demo/SnapshotTests/__Snapshots__/RecyclingViewTests/SettingsViewDemoView.dark_iPhone.png b/Demo/SnapshotTests/__Snapshots__/RecyclingViewTests/SettingsViewDemoView.dark_iPhone.png index daa5ef2fec..78b5923558 100644 Binary files a/Demo/SnapshotTests/__Snapshots__/RecyclingViewTests/SettingsViewDemoView.dark_iPhone.png and b/Demo/SnapshotTests/__Snapshots__/RecyclingViewTests/SettingsViewDemoView.dark_iPhone.png differ diff --git a/Demo/SnapshotTests/__Snapshots__/RecyclingViewTests/SettingsViewDemoView.light_iPhone.png b/Demo/SnapshotTests/__Snapshots__/RecyclingViewTests/SettingsViewDemoView.light_iPhone.png index 0ca4229724..12e7c19ec7 100644 Binary files a/Demo/SnapshotTests/__Snapshots__/RecyclingViewTests/SettingsViewDemoView.light_iPhone.png and b/Demo/SnapshotTests/__Snapshots__/RecyclingViewTests/SettingsViewDemoView.light_iPhone.png differ diff --git a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/FinnTextField_Previews.dark_iPhone.png b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/FinnTextField_Previews.dark_iPhone.png index 8fb679cd09..1acf5b4287 100644 Binary files a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/FinnTextField_Previews.dark_iPhone.png and b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/FinnTextField_Previews.dark_iPhone.png differ diff --git a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/FinnTextField_Previews.light_iPhone.png b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/FinnTextField_Previews.light_iPhone.png index df802e5e65..15cf8be196 100644 Binary files a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/FinnTextField_Previews.light_iPhone.png and b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/FinnTextField_Previews.light_iPhone.png differ diff --git a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/FinnTextView_Previews.dark_iPhone.png b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/FinnTextView_Previews.dark_iPhone.png index 3d86abae00..4dc5ceeef6 100644 Binary files a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/FinnTextView_Previews.dark_iPhone.png and b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/FinnTextView_Previews.dark_iPhone.png differ diff --git a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/FinnTextView_Previews.light_iPhone.png b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/FinnTextView_Previews.light_iPhone.png index 270c0bcbe4..77f37dfe60 100644 Binary files a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/FinnTextView_Previews.light_iPhone.png and b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/FinnTextView_Previews.light_iPhone.png differ diff --git a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ResultSwiftUIDemoViewController.dark_iPhone_emptyview.png b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ResultSwiftUIDemoViewController.dark_iPhone_emptyview.png index b83addfb99..2af3262526 100644 Binary files a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ResultSwiftUIDemoViewController.dark_iPhone_emptyview.png and b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ResultSwiftUIDemoViewController.dark_iPhone_emptyview.png differ diff --git a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ResultSwiftUIDemoViewController.dark_iPhone_errorretryview.png b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ResultSwiftUIDemoViewController.dark_iPhone_errorretryview.png index fc974fbd58..ce1fa1d30d 100644 Binary files a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ResultSwiftUIDemoViewController.dark_iPhone_errorretryview.png and b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ResultSwiftUIDemoViewController.dark_iPhone_errorretryview.png differ diff --git a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ResultSwiftUIDemoViewController.light_iPhone_emptyview.png b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ResultSwiftUIDemoViewController.light_iPhone_emptyview.png index 063d506e9a..2ea8064461 100644 Binary files a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ResultSwiftUIDemoViewController.light_iPhone_emptyview.png and b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ResultSwiftUIDemoViewController.light_iPhone_emptyview.png differ diff --git a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ResultSwiftUIDemoViewController.light_iPhone_errorretryview.png b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ResultSwiftUIDemoViewController.light_iPhone_errorretryview.png index 8ff0117153..01d607e0d1 100644 Binary files a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ResultSwiftUIDemoViewController.light_iPhone_errorretryview.png and b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ResultSwiftUIDemoViewController.light_iPhone_errorretryview.png differ diff --git a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/SwiftUISelectionListDemoView_Previews.dark_iPhone.png b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/SwiftUISelectionListDemoView_Previews.dark_iPhone.png index 030be792dd..ec9c66cc8c 100644 Binary files a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/SwiftUISelectionListDemoView_Previews.dark_iPhone.png and b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/SwiftUISelectionListDemoView_Previews.dark_iPhone.png differ diff --git a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/SwiftUISelectionListDemoView_Previews.light_iPhone.png b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/SwiftUISelectionListDemoView_Previews.light_iPhone.png index bbc937a348..c0e3c671bb 100644 Binary files a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/SwiftUISelectionListDemoView_Previews.light_iPhone.png and b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/SwiftUISelectionListDemoView_Previews.light_iPhone.png differ diff --git a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ToastSwiftUIDemoView_Previews.dark_iPhone.png b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ToastSwiftUIDemoView_Previews.dark_iPhone.png index 6fc84b50b6..84337a8178 100644 Binary files a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ToastSwiftUIDemoView_Previews.dark_iPhone.png and b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ToastSwiftUIDemoView_Previews.dark_iPhone.png differ diff --git a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ToastSwiftUIDemoView_Previews.light_iPhone.png b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ToastSwiftUIDemoView_Previews.light_iPhone.png index 863e986044..27b79bcb6a 100644 Binary files a/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ToastSwiftUIDemoView_Previews.light_iPhone.png and b/Demo/SnapshotTests/__Snapshots__/SwiftUIViewTests/ToastSwiftUIDemoView_Previews.light_iPhone.png differ diff --git a/Demo/Sources/Components/InfoboxSwiftUI/InfoboxSwiftUIViewController.swift b/Demo/Sources/Components/InfoboxSwiftUI/InfoboxSwiftUIViewController.swift index 0b4e5579a7..4d359d226e 100644 --- a/Demo/Sources/Components/InfoboxSwiftUI/InfoboxSwiftUIViewController.swift +++ b/Demo/Sources/Components/InfoboxSwiftUI/InfoboxSwiftUIViewController.swift @@ -52,7 +52,7 @@ struct InfoboxSwiftUIPresentationView: View { } } - .finnFont(.caption) + .font(from: .caption) .foregroundStyle(.secondary) } .padding() diff --git a/Demo/Sources/Components/Label/LabelDemoView.swift b/Demo/Sources/Components/Label/LabelDemoView.swift index 73108e34f7..e008367b37 100644 --- a/Demo/Sources/Components/Label/LabelDemoView.swift +++ b/Demo/Sources/Components/Label/LabelDemoView.swift @@ -4,6 +4,7 @@ import FinniversKit import DemoKit +import Warp public class LabelDemoView: UIView, Demoable { override init(frame: CGRect) { @@ -28,7 +29,7 @@ public class LabelDemoView: UIView, Demoable { let labelBody = Label(style: .body) let labelDetail = Label(style: .detail) - let testStyle: Label.Style = .body + let testStyle: Warp.Typography = .body let multilineLabel = Label(style: testStyle) let label1 = Label(style: testStyle) let label2 = Label(style: testStyle) diff --git a/Demo/Sources/Components/ObjectPageTitleView/ObjectPageTitleDemoView.swift b/Demo/Sources/Components/ObjectPageTitleView/ObjectPageTitleDemoView.swift index a7fc1e80ce..65f722ab62 100644 --- a/Demo/Sources/Components/ObjectPageTitleView/ObjectPageTitleDemoView.swift +++ b/Demo/Sources/Components/ObjectPageTitleView/ObjectPageTitleDemoView.swift @@ -57,11 +57,11 @@ class ObjectPageTitleDemoView: UIView, Tweakable { private func configureTitleView( title: String? = nil, - titleStyle: Label.Style = .title2, + titleStyle: Warp.Typography = .title2, subtitle: String? = nil, - subtitleStyle: Label.Style = .body, + subtitleStyle: Warp.Typography = .body, caption: String? = nil, - captionStyle: Label.Style = .caption, + captionStyle: Warp.Typography = .caption, ribbonViewModel: RibbonViewModel? = nil, spacingAfterTitle: CGFloat = Warp.Spacing.spacing50, spacingAfterSubtitle: CGFloat = Warp.Spacing.spacing50, diff --git a/Demo/Sources/Components/OverflowCollectionView/OverflowCollectionViewDemo.swift b/Demo/Sources/Components/OverflowCollectionView/OverflowCollectionViewDemo.swift index 97ca27633f..1988163165 100644 --- a/Demo/Sources/Components/OverflowCollectionView/OverflowCollectionViewDemo.swift +++ b/Demo/Sources/Components/OverflowCollectionView/OverflowCollectionViewDemo.swift @@ -61,7 +61,7 @@ private class DemoCollectionViewCell: UICollectionViewCell, OverflowCollectionVi // MARK: - Private properties - private static let labelStyle = Label.Style.body + private static let labelStyle = Warp.Typography.body private static let margins = UIEdgeInsets(vertical: Warp.Spacing.spacing100, horizontal: Warp.Spacing.spacing200) private lazy var label = Label(style: .body, withAutoLayout: true) @@ -101,7 +101,7 @@ private class DemoCollectionViewCell: UICollectionViewCell, OverflowCollectionVi // MARK: - OverflowCollectionViewCell static func size(using model: String) -> CGSize { - let font = Self.labelStyle.font + let font = Self.labelStyle.uiFont let margins = Self.margins let width = model.width(withConstrainedHeight: .infinity, font: font) + (margins.leading + margins.trailing) diff --git a/Demo/Sources/SwiftUI/FinnTextField+Previews.swift b/Demo/Sources/SwiftUI/FinnTextField+Previews.swift index b818707fdf..5005e1791c 100644 --- a/Demo/Sources/SwiftUI/FinnTextField+Previews.swift +++ b/Demo/Sources/SwiftUI/FinnTextField+Previews.swift @@ -14,7 +14,7 @@ struct FinnTextFieldDemoView: View { var body: some View { ScrollView { Text("Textfields") - .finnFont(.title1) + .font(from: .title1) .padding(.bottom, Warp.Spacing.spacing200) FinnTextField(placeholder: "Default", text: $text) diff --git a/Demo/Sources/SwiftUI/FinnTextView+Previews.swift b/Demo/Sources/SwiftUI/FinnTextView+Previews.swift index d24933110d..d695002b6b 100644 --- a/Demo/Sources/SwiftUI/FinnTextView+Previews.swift +++ b/Demo/Sources/SwiftUI/FinnTextView+Previews.swift @@ -13,7 +13,7 @@ struct FinnTextViewDemoView: View { var body: some View { VStack { Text("Textviews") - .finnFont(.title1) + .font(from: .title1) .padding(.bottom, Warp.Spacing.spacing200) FinnTextView(text: $text).frame(height: 100) diff --git a/FinniversKit/FinniversKit.xcodeproj/project.pbxproj b/FinniversKit/FinniversKit.xcodeproj/project.pbxproj index dcb009f52f..4e015a419d 100644 --- a/FinniversKit/FinniversKit.xcodeproj/project.pbxproj +++ b/FinniversKit/FinniversKit.xcodeproj/project.pbxproj @@ -98,7 +98,6 @@ 444246032137D60400D42AB8 /* FavoriteFolderViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 444246002137D60400D42AB8 /* FavoriteFolderViewModel.swift */; }; 4447F6C71FDB2B110033DBC1 /* Button+Style.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4447F6661FDB2B110033DBC1 /* Button+Style.swift */; }; 4447F6C81FDB2B110033DBC1 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4447F6671FDB2B110033DBC1 /* Button.swift */; }; - 4447F6D11FDB2B110033DBC1 /* Label+Style.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4447F6751FDB2B110033DBC1 /* Label+Style.swift */; }; 4447F6D21FDB2B110033DBC1 /* Label.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4447F6761FDB2B110033DBC1 /* Label.swift */; }; 4447F6E91FDB2B110033DBC1 /* Ribbon+Style.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4447F69F1FDB2B110033DBC1 /* Ribbon+Style.swift */; }; 4447F6EA1FDB2B110033DBC1 /* RibbonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4447F6A01FDB2B110033DBC1 /* RibbonView.swift */; }; @@ -258,7 +257,6 @@ 9B93F210230FC3CD009B2D4B /* NSDirectionalEdgeInsetsExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B93F20F230FC3CD009B2D4B /* NSDirectionalEdgeInsetsExtensions.swift */; }; 9B9663CB2460383900D34BA1 /* ConfigTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9B9663CA2460383900D34BA1 /* ConfigTests.swift */; }; 9BA8248623859B4400163F24 /* MapZoomRange.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BA8248523859B4400163F24 /* MapZoomRange.swift */; }; - 9BB6802F2462F763001ADACF /* Font+SwiftUI.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BB6802E2462F763001ADACF /* Font+SwiftUI.swift */; }; 9BB680322462F7AC001ADACF /* View+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BB680312462F7AC001ADACF /* View+Extensions.swift */; }; 9BB734C42462EA0500E05435 /* ButtonStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BB734C32462EA0500E05435 /* ButtonStyle.swift */; }; 9BBC903E24FD24D20003D2D8 /* UITraitCollectionExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9BBC903D24FD24D20003D2D8 /* UITraitCollectionExtensions.swift */; }; @@ -541,7 +539,6 @@ 444246002137D60400D42AB8 /* FavoriteFolderViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FavoriteFolderViewModel.swift; sourceTree = ""; }; 4447F6661FDB2B110033DBC1 /* Button+Style.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Button+Style.swift"; sourceTree = ""; }; 4447F6671FDB2B110033DBC1 /* Button.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = ""; }; - 4447F6751FDB2B110033DBC1 /* Label+Style.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Label+Style.swift"; sourceTree = ""; }; 4447F6761FDB2B110033DBC1 /* Label.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Label.swift; sourceTree = ""; }; 4447F69F1FDB2B110033DBC1 /* Ribbon+Style.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Ribbon+Style.swift"; sourceTree = ""; }; 4447F6A01FDB2B110033DBC1 /* RibbonView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RibbonView.swift; sourceTree = ""; }; @@ -700,7 +697,6 @@ 9B93F20F230FC3CD009B2D4B /* NSDirectionalEdgeInsetsExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSDirectionalEdgeInsetsExtensions.swift; sourceTree = ""; }; 9B9663CA2460383900D34BA1 /* ConfigTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigTests.swift; sourceTree = ""; }; 9BA8248523859B4400163F24 /* MapZoomRange.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapZoomRange.swift; sourceTree = ""; }; - 9BB6802E2462F763001ADACF /* Font+SwiftUI.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Font+SwiftUI.swift"; sourceTree = ""; }; 9BB680312462F7AC001ADACF /* View+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+Extensions.swift"; sourceTree = ""; }; 9BB734C32462EA0500E05435 /* ButtonStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonStyle.swift; sourceTree = ""; }; 9BBC903D24FD24D20003D2D8 /* UITraitCollectionExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UITraitCollectionExtensions.swift; sourceTree = ""; }; @@ -1195,7 +1191,6 @@ 4408A6A12027AC41008C0BD9 /* Font */ = { isa = PBXGroup; children = ( - 9BB6802E2462F763001ADACF /* Font+SwiftUI.swift */, 4408A6A22027AC41008C0BD9 /* UIFont+FinniversKit.swift */, ); path = Font; @@ -1441,7 +1436,6 @@ 4447F6741FDB2B110033DBC1 /* Label */ = { isa = PBXGroup; children = ( - 4447F6751FDB2B110033DBC1 /* Label+Style.swift */, 4447F6761FDB2B110033DBC1 /* Label.swift */, ); path = Label; @@ -3236,7 +3230,6 @@ 44A557B522E72187001667AE /* HeartTableViewCell.swift in Sources */, B2829E2D2C7F054F0032BDFA /* HTMLAttributeStack.swift in Sources */, 573B3FF82ACC1B75005096EC /* SettingsViewIconCellModel.swift in Sources */, - 4447F6D11FDB2B110033DBC1 /* Label+Style.swift in Sources */, 441FE431209A24E500B04EF1 /* AdRecommendationsGridHeaderView.swift in Sources */, 0881432A22E1B974008CB5DA /* ToastButton.swift in Sources */, 9B28DE8023266C5000D69C15 /* Panel.swift in Sources */, @@ -3414,7 +3407,6 @@ 45B2E06A207CF5C100C68B92 /* StringExtensions.swift in Sources */, E87A7BF328ED6AE0007094F2 /* NeighborhoodProfileBannerView.swift in Sources */, 4447F6C81FDB2B110033DBC1 /* Button.swift in Sources */, - 9BB6802F2462F763001ADACF /* Font+SwiftUI.swift in Sources */, 4441F9F322CCF76300DCFD2F /* AddressMapView.swift in Sources */, 9BEB287D231D486100D28BAD /* LoanValuesView.swift in Sources */, 9BB680322462F7AC001ADACF /* View+Extensions.swift in Sources */, diff --git a/FinniversKit/Sources/Base Components/ButtonStyle.swift b/FinniversKit/Sources/Base Components/ButtonStyle.swift index c82393f14e..8690cf5d7b 100644 --- a/FinniversKit/Sources/Base Components/ButtonStyle.swift +++ b/FinniversKit/Sources/Base Components/ButtonStyle.swift @@ -10,7 +10,7 @@ public struct InlineFlatStyle: ButtonStyle { private let textColor: Color public init(size: Button.Size = .normal, textColor: Color = .textLink) { - self.font = size == .normal ? .finnFont(.bodyStrong) : .finnFont(.detailStrong) + self.font = Self.font(for: size) self.textColor = textColor } @@ -36,7 +36,7 @@ public struct FlatStyle: ButtonStyle { padding: EdgeInsets = .init(top: Warp.Spacing.spacing100, leading: Warp.Spacing.spacing200, bottom: Warp.Spacing.spacing100, trailing: Warp.Spacing.spacing200) ) { self.size = size - self.font = size == .normal ? .finnFont(.bodyStrong) : .finnFont(.detailStrong) + self.font = Self.font(for: size) self.textColor = textColor self.fullWidth = fullWidth self.padding = padding @@ -71,7 +71,7 @@ public struct DefaultStyle: ButtonStyle { padding: EdgeInsets = .init(top: Warp.Spacing.spacing100, leading: Warp.Spacing.spacing200, bottom: Warp.Spacing.spacing100, trailing: Warp.Spacing.spacing200) ) { self.size = size - self.font = size == .normal ? .finnFont(.bodyStrong) : .finnFont(.detailStrong) + self.font = Self.font(for: size) self.textColor = textColor self.fullWidth = fullWidth self.padding = padding @@ -118,7 +118,7 @@ public struct CallToAction: ButtonStyle { ) { self.background = background self.fullWidth = fullWidth - self.font = size == .normal ? .finnFont(.bodyStrong) : .finnFont(.detailStrong) + self.font = Self.font(for: size) if let padding { self.padding = padding @@ -162,15 +162,21 @@ private extension CGFloat { static let normalButtonVerticalPadding: CGFloat = 13 } +private extension ButtonStyle { + static func font(for size: Button.Size) -> Font { + (size == .normal ? Warp.Typography.bodyStrong : Warp.Typography.detailStrong).font + } +} + #Preview { VStack { HStack(spacing: 0) { Text("Example ") - .finnFont(.body) + .font(from: .body) SwiftUI.Button("inline style", action: {}) .buttonStyle(InlineFlatStyle()) Text(" with some text") - .finnFont(.body) + .font(from: .body) } SwiftUI.Button("Flat", action: {}) .buttonStyle(FlatStyle()) diff --git a/FinniversKit/Sources/Components/AddressComponentView/Subviews/AddressComponentFieldView.swift b/FinniversKit/Sources/Components/AddressComponentView/Subviews/AddressComponentFieldView.swift index 104d411ddd..9b9ba19afb 100644 --- a/FinniversKit/Sources/Components/AddressComponentView/Subviews/AddressComponentFieldView.swift +++ b/FinniversKit/Sources/Components/AddressComponentView/Subviews/AddressComponentFieldView.swift @@ -95,7 +95,7 @@ public class AddressComponentFieldView: UIView { // MARK: - Private extensions private extension Label { - static func create(style: Label.Style, textColor: UIColor = .text) -> Label { + static func create(style: Warp.Typography, textColor: UIColor = .text) -> Label { let label = Label(style: style, withAutoLayout: true) label.textColor = textColor return label diff --git a/FinniversKit/Sources/Components/AddressComponentView/Subviews/AddressComponentPostalFieldView.swift b/FinniversKit/Sources/Components/AddressComponentView/Subviews/AddressComponentPostalFieldView.swift index 1ceccb9b5a..b8aa5913c0 100644 --- a/FinniversKit/Sources/Components/AddressComponentView/Subviews/AddressComponentPostalFieldView.swift +++ b/FinniversKit/Sources/Components/AddressComponentView/Subviews/AddressComponentPostalFieldView.swift @@ -111,7 +111,7 @@ public class AddressComponentPostalFieldView: UIView { // MARK: - Private extensions private extension Label { - static func create(style: Label.Style, textColor: UIColor = .text) -> Label { + static func create(style: Warp.Typography, textColor: UIColor = .text) -> Label { let label = Label(style: style, withAutoLayout: true) label.textColor = textColor return label diff --git a/FinniversKit/Sources/Components/CollapsibleContentView/CollapsibleContentView+Style.swift b/FinniversKit/Sources/Components/CollapsibleContentView/CollapsibleContentView+Style.swift index 8ff42d0336..ab2b2e8507 100644 --- a/FinniversKit/Sources/Components/CollapsibleContentView/CollapsibleContentView+Style.swift +++ b/FinniversKit/Sources/Components/CollapsibleContentView/CollapsibleContentView+Style.swift @@ -8,7 +8,7 @@ extension CollapsibleContentView { public let borderWidth: CGFloat public let borderColor: UIColor? public let contentInsets: UIEdgeInsets - public let titleStyle: Label.Style + public let titleStyle: Warp.Typography public let headerContentSpacing: CGFloat public let hairlineColor: UIColor? @@ -18,7 +18,7 @@ extension CollapsibleContentView { borderWidth: CGFloat = 0, borderColor: UIColor? = nil, contentInsets: UIEdgeInsets, - titleStyle: Label.Style, + titleStyle: Warp.Typography, headerContentSpacing: CGFloat, hairlineColor: UIColor? = nil ) { @@ -58,7 +58,7 @@ extension CollapsibleContentView { borderWidth: CGFloat? = nil, borderColor: UIColor? = nil, contentInsets: UIEdgeInsets? = nil, - titleStyle: Label.Style? = nil, + titleStyle: Warp.Typography? = nil, headerContentSpacing: CGFloat? = nil, hairlineColor: UIColor? = nil ) -> CollapsibleContentView.Style { diff --git a/FinniversKit/Sources/Components/ColumnListsView/ColumnListsView.swift b/FinniversKit/Sources/Components/ColumnListsView/ColumnListsView.swift index 2976c7dc20..575d318732 100644 --- a/FinniversKit/Sources/Components/ColumnListsView/ColumnListsView.swift +++ b/FinniversKit/Sources/Components/ColumnListsView/ColumnListsView.swift @@ -22,7 +22,7 @@ public class ColumnListsView: UIView { private var textItems: [String] = [] - private var style: Label.Style = .caption + private var style: Warp.Typography = .caption private lazy var stackView: UIStackView = { let stackView = UIStackView(withAutoLayout: true) @@ -46,7 +46,7 @@ public class ColumnListsView: UIView { // MARK: - Public methods - public func configure(with textItems: [String], numberOfColumns: Int, style: Label.Style) { + public func configure(with textItems: [String], numberOfColumns: Int, style: Warp.Typography) { self.textItems = textItems self.numberOfColumns = numberOfColumns self.style = style diff --git a/FinniversKit/Sources/Components/FrontPageTransactionView/FrontPageTransactionView.swift b/FinniversKit/Sources/Components/FrontPageTransactionView/FrontPageTransactionView.swift index 66b33fb708..668430f417 100644 --- a/FinniversKit/Sources/Components/FrontPageTransactionView/FrontPageTransactionView.swift +++ b/FinniversKit/Sources/Components/FrontPageTransactionView/FrontPageTransactionView.swift @@ -15,7 +15,7 @@ public struct FrontPageTransactionView: View { public var body: some View { VStack(alignment: .leading, spacing: Warp.Spacing.spacing100) { Text(model.headerTitle) - .finnFont(.bodyStrong) + .font(from: .bodyStrong) .foregroundColor(.text) .accessibilityAddTraits(.isHeader) @@ -23,11 +23,11 @@ public struct FrontPageTransactionView: View { HStack(alignment: .top, spacing: Warp.Spacing.spacing100) { VStack(alignment: .leading, spacing: Warp.Spacing.spacing50) { Text(model.title) - .finnFont(.bodyStrong) + .font(from: .bodyStrong) .foregroundColor(.text) Text(model.subtitle) - .finnFont(.body) + .font(from: .body) .foregroundColor(.text) } diff --git a/FinniversKit/Sources/Components/HTMLLabel/HTMLLabel.swift b/FinniversKit/Sources/Components/HTMLLabel/HTMLLabel.swift index 5ee65f4bc0..b26ed2a3a9 100644 --- a/FinniversKit/Sources/Components/HTMLLabel/HTMLLabel.swift +++ b/FinniversKit/Sources/Components/HTMLLabel/HTMLLabel.swift @@ -1,3 +1,5 @@ +import Warp + public class HTMLLabel: Label { private var htmlText: String? private let spanMapper: HTMLStringUIKitStyleTranslator.SpanMapper @@ -11,7 +13,7 @@ public class HTMLLabel: Label { } } - public init(style: Style, spanMapper: @escaping HTMLStringUIKitStyleTranslator.SpanMapper = { _, _ in }, withAutoLayout: Bool = false) { + public init(style: Warp.Typography, spanMapper: @escaping HTMLStringUIKitStyleTranslator.SpanMapper = { _, _ in }, withAutoLayout: Bool = false) { self.spanMapper = spanMapper super.init(style: style, withAutoLayout: withAutoLayout) } diff --git a/FinniversKit/Sources/Components/IconCollection/HorizontalIconCollectionViewCell.swift b/FinniversKit/Sources/Components/IconCollection/HorizontalIconCollectionViewCell.swift index b167045932..13c1babbcc 100644 --- a/FinniversKit/Sources/Components/IconCollection/HorizontalIconCollectionViewCell.swift +++ b/FinniversKit/Sources/Components/IconCollection/HorizontalIconCollectionViewCell.swift @@ -7,15 +7,15 @@ import Warp public class HorizontalIconCollectionViewCell: UICollectionViewCell { private static let titleSideMargin = Warp.Spacing.spacing100 - private static let titleStyle = Label.Style.body - private static let bodyStyle = Label.Style.bodyStrong + private static let titleStyle = Warp.Typography.body + private static let bodyStyle = Warp.Typography.bodyStrong static func height(for viewModel: IconCollectionViewModel, withWidth width: CGFloat) -> CGFloat { let imageSize = viewModel.image.size let textWidth = width - imageSize.width - (3 * titleSideMargin) - let titleHeight = viewModel.title?.height(withConstrainedWidth: textWidth, font: titleStyle.font) ?? 0 - let bodyHeight = viewModel.text.height(withConstrainedWidth: textWidth, font: bodyStyle.font) + let titleHeight = viewModel.title?.height(withConstrainedWidth: textWidth, font: titleStyle.uiFont) ?? 0 + let bodyHeight = viewModel.text.height(withConstrainedWidth: textWidth, font: bodyStyle.uiFont) let textHeight = titleHeight + bodyHeight + Warp.Spacing.spacing50 diff --git a/FinniversKit/Sources/Components/IconCollection/VerticalIconCollectionViewCell.swift b/FinniversKit/Sources/Components/IconCollection/VerticalIconCollectionViewCell.swift index 17edde3ba8..882bbc7eab 100644 --- a/FinniversKit/Sources/Components/IconCollection/VerticalIconCollectionViewCell.swift +++ b/FinniversKit/Sources/Components/IconCollection/VerticalIconCollectionViewCell.swift @@ -7,11 +7,11 @@ import Warp public class VerticalIconCollectionViewCell: UICollectionViewCell { private static let textSideMargin = Warp.Spacing.spacing100 - private static let bodyStyle = Label.Style.body + private static let bodyStyle = Warp.Typography.body static func height(for viewModel: IconCollectionViewModel, withWidth width: CGFloat) -> CGFloat { let textWidth = width - (2 * textSideMargin) - let textHeight = viewModel.text.height(withConstrainedWidth: textWidth, font: bodyStyle.font) + let textHeight = viewModel.text.height(withConstrainedWidth: textWidth, font: bodyStyle.uiFont) let imageHeight = viewModel.image.size.height diff --git a/FinniversKit/Sources/Components/Infobox/InfoboxSwiftUIView.swift b/FinniversKit/Sources/Components/Infobox/InfoboxSwiftUIView.swift index 76609fa5fb..317a59c8d5 100644 --- a/FinniversKit/Sources/Components/Infobox/InfoboxSwiftUIView.swift +++ b/FinniversKit/Sources/Components/Infobox/InfoboxSwiftUIView.swift @@ -34,9 +34,9 @@ public struct InfoboxSwiftUIView: View { public var body: some View { VStack(alignment: .center, spacing: Warp.Spacing.spacing200) { Text(viewModel.title) - .finnFont(style.titleStyle) + .font(from: style.titleStyle) Text(viewModel.detail) - .finnFont(style.detailStyle) + .font(from: style.detailStyle) VStack(spacing: Warp.Spacing.spacing50) { primaryButton(for: viewModel) diff --git a/FinniversKit/Sources/Components/Infobox/InfoboxView+Style.swift b/FinniversKit/Sources/Components/Infobox/InfoboxView+Style.swift index 1d033d9538..96ddcd254b 100644 --- a/FinniversKit/Sources/Components/Infobox/InfoboxView+Style.swift +++ b/FinniversKit/Sources/Components/Infobox/InfoboxView+Style.swift @@ -4,6 +4,7 @@ import Foundation import SwiftUI +import Warp public extension InfoboxView { enum Style { @@ -11,7 +12,7 @@ public extension InfoboxView { case normal(backgroundColor: UIColor, primaryButtonIcon: UIImage?) case warning - var titleStyle: Label.Style { + var titleStyle: Warp.Typography { switch self { case .small: return .bodyStrong @@ -22,7 +23,7 @@ public extension InfoboxView { } } - var detailStyle: Label.Style { + var detailStyle: Warp.Typography { switch self { case .small: return .caption diff --git a/FinniversKit/Sources/Components/KeyValueGridView/KeyValueGridView.swift b/FinniversKit/Sources/Components/KeyValueGridView/KeyValueGridView.swift index c4622a2377..174ade3006 100644 --- a/FinniversKit/Sources/Components/KeyValueGridView/KeyValueGridView.swift +++ b/FinniversKit/Sources/Components/KeyValueGridView/KeyValueGridView.swift @@ -14,8 +14,8 @@ public class KeyValueGridView: UIView { // MARK: - Private properties private var data: [KeyValuePair] = [] - private var titleStyle: Label.Style = .body - private var valueStyle: Label.Style = .bodyStrong + private var titleStyle: Warp.Typography = .body + private var valueStyle: Warp.Typography = .bodyStrong private lazy var verticalStackView = UIStackView(axis: .vertical, spacing: Warp.Spacing.spacing200, alignment: .leading, distribution: .equalSpacing, withAutoLayout: true) // MARK: - Initializers @@ -34,8 +34,8 @@ public class KeyValueGridView: UIView { public func configure( with data: [KeyValuePair], - titleStyle: Label.Style = .body, - valueStyle: Label.Style = .bodyStrong + titleStyle: Warp.Typography = .body, + valueStyle: Warp.Typography = .bodyStrong ) { self.data = data self.titleStyle = titleStyle diff --git a/FinniversKit/Sources/Components/Label/Label+Style.swift b/FinniversKit/Sources/Components/Label/Label+Style.swift deleted file mode 100644 index 066babaeaa..0000000000 --- a/FinniversKit/Sources/Components/Label/Label+Style.swift +++ /dev/null @@ -1,46 +0,0 @@ -// -// Copyright © FINN.no AS, Inc. All rights reserved. -// - -import Foundation - -public extension Label { - enum Style { - case title1 - case title2 - case title3 - case bodyStrong - case detailStrong - case body - case captionStrong - case caption - case detail - - public var font: UIFont { - switch self { - case .title1: return UIFont.title1 - case .title2: return UIFont.title2 - case .title3: return UIFont.title3 - case .bodyStrong: return UIFont.bodyStrong - case .detailStrong: return UIFont.detailStrong - case .body: return UIFont.body - case .captionStrong: return UIFont.captionStrong - case .caption: return UIFont.caption - case .detail: return UIFont.detail - } - } - - var padding: UIEdgeInsets { - return UIEdgeInsets(top: lineSpacing, left: 0, bottom: 0, right: 0) - } - - var lineSpacing: CGFloat { - switch self { - case .title1, .title2, .title3: - return font.pointSize * 0.5 - default: - return 0 - } - } - } -} diff --git a/FinniversKit/Sources/Components/Label/Label.swift b/FinniversKit/Sources/Components/Label/Label.swift index 7e8336d076..40c377dbce 100644 --- a/FinniversKit/Sources/Components/Label/Label.swift +++ b/FinniversKit/Sources/Components/Label/Label.swift @@ -3,18 +3,19 @@ // import UIKit +import Warp public class Label: UILabel { // MARK: - Public properties - public private(set) var style: Style? + public private(set) var style: Warp.Typography? public private(set) var isTextCopyable = false // MARK: - Setup public init( - style: Style, + style: Warp.Typography, numberOfLines: Int = 1, textColor: UIColor = .text, withAutoLayout: Bool = false @@ -42,7 +43,7 @@ public class Label: UILabel { isAccessibilityElement = true accessibilityLabel = text - font = style?.font + font = style?.uiFont self.textColor = textColor adjustsFontForContentSizeCategory = true } diff --git a/FinniversKit/Sources/Components/NMPInfobox/NMPInfoboxView.swift b/FinniversKit/Sources/Components/NMPInfobox/NMPInfoboxView.swift index 0333f559f6..21cadd8b5d 100644 --- a/FinniversKit/Sources/Components/NMPInfobox/NMPInfoboxView.swift +++ b/FinniversKit/Sources/Components/NMPInfobox/NMPInfoboxView.swift @@ -52,11 +52,11 @@ public extension NMPInfoboxView { self.secondaryButtonInteraction = secondaryButtonInteraction } - var titleStyle: Label.Style { + var titleStyle: Warp.Typography { .bodyStrong } - var detailStyle: Label.Style { + var detailStyle: Warp.Typography { .body } } @@ -83,9 +83,9 @@ public struct NMPInfoboxView: View { VStack(alignment: .leading, spacing: Warp.Spacing.spacing100) { Text(viewModel.title) - .finnFont(viewModel.titleStyle) + .font(from: viewModel.titleStyle) Text(viewModel.detail) - .finnFont(viewModel.detailStyle) + .font(from: viewModel.detailStyle) if let linkInteraction = viewModel.linkInteraction { SwiftUI.Button( diff --git a/FinniversKit/Sources/Components/NumberedListView/NumberedListView.swift b/FinniversKit/Sources/Components/NumberedListView/NumberedListView.swift index 331dad582e..842ee087c2 100644 --- a/FinniversKit/Sources/Components/NumberedListView/NumberedListView.swift +++ b/FinniversKit/Sources/Components/NumberedListView/NumberedListView.swift @@ -13,7 +13,7 @@ public class NumberedListView: UIView { // MARK: - Private properties - private let numberLabelStyle = Label.Style.bodyStrong + private let numberLabelStyle = Warp.Typography.bodyStrong private lazy var contentStackView = UIStackView(axis: .vertical, spacing: Warp.Spacing.spacing200, withAutoLayout: true) // MARK: - Init @@ -64,7 +64,7 @@ public class NumberedListView: UIView { var largestLabel = CGFloat.zero for number in (1...itemCount) { - let labelWidth = "\(number)".width(withConstrainedHeight: .infinity, font: numberLabelStyle.font) + let labelWidth = "\(number)".width(withConstrainedHeight: .infinity, font: numberLabelStyle.uiFont) if labelWidth > largestLabel { largestLabel = labelWidth } diff --git a/FinniversKit/Sources/Components/QuestionnaireView/QuestionnaireView+Style.swift b/FinniversKit/Sources/Components/QuestionnaireView/QuestionnaireView+Style.swift index 9e72991c3e..8c059939c9 100644 --- a/FinniversKit/Sources/Components/QuestionnaireView/QuestionnaireView+Style.swift +++ b/FinniversKit/Sources/Components/QuestionnaireView/QuestionnaireView+Style.swift @@ -1,19 +1,20 @@ // // Copyright © FINN.no AS. All rights reserved. // +import Warp public extension QuestionnaireView { enum Style { case normal(backgroundColor: UIColor, primaryButtonIcon: UIImage?) - var titleStyle: Label.Style { + var titleStyle: Warp.Typography { switch self { case .normal: return .detail } } - var detailStyle: Label.Style { + var detailStyle: Warp.Typography { switch self { case .normal: return .bodyStrong diff --git a/FinniversKit/Sources/Components/ScrollableTabView/Subviews/ItemCollectionViewCell.swift b/FinniversKit/Sources/Components/ScrollableTabView/Subviews/ItemCollectionViewCell.swift index 1997637964..8a31c4816f 100644 --- a/FinniversKit/Sources/Components/ScrollableTabView/Subviews/ItemCollectionViewCell.swift +++ b/FinniversKit/Sources/Components/ScrollableTabView/Subviews/ItemCollectionViewCell.swift @@ -21,12 +21,12 @@ extension ScrollableTabView { // MARK: - Private properties private lazy var titleLabel = Label(style: Self.labelStyle, withAutoLayout: true) - private static let labelStyle = Label.Style.captionStrong + private static let labelStyle = Warp.Typography.captionStrong private static let indicatorHeight: CGFloat = 4 private static let verticalPadding = Warp.Spacing.spacing100 private static var labelHeight: CGFloat { - "I".height(withConstrainedWidth: .greatestFiniteMagnitude, font: Self.labelStyle.font) + "I".height(withConstrainedWidth: .greatestFiniteMagnitude, font: Self.labelStyle.uiFont) } private lazy var indicatorView: UIView = { diff --git a/FinniversKit/Sources/Components/Switch/SwitchViewStyle.swift b/FinniversKit/Sources/Components/Switch/SwitchViewStyle.swift index 1c74ba5f7b..02adec21c3 100644 --- a/FinniversKit/Sources/Components/Switch/SwitchViewStyle.swift +++ b/FinniversKit/Sources/Components/Switch/SwitchViewStyle.swift @@ -3,11 +3,12 @@ // import UIKit +import Warp public struct SwitchViewStyle { - public let titleLabelStyle: Label.Style + public let titleLabelStyle: Warp.Typography public let titleLabelTextColor: UIColor - public let detailLabelStyle: Label.Style + public let detailLabelStyle: Warp.Typography public let detailLabelTextColor: UIColor public static var `default` = SwitchViewStyle( @@ -17,7 +18,7 @@ public struct SwitchViewStyle { detailLabelTextColor: .textSubtle ) - public init(titleLabelStyle: Label.Style, titleLabelTextColor: UIColor, detailLabelStyle: Label.Style, detailLabelTextColor: UIColor) { + public init(titleLabelStyle: Warp.Typography, titleLabelTextColor: UIColor, detailLabelStyle: Warp.Typography, detailLabelTextColor: UIColor) { self.titleLabelStyle = titleLabelStyle self.titleLabelTextColor = titleLabelTextColor self.detailLabelStyle = detailLabelStyle diff --git a/FinniversKit/Sources/Components/TextField/SwiftUI/FinnTextField.swift b/FinniversKit/Sources/Components/TextField/SwiftUI/FinnTextField.swift index 001b958ad7..e8816ac604 100644 --- a/FinniversKit/Sources/Components/TextField/SwiftUI/FinnTextField.swift +++ b/FinniversKit/Sources/Components/TextField/SwiftUI/FinnTextField.swift @@ -48,7 +48,7 @@ public struct FinnTextField: View { public var body: some View { VStack(alignment: .leading) { Text(placeholder) - .finnFont(.captionStrong) + .font(from: .captionStrong) .foregroundColor(Color.text) TextFieldComponent( @@ -82,7 +82,7 @@ public struct FinnTextField: View { @ViewBuilder private func makeHelpTextLabel() -> some View { let label = Text(helpText ?? "") - .finnFont(.detail) + .font(from: .detail) .foregroundColor(style.helpTextColor) if shouldShowHelpText { diff --git a/FinniversKit/Sources/Components/TextView/SwiftUI/FinnTextView.swift b/FinniversKit/Sources/Components/TextView/SwiftUI/FinnTextView.swift index ef91084124..37b6a05106 100644 --- a/FinniversKit/Sources/Components/TextView/SwiftUI/FinnTextView.swift +++ b/FinniversKit/Sources/Components/TextView/SwiftUI/FinnTextView.swift @@ -26,7 +26,7 @@ public struct FinnTextView: View { if text.isEmpty { Text(placeholderText) .foregroundColor(Color.textDisabled) - .finnFont(.body) + .font(from: .body) .padding(.vertical, Warp.Spacing.spacing100) .padding(.leading, Warp.Spacing.spacing100 + 5) // UITextView.textContainerInset.left + 5 to align with caret .padding(.trailing, Warp.Spacing.spacing100) diff --git a/FinniversKit/Sources/Components/Viewings/ViewingsListView.swift b/FinniversKit/Sources/Components/Viewings/ViewingsListView.swift index 601c6b6b24..3f1457b045 100644 --- a/FinniversKit/Sources/Components/Viewings/ViewingsListView.swift +++ b/FinniversKit/Sources/Components/Viewings/ViewingsListView.swift @@ -10,7 +10,7 @@ public class ViewingsListView: UIView { // MARK: - Private properties - private let titleStyle: Label.Style + private let titleStyle: Warp.Typography private var viewModel: ViewingsListViewModel? private lazy var titleLabel: Label = Label(style: titleStyle, withAutoLayout: true) private lazy var viewingsStackView = UIStackView(axis: .vertical, withAutoLayout: true) @@ -25,7 +25,7 @@ public class ViewingsListView: UIView { // MARK: - Init - public init(titleStyle: Label.Style = .title3, withAutoLayout: Bool = false) { + public init(titleStyle: Warp.Typography = .title3, withAutoLayout: Bool = false) { self.titleStyle = titleStyle super.init(frame: .zero) translatesAutoresizingMaskIntoConstraints = !withAutoLayout diff --git a/FinniversKit/Sources/DNA/Font/Font+SwiftUI.swift b/FinniversKit/Sources/DNA/Font/Font+SwiftUI.swift deleted file mode 100644 index ebe2c17401..0000000000 --- a/FinniversKit/Sources/DNA/Font/Font+SwiftUI.swift +++ /dev/null @@ -1,29 +0,0 @@ -// -// Copyright © 2020 FINN AS. All rights reserved. -// - -import SwiftUI - -extension HTMLText { - public func finnFont(_ style: Label.Style) -> HTMLText { - font(Font.finnFont(style)) - } -} - -extension Text { - public func finnFont(_ style: Label.Style) -> Text { - font(Font.finnFont(style)) - } -} - -extension Font { - public static func finnFont(_ style: Label.Style) -> Font { - Font(style.font) - } -} - -extension View { - public func finnFont(_ style: Label.Style) -> some View { - font(.finnFont(style)) - } -} diff --git a/FinniversKit/Sources/Fullscreen/FavoriteSoldView/FavoriteSoldView.swift b/FinniversKit/Sources/Fullscreen/FavoriteSoldView/FavoriteSoldView.swift index 8a8672a3b4..85edfbf62d 100644 --- a/FinniversKit/Sources/Fullscreen/FavoriteSoldView/FavoriteSoldView.swift +++ b/FinniversKit/Sources/Fullscreen/FavoriteSoldView/FavoriteSoldView.swift @@ -70,14 +70,14 @@ public class FavoriteSoldView: UIView { }() private lazy var titleLabel: Label = { - let style: Label.Style = traitCollection.horizontalSizeClass == .compact ? .title3 : .title2 + let style: Warp.Typography = traitCollection.horizontalSizeClass == .compact ? .title3 : .title2 let label = Label(style: style, withAutoLayout: true) label.numberOfLines = 0 return label }() private lazy var bodyLabel: Label = { - let style: Label.Style = traitCollection.horizontalSizeClass == .compact ? .detail : .body + let style: Warp.Typography = traitCollection.horizontalSizeClass == .compact ? .detail : .body let label = Label(style: style, withAutoLayout: true) label.numberOfLines = 0 return label diff --git a/FinniversKit/Sources/Fullscreen/LoadingView/LoadingSwiftUIView.swift b/FinniversKit/Sources/Fullscreen/LoadingView/LoadingSwiftUIView.swift index 5480c4d945..b502f2115a 100644 --- a/FinniversKit/Sources/Fullscreen/LoadingView/LoadingSwiftUIView.swift +++ b/FinniversKit/Sources/Fullscreen/LoadingView/LoadingSwiftUIView.swift @@ -65,7 +65,7 @@ public struct LoadingSwiftUIView: View { if let message { Text(message) - .finnFont(.bodyStrong) + .font(from: .bodyStrong) .foregroundColor(textColor) } } diff --git a/FinniversKit/Sources/Fullscreen/MessageUserRequired/MessageUserRequiredView.swift b/FinniversKit/Sources/Fullscreen/MessageUserRequired/MessageUserRequiredView.swift index 1524290d4a..9c3b5b5ee1 100644 --- a/FinniversKit/Sources/Fullscreen/MessageUserRequired/MessageUserRequiredView.swift +++ b/FinniversKit/Sources/Fullscreen/MessageUserRequired/MessageUserRequiredView.swift @@ -20,8 +20,8 @@ public class MessageUserRequiredView: UIView { private lazy var messageView: UITextView = { let view = UITextView(withAutoLayout: true) - let style = Label.Style.bodyStrong - view.font = style.font + let style = Warp.Typography.bodyStrong + view.font = style.uiFont view.textColor = .text view.textAlignment = .center view.backgroundColor = .clear diff --git a/FinniversKit/Sources/Recycling/ListViews/Settings/Cell/SettingsViewIconCell.swift b/FinniversKit/Sources/Recycling/ListViews/Settings/Cell/SettingsViewIconCell.swift index db2e8aca90..5b1bfc6518 100644 --- a/FinniversKit/Sources/Recycling/ListViews/Settings/Cell/SettingsViewIconCell.swift +++ b/FinniversKit/Sources/Recycling/ListViews/Settings/Cell/SettingsViewIconCell.swift @@ -10,7 +10,7 @@ struct SettingsViewIconCell: View { var body: some View { HStack(alignment: .center) { Text(title) - .finnFont(.body) + .font(from: .body) .foregroundColor(.text) .padding([.leading]) diff --git a/FinniversKit/Sources/SwiftUI Components/ResultSwiftUIView.swift b/FinniversKit/Sources/SwiftUI Components/ResultSwiftUIView.swift index a0827695d1..07b9832db3 100644 --- a/FinniversKit/Sources/SwiftUI Components/ResultSwiftUIView.swift +++ b/FinniversKit/Sources/SwiftUI Components/ResultSwiftUIView.swift @@ -39,13 +39,13 @@ public struct ResultSwiftUIView: View { .padding(.bottom, Warp.Spacing.spacing100) } Text(title) - .finnFont(.title3) + .font(from: .title3) .foregroundColor(.text) .multilineTextAlignment(.center) .padding(.bottom, Warp.Spacing.spacing50) if let text { Text(text) - .finnFont(.body) + .font(from: .body) .foregroundColor(.text) .multilineTextAlignment(.center) .padding(.bottom, Warp.Spacing.spacing100) diff --git a/FinniversKit/Sources/SwiftUI Components/SwiftUISelectionListItem.swift b/FinniversKit/Sources/SwiftUI Components/SwiftUISelectionListItem.swift index d58037bc30..e36024fc30 100644 --- a/FinniversKit/Sources/SwiftUI Components/SwiftUISelectionListItem.swift +++ b/FinniversKit/Sources/SwiftUI Components/SwiftUISelectionListItem.swift @@ -29,12 +29,12 @@ struct SwiftUISelectionListItem: View { VStack(alignment: .leading) { Text(itemModel.title) - .finnFont(.captionStrong) + .font(from: .captionStrong) .foregroundColor(.text) if let description = itemModel.description { HTMLText(description) - .finnFont(.caption) + .font(from: .caption) .foregroundColor(.textSubtle) } } diff --git a/FinniversKit/Sources/SwiftUI Components/Toast/ToastSwiftUIView+ActionButtonView.swift b/FinniversKit/Sources/SwiftUI Components/Toast/ToastSwiftUIView+ActionButtonView.swift index 6a99709ab8..87051ba2e6 100644 --- a/FinniversKit/Sources/SwiftUI Components/Toast/ToastSwiftUIView+ActionButtonView.swift +++ b/FinniversKit/Sources/SwiftUI Components/Toast/ToastSwiftUIView+ActionButtonView.swift @@ -28,7 +28,7 @@ extension ToastSwiftUIView.ActionButtonView { func makeBody(configuration: Configuration) -> some View { configuration.label - .finnFont(.bodyStrong) + .font(from: .bodyStrong) .padding(.vertical, Warp.Spacing.spacing100) .padding(.horizontal, Warp.Spacing.spacing200) .foregroundColor(.textLink) diff --git a/FinniversKit/Sources/SwiftUI Components/Toast/ToastSwiftUIView.swift b/FinniversKit/Sources/SwiftUI Components/Toast/ToastSwiftUIView.swift index f9c49e2847..4bca562b0c 100644 --- a/FinniversKit/Sources/SwiftUI Components/Toast/ToastSwiftUIView.swift +++ b/FinniversKit/Sources/SwiftUI Components/Toast/ToastSwiftUIView.swift @@ -20,7 +20,7 @@ public struct ToastSwiftUIView: View { HStack(spacing: Warp.Spacing.spacing200) { Image(named: style.imageAsset) Text(text) - .finnFont(.body) + .font(from: .body) .foregroundColor(.text) .padding(.vertical, Warp.Spacing.spacing200) Spacer()