Skip to content

Commit

Permalink
feat(Fonts): IOS-9162 Update token weights for native components (#288)
Browse files Browse the repository at this point in the history
* IOS-9162 Updated font weights from mistica-design.

* IOS-9162 Updated font weight in some components still using medium weight.
  • Loading branch information
idenjoe authored Jul 24, 2023
1 parent 13556ea commit c926e4a
Show file tree
Hide file tree
Showing 46 changed files with 26 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Sources/Mistica/Components/Badge/NovumBarButtonItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public func createNovumTabBarItem(badgeValue: UInt = 0) -> UITabBarItem {
}

let badgeTextAttributes = [
NSAttributedString.Key.font: UIFont.textPreset1(weight: .medium),
NSAttributedString.Key.font: UIFont.textPreset1(weight: .indicator),
NSAttributedString.Key.foregroundColor: UIColor.textPrimaryInverse
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private extension Button.Style {
OverriddenSizes(
insets: Constants.insets,
minimumWidth: Constants.minimumWidth,
font: .textPreset3(weight: .medium)
font: .textPreset3(weight: .link)
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public extension UINavigationBar {
}

class var misticaTitleTextAttributes: [NSAttributedString.Key: Any] {
textAttributes(for: .textPreset4(weight: .medium, constrainedToPreferredSize: .large), color: UIColor.textNavigationBarPrimary)
textAttributes(for: .textPreset4(weight: .navigationBar, constrainedToPreferredSize: .large), color: UIColor.textNavigationBarPrimary)
}

func applyMisticaStyle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ private extension LoadErrorViewController {
}

func setUpTitleText() {
titleTextLabel.font = .textPreset4(weight: .medium)
titleTextLabel.font = .textPreset4(weight: .cardTitle)
titleTextLabel.textColor = .textPrimary
titleTextLabel.textAlignment = .center
titleTextLabel.numberOfLines = 0
titleTextLabel.text = titleText
}

func setUpDescriptionText() {
descriptionLabel.font = .textPreset3(weight: .medium)
descriptionLabel.font = .textPreset3(weight: .regular)
descriptionLabel.textColor = .textSecondary
descriptionLabel.textAlignment = .center
descriptionLabel.numberOfLines = 0
Expand Down
4 changes: 2 additions & 2 deletions Sources/MisticaCommon/Controls/MisticaAppearance.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,11 @@ private extension MisticaAppearance {

let normalTextAttributes = [
NSAttributedString.Key.foregroundColor: textColor,
NSAttributedString.Key.font: UIFont.textPreset2(weight: .medium)
NSAttributedString.Key.font: UIFont.textPreset2(weight: .tabsLabel)
]
let selectedTextAttributes = [
NSAttributedString.Key.foregroundColor: selectedTextColor,
NSAttributedString.Key.font: UIFont.textPreset2(weight: .medium)
NSAttributedString.Key.font: UIFont.textPreset2(weight: .tabsLabel)
]

segmentedControlAppearance.setTitleTextAttributes(normalTextAttributes, for: .normal)
Expand Down
2 changes: 2 additions & 0 deletions Sources/MisticaCommon/Fonts/Brands/BlauFontWeights.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import Foundation
struct BlauFontWeights: MisticaFontWeights {
public var cardTitle: MisticaFontWeightType = .regular
public var button: MisticaFontWeightType = .medium
public var tabsLabel: MisticaFontWeightType = .medium
public var link: MisticaFontWeightType = .medium
public var title1: MisticaFontWeightType = .medium
public var indicator: MisticaFontWeightType = .medium
public var navigationBar: MisticaFontWeightType = .medium
public var text5: MisticaFontWeightType = .light
public var text6: MisticaFontWeightType = .light
public var text7: MisticaFontWeightType = .light
Expand Down
2 changes: 2 additions & 0 deletions Sources/MisticaCommon/Fonts/Brands/MovistarFontWeights.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import Foundation
struct MovistarFontWeights: MisticaFontWeights {
public var cardTitle: MisticaFontWeightType = .bold
public var button: MisticaFontWeightType = .medium
public var tabsLabel: MisticaFontWeightType = .medium
public var link: MisticaFontWeightType = .medium
public var title1: MisticaFontWeightType = .medium
public var indicator: MisticaFontWeightType = .medium
public var navigationBar: MisticaFontWeightType = .medium
public var text5: MisticaFontWeightType = .bold
public var text6: MisticaFontWeightType = .bold
public var text7: MisticaFontWeightType = .bold
Expand Down
2 changes: 2 additions & 0 deletions Sources/MisticaCommon/Fonts/Brands/O2FontWeights.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import Foundation
struct O2FontWeights: MisticaFontWeights {
public var cardTitle: MisticaFontWeightType = .regular
public var button: MisticaFontWeightType = .medium
public var tabsLabel: MisticaFontWeightType = .medium
public var link: MisticaFontWeightType = .medium
public var title1: MisticaFontWeightType = .medium
public var indicator: MisticaFontWeightType = .medium
public var navigationBar: MisticaFontWeightType = .medium
public var text5: MisticaFontWeightType = .light
public var text6: MisticaFontWeightType = .light
public var text7: MisticaFontWeightType = .light
Expand Down
2 changes: 2 additions & 0 deletions Sources/MisticaCommon/Fonts/Brands/VivoFontWeights.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import Foundation
struct VivoFontWeights: MisticaFontWeights {
public var cardTitle: MisticaFontWeightType = .regular
public var button: MisticaFontWeightType = .medium
public var tabsLabel: MisticaFontWeightType = .medium
public var link: MisticaFontWeightType = .medium
public var title1: MisticaFontWeightType = .medium
public var indicator: MisticaFontWeightType = .medium
public var navigationBar: MisticaFontWeightType = .medium
public var text5: MisticaFontWeightType = .light
public var text6: MisticaFontWeightType = .light
public var text7: MisticaFontWeightType = .light
Expand Down
2 changes: 2 additions & 0 deletions Sources/MisticaCommon/Fonts/Brands/VivoNewFontWeights.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import Foundation
struct VivoNewFontWeights: MisticaFontWeights {
public var cardTitle: MisticaFontWeightType = .regular
public var button: MisticaFontWeightType = .regular
public var tabsLabel: MisticaFontWeightType = .regular
public var link: MisticaFontWeightType = .regular
public var title1: MisticaFontWeightType = .regular
public var indicator: MisticaFontWeightType = .regular
public var navigationBar: MisticaFontWeightType = .regular
public var text5: MisticaFontWeightType = .regular
public var text6: MisticaFontWeightType = .regular
public var text7: MisticaFontWeightType = .regular
Expand Down
9 changes: 6 additions & 3 deletions Sources/MisticaCommon/Fonts/FontStyle+Weights.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public extension FontStyle {
}

enum TextPreset2Weight: CaseIterable {
case regular, medium, button, indicator, link
case regular, medium, button, indicator, link, tabsLabel

var value: MisticaFontWeightType {
switch self {
Expand All @@ -34,32 +34,35 @@ public extension FontStyle {
case .button: return MisticaConfig.currentFontWeights.button
case .indicator: return MisticaConfig.currentFontWeights.indicator
case .link: return MisticaConfig.currentFontWeights.link
case .tabsLabel: return MisticaConfig.currentFontWeights.tabsLabel
}
}
}

enum TextPreset3Weight: CaseIterable {
case light, regular, medium, button
case light, regular, medium, button, link

var value: MisticaFontWeightType {
switch self {
case .light: return .light
case .regular: return .regular
case .medium: return .medium
case .button: return MisticaConfig.currentFontWeights.button
case .link: return MisticaConfig.currentFontWeights.link
}
}
}

enum TextPreset4Weight: CaseIterable {
case light, regular, medium, cardTitle
case light, regular, medium, cardTitle, navigationBar

var value: MisticaFontWeightType {
switch self {
case .light: return .light
case .regular: return .regular
case .medium: return .medium
case .cardTitle: return MisticaConfig.currentFontWeights.cardTitle
case .navigationBar: return MisticaConfig.currentFontWeights.navigationBar
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions Sources/MisticaCommon/Fonts/MisticaFontWeights.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import UIKit
public protocol MisticaFontWeights {
var cardTitle: MisticaFontWeightType { get }
var button: MisticaFontWeightType { get }
var tabsLabel: MisticaFontWeightType { get }
var link: MisticaFontWeightType { get }
var title1: MisticaFontWeightType { get }
var indicator: MisticaFontWeightType { get }
var navigationBar: MisticaFontWeightType { get }
var text5: MisticaFontWeightType { get }
var text6: MisticaFontWeightType { get }
var text7: MisticaFontWeightType { get }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private var hiddenTitleTextAttributes: [NSAttributedString.Key: Any] {

private var misticaTitleTextAttributes: [NSAttributedString.Key: Any] {
textAttributes(
for: .textPreset4(weight: .medium, constrainedToPreferredSize: .large),
for: .textPreset4(weight: .navigationBar, constrainedToPreferredSize: .large),
color: .textNavigationBarPrimary
)
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c926e4a

Please sign in to comment.