Skip to content

Commit

Permalink
Use Warp tokens directly
Browse files Browse the repository at this point in the history
  • Loading branch information
dinsen committed Jul 3, 2024
1 parent 7bce4a4 commit c5bec7f
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//

import SwiftUI
import Warp

public extension NMPInfoboxView {
/**
Expand Down Expand Up @@ -48,30 +49,30 @@ public extension NMPInfoboxView {
var borderColor: Color {
switch self {
case .critical:
warpToken.borderNegative
Warp.Token.borderNegative
case .custom(_, _, let borderColor, _):
borderColor ?? .clear
case .information:
warpToken.borderInfo
Warp.Token.borderInfo
case .success:
warpToken.borderPositive
Warp.Token.borderPositive
case .warning:
warpToken.borderWarning
Warp.Token.borderWarning
}
}

var subtleBorderColor: Color {
switch self {
case .critical:
warpToken.borderNegativeSubtle
Warp.Token.borderNegativeSubtle
case .custom(_, let subtleBorderColor, _, _):
subtleBorderColor ?? .clear
case .information:
warpToken.borderInfoSubtle
Warp.Token.borderInfoSubtle
case .success:
warpToken.borderPositiveSubtle
Warp.Token.borderPositiveSubtle
case .warning:
warpToken.borderWarningSubtle
Warp.Token.borderWarningSubtle
}
}

Expand Down
2 changes: 0 additions & 2 deletions FinniversKit/Sources/Config.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public struct Config {

public let warpColor = Warp.Config.colorProvider
public let warpUIColor = Warp.Config.uiColorProvider
public let warpToken = Warp.Config.tokenProvider
public let warpUIToken = Warp.Config.uiTokenProvider

@objc public extension Bundle {
static var finniversKit: Bundle {
Expand Down
161 changes: 81 additions & 80 deletions FinniversKit/Sources/DNA/Color/UIColor+FinniversKit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,92 +4,93 @@

import UIKit
import SwiftUI
import Warp

// MARK: - Warp colors
extension Color {
public static var background: Color { warpToken.background }
public static var backgroundInfoSubtle: Color { warpToken.backgroundInfoSubtle }
public static var backgroundSubtle: Color { warpToken.backgroundSubtle }
public static var backgroundWarningSubtle: Color { warpToken.backgroundWarningSubtle }
public static var backgroundPositiveSubtle: Color { warpToken.backgroundPositiveSubtle }
public static var backgroundNegativeSubtle: Color { warpToken.backgroundNegativeSubtle }
public static var backgroundNegativeActive: Color { warpToken.backgroundNegativeActive }
public static var backgroundPrimary: Color { warpToken.backgroundPrimary }
public static var backgroundPrimarySubtle: Color { warpToken.backgroundPrimarySubtle }
public static var backgroundPrimaryActive: Color { warpToken.backgroundPrimaryActive }
public static var backgroundDisabled: Color { warpToken.backgroundDisabled }
public static var backgroundNegative: Color { warpToken.backgroundNegative }
public static var backgroundActive: Color { warpToken.backgroundActive }
public static var backgroundPositive: Color { warpToken.backgroundPositive }
public static var text: Color { warpToken.text }
public static var textStatic: Color { warpToken.textStatic }
public static var textSubtle: Color { warpToken.textSubtle }
public static var textInverted: Color { warpToken.textInverted }
public static var textInvertedStatic: Color { warpToken.textInvertedStatic }
public static var textLink: Color { warpToken.textLink }
public static var textDisabled: Color { warpToken.textDisabled }
public static var textNegative: Color { warpToken.textNegative }
public static var border: Color { warpToken.border }
public static var borderActive: Color { warpToken.borderActive }
public static var borderPrimary: Color { warpToken.borderPrimary }
public static var borderPrimarySubtle: Color { warpToken.borderPrimarySubtle }
public static var borderPositive: Color { warpToken.borderPositive }
public static var borderWarning: Color { warpToken.borderWarning }
public static var borderDisabled: Color { warpToken.borderDisabled }
public static var borderFocus: Color { warpToken.borderFocus }
public static var borderNegative: Color { warpToken.borderNegative }
public static var iconPrimary: Color { warpToken.iconPrimary }
public static var iconInverted: Color { warpToken.iconInverted }
public static var iconInvertedStatic: Color { warpToken.iconInvertedStatic }
public static var icon: Color { warpToken.icon }
public static var iconSubtle: Color { warpToken.iconSubtle }
public static var iconSecondary: Color { warpToken.iconSecondary }
public static var iconWarning: Color { warpToken.iconWarning }
public static var surfaceSunken: Color { warpToken.surfaceSunken }
public static var surfaceElevated200: Color { warpToken.surfaceElevated200 }
public static var background: Color { Warp.Token.background }
public static var backgroundInfoSubtle: Color { Warp.Token.backgroundInfoSubtle }
public static var backgroundSubtle: Color { Warp.Token.backgroundSubtle }
public static var backgroundWarningSubtle: Color { Warp.Token.backgroundWarningSubtle }
public static var backgroundPositiveSubtle: Color { Warp.Token.backgroundPositiveSubtle }
public static var backgroundNegativeSubtle: Color { Warp.Token.backgroundNegativeSubtle }
public static var backgroundNegativeActive: Color { Warp.Token.backgroundNegativeActive }
public static var backgroundPrimary: Color { Warp.Token.backgroundPrimary }
public static var backgroundPrimarySubtle: Color { Warp.Token.backgroundPrimarySubtle }
public static var backgroundPrimaryActive: Color { Warp.Token.backgroundPrimaryActive }
public static var backgroundDisabled: Color { Warp.Token.backgroundDisabled }
public static var backgroundNegative: Color { Warp.Token.backgroundNegative }
public static var backgroundActive: Color { Warp.Token.backgroundActive }
public static var backgroundPositive: Color { Warp.Token.backgroundPositive }
public static var text: Color { Warp.Token.text }
public static var textStatic: Color { Warp.Token.textStatic }
public static var textSubtle: Color { Warp.Token.textSubtle }
public static var textInverted: Color { Warp.Token.textInverted }
public static var textInvertedStatic: Color { Warp.Token.textInvertedStatic }
public static var textLink: Color { Warp.Token.textLink }
public static var textDisabled: Color { Warp.Token.textDisabled }
public static var textNegative: Color { Warp.Token.textNegative }
public static var border: Color { Warp.Token.border }
public static var borderActive: Color { Warp.Token.borderActive }
public static var borderPrimary: Color { Warp.Token.borderPrimary }
public static var borderPrimarySubtle: Color { Warp.Token.borderPrimarySubtle }
public static var borderPositive: Color { Warp.Token.borderPositive }
public static var borderWarning: Color { Warp.Token.borderWarning }
public static var borderDisabled: Color { Warp.Token.borderDisabled }
public static var borderFocus: Color { Warp.Token.borderFocus }
public static var borderNegative: Color { Warp.Token.borderNegative }
public static var iconPrimary: Color { Warp.Token.iconPrimary }
public static var iconInverted: Color { Warp.Token.iconInverted }
public static var iconInvertedStatic: Color { Warp.Token.iconInvertedStatic }
public static var icon: Color { Warp.Token.icon }
public static var iconSubtle: Color { Warp.Token.iconSubtle }
public static var iconSecondary: Color { Warp.Token.iconSecondary }
public static var iconWarning: Color { Warp.Token.iconWarning }
public static var surfaceSunken: Color { Warp.Token.surfaceSunken }
public static var surfaceElevated200: Color { Warp.Token.surfaceElevated200 }
}

@objc extension UIColor {
public static var background: UIColor { warpUIToken.background }
public static var backgroundInfoSubtle: UIColor { warpUIToken.backgroundInfoSubtle }
public static var backgroundSubtle: UIColor { warpUIToken.backgroundSubtle }
public static var backgroundWarningSubtle: UIColor { warpUIToken.backgroundWarningSubtle }
public static var backgroundPositiveSubtle: UIColor { warpUIToken.backgroundPositiveSubtle }
public static var backgroundNegativeSubtle: UIColor { warpUIToken.backgroundNegativeSubtle }
public static var backgroundNegativeActive: UIColor { warpUIToken.backgroundNegativeActive }
public static var backgroundPrimary: UIColor { warpUIToken.backgroundPrimary }
public static var backgroundPrimarySubtle: UIColor { warpUIToken.backgroundPrimarySubtle }
public static var backgroundPrimaryActive: UIColor { warpUIToken.backgroundPrimaryActive }
public static var backgroundDisabled: UIColor { warpUIToken.backgroundDisabled }
public static var backgroundNegative: UIColor { warpUIToken.backgroundNegative }
public static var backgroundActive: UIColor { warpUIToken.backgroundActive }
public static var backgroundPositive: UIColor { warpUIToken.backgroundPositive }
public static var text: UIColor { warpUIToken.text }
public static var textStatic: UIColor { warpUIToken.textStatic }
public static var textSubtle: UIColor { warpUIToken.textSubtle }
public static var textInverted: UIColor { warpUIToken.textInverted }
public static var textInvertedStatic: UIColor { warpUIToken.textInvertedStatic }
public static var textLink: UIColor { warpUIToken.textLink }
public static var textDisabled: UIColor { warpUIToken.textDisabled }
public static var textNegative: UIColor { warpUIToken.textNegative }
public static var border: UIColor { warpUIToken.border }
public static var borderActive: UIColor { warpUIToken.borderActive }
public static var borderPrimary: UIColor { warpUIToken.borderPrimary }
public static var borderPrimarySubtle: UIColor { warpUIToken.borderPrimarySubtle }
public static var borderPositive: UIColor { warpUIToken.borderPositive }
public static var borderWarning: UIColor { warpUIToken.borderWarning }
public static var borderDisabled: UIColor { warpUIToken.borderDisabled }
public static var borderFocus: UIColor { warpUIToken.borderFocus }
public static var borderNegative: UIColor { warpUIToken.borderNegative }
public static var iconPrimary: UIColor { warpUIToken.iconPrimary }
public static var iconInverted: UIColor { warpUIToken.iconInverted }
public static var iconInvertedStatic: UIColor { warpUIToken.iconInvertedStatic }
public static var icon: UIColor { warpUIToken.icon }
public static var iconSubtle: UIColor { warpUIToken.iconSubtle }
public static var iconSecondary: UIColor { warpUIToken.iconSecondary }
public static var iconWarning: UIColor { warpUIToken.iconWarning }
public static var surfaceSunken: UIColor { warpUIToken.surfaceSunken }
public static var surfaceElevated200: UIColor { warpUIToken.surfaceElevated200 }
public static var background: UIColor { Warp.UIToken.background }
public static var backgroundInfoSubtle: UIColor { Warp.UIToken.backgroundInfoSubtle }
public static var backgroundSubtle: UIColor { Warp.UIToken.backgroundSubtle }
public static var backgroundWarningSubtle: UIColor { Warp.UIToken.backgroundWarningSubtle }
public static var backgroundPositiveSubtle: UIColor { Warp.UIToken.backgroundPositiveSubtle }
public static var backgroundNegativeSubtle: UIColor { Warp.UIToken.backgroundNegativeSubtle }
public static var backgroundNegativeActive: UIColor { Warp.UIToken.backgroundNegativeActive }
public static var backgroundPrimary: UIColor { Warp.UIToken.backgroundPrimary }
public static var backgroundPrimarySubtle: UIColor { Warp.UIToken.backgroundPrimarySubtle }
public static var backgroundPrimaryActive: UIColor { Warp.UIToken.backgroundPrimaryActive }
public static var backgroundDisabled: UIColor { Warp.UIToken.backgroundDisabled }
public static var backgroundNegative: UIColor { Warp.UIToken.backgroundNegative }
public static var backgroundActive: UIColor { Warp.UIToken.backgroundActive }
public static var backgroundPositive: UIColor { Warp.UIToken.backgroundPositive }
public static var text: UIColor { Warp.UIToken.text }
public static var textStatic: UIColor { Warp.UIToken.textStatic }
public static var textSubtle: UIColor { Warp.UIToken.textSubtle }
public static var textInverted: UIColor { Warp.UIToken.textInverted }
public static var textInvertedStatic: UIColor { Warp.UIToken.textInvertedStatic }
public static var textLink: UIColor { Warp.UIToken.textLink }
public static var textDisabled: UIColor { Warp.UIToken.textDisabled }
public static var textNegative: UIColor { Warp.UIToken.textNegative }
public static var border: UIColor { Warp.UIToken.border }
public static var borderActive: UIColor { Warp.UIToken.borderActive }
public static var borderPrimary: UIColor { Warp.UIToken.borderPrimary }
public static var borderPrimarySubtle: UIColor { Warp.UIToken.borderPrimarySubtle }
public static var borderPositive: UIColor { Warp.UIToken.borderPositive }
public static var borderWarning: UIColor { Warp.UIToken.borderWarning }
public static var borderDisabled: UIColor { Warp.UIToken.borderDisabled }
public static var borderFocus: UIColor { Warp.UIToken.borderFocus }
public static var borderNegative: UIColor { Warp.UIToken.borderNegative }
public static var iconPrimary: UIColor { Warp.UIToken.iconPrimary }
public static var iconInverted: UIColor { Warp.UIToken.iconInverted }
public static var iconInvertedStatic: UIColor { Warp.UIToken.iconInvertedStatic }
public static var icon: UIColor { Warp.UIToken.icon }
public static var iconSubtle: UIColor { Warp.UIToken.iconSubtle }
public static var iconSecondary: UIColor { Warp.UIToken.iconSecondary }
public static var iconWarning: UIColor { Warp.UIToken.iconWarning }
public static var surfaceSunken: UIColor { Warp.UIToken.surfaceSunken }
public static var surfaceElevated200: UIColor { Warp.UIToken.surfaceElevated200 }
}

extension CGColor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//

import UIKit
import Warp

public protocol FavoriteAdsListViewDelegate: AnyObject {
func favoriteAdsListView(_ view: FavoriteAdsListView, didSelectItemAt indexPath: IndexPath)
Expand Down Expand Up @@ -446,7 +447,7 @@ extension FavoriteAdsListView: UITableViewDelegate {
completionHandler(true)
})

commentAction.backgroundColor = warpUIToken.iconStatic
commentAction.backgroundColor = Warp.UIToken.iconStatic

let deleteAction = UIContextualAction(
style: .normal,
Expand Down

0 comments on commit c5bec7f

Please sign in to comment.