Skip to content

Commit

Permalink
Merge pull request #10 from juandahurt/font
Browse files Browse the repository at this point in the history
feat: add fonts
  • Loading branch information
juandahurt authored Jun 1, 2022
2 parents ec9c82d + 648b6df commit 0e3e157
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
15 changes: 15 additions & 0 deletions Sources/Purace/Styles/PuraceStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,19 @@ public struct PuraceStyle {
public static let G7 = SwiftUI.Color(hex: "D7DCE1") ?? .gray
public static let G8 = SwiftUI.Color(hex: "DFE4E8") ?? .gray
}

public struct Font {
public static func get(size: CGFloat, weight: PuraceTextWeight = .regular) -> SwiftUI.Font {
var fontName = "Poppins-"
switch weight {
case .regular:
fontName += "Regular"
case .medium:
fontName += "Medium"
case .semibold:
fontName += "SemiBold"
}
return .custom(fontName, size: size)
}
}
}
11 changes: 1 addition & 10 deletions Sources/Purace/Views/Basic/Text/PuraceTextView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,7 @@ public struct PuraceTextView: View {
}

private func getFont() -> Font {
var fontName = "Poppins-"
switch weight {
case .regular:
fontName += "Regular"
case .medium:
fontName += "Medium"
case .semibold:
fontName += "SemiBold"
}
return .custom(fontName, size: CGFloat(fontSize))
PuraceStyle.Font.get(size: CGFloat(fontSize), weight: weight)
}

public var body: some View {
Expand Down

0 comments on commit 0e3e157

Please sign in to comment.