Skip to content

Commit

Permalink
Use component tokens for button (#1368)
Browse files Browse the repository at this point in the history
* Use component tokens for button

* Update more colors

* Change color

* Update colors

* Update Warp

* Fix tests

---------

Co-authored-by: Milad Ajilianabbasi <[email protected]>
  • Loading branch information
mohsen-schibsted and milad-schibsted authored Aug 7, 2024
1 parent e72e3d4 commit 87e2733
Show file tree
Hide file tree
Showing 16 changed files with 16 additions and 16 deletions.
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.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/warp-ds/warp-ios.git",
"state" : {
"revision" : "47cdf208cbaa44b76713da510046a7d935eb978e",
"version" : "0.0.17"
"revision" : "ae6d80f9fd3477ebf487cc060306697b557cc532",
"version" : "0.0.22"
}
}
],
Expand Down
10 changes: 5 additions & 5 deletions FinniversKit/Sources/Base Components/ButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public struct InlineFlatStyle: ButtonStyle {
private let font: Font
private let textColor: Color

public init(size: Button.Size = .normal, textColor: Color = .backgroundPrimary) {
public init(size: Button.Size = .normal, textColor: Color = .textLink) {
self.font = size == .normal ? .finnFont(.bodyStrong) : .finnFont(.detailStrong)
self.textColor = textColor
}
Expand All @@ -31,7 +31,7 @@ public struct FlatStyle: ButtonStyle {

public init(
size: Button.Size = .normal,
textColor: Color = .backgroundPrimary,
textColor: Color = .textLink,
fullWidth: Bool = true,
padding: EdgeInsets = .init(top: Warp.Spacing.spacing100, leading: Warp.Spacing.spacing200, bottom: Warp.Spacing.spacing100, trailing: Warp.Spacing.spacing200)
) {
Expand Down Expand Up @@ -66,7 +66,7 @@ public struct DefaultStyle: ButtonStyle {

public init(
size: Button.Size = .normal,
textColor: Color = .backgroundPrimary,
textColor: Color = .textLink,
fullWidth: Bool = true,
padding: EdgeInsets = .init(top: Warp.Spacing.spacing100, leading: Warp.Spacing.spacing200, bottom: Warp.Spacing.spacing100, trailing: Warp.Spacing.spacing200)
) {
Expand Down Expand Up @@ -97,7 +97,7 @@ public struct DefaultStyle: ButtonStyle {
.cornerRadius(Warp.Spacing.spacing100)
.roundedBorder(
radius: Warp.Spacing.spacing100,
color: configuration.isPressed ? .borderActive : .backgroundDisabled
color: configuration.isPressed ? .borderActive : .borderDisabled
)
}
}
Expand All @@ -111,7 +111,7 @@ public struct CallToAction: ButtonStyle {

public init(
size: Button.Size = .normal,
background: Color = .backgroundPrimary,
background: Color = Warp.Color.buttonPrimaryBackground,
fullWidth: Bool = true,
isEnabled: Binding<Bool>? = nil,
padding: EdgeInsets? = nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,12 @@ public extension Button.Style {
stateStyles: [
.normal: Button.StateStyle(
textColor: .textInverted,
backgroundColor: .backgroundPrimary,
backgroundColor: Warp.UIColor.buttonPrimaryBackground,
borderColor: nil
),
.highlighted: Button.StateStyle(
textColor: nil,
backgroundColor: .backgroundPrimaryActive,
backgroundColor: Warp.UIColor.buttonPrimaryBackgroundActive,
borderColor: nil
),
.disabled: Button.StateStyle(
Expand Down
2 changes: 1 addition & 1 deletion FinniversKit/Sources/Components/Panel/Panel+Style.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extension Panel {
switch self {
case .plain: return .background
case .info: return .backgroundInfoSubtle
case .tips: return Warp.UIColor.badgeSponsoredBackground
case .tips: return .backgroundInfoSubtle
case .newFunctionality: return .backgroundPositiveSubtle
case .success: return .backgroundPositiveSubtle
case .warning: return .backgroundWarningSubtle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ final class SelectionOptionCell: UITableViewCell {

private func setup() {
isAccessibilityElement = true
backgroundColor = .background
backgroundColor = .clear
setDefaultSelectedBackgound()
hideCheckmark(true)

Expand All @@ -94,10 +94,10 @@ final class SelectionOptionCell: UITableViewCell {
}

private func hideCheckmark(_ hide: Bool) {
iconImageView.tintColor = hide ? .iconPrimary : .backgroundPrimary
iconImageView.tintColor = hide ? .icon : .iconPrimary

titleLabel.font = hide ? .body : .bodyStrong
titleLabel.textColor = iconImageView.tintColor
titleLabel.textColor = hide ? .text : .textLink

checkmarkImageView.isHidden = hide
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public final class SelectionView: UIView {
tableView.translatesAutoresizingMaskIntoConstraints = false
tableView.delegate = self
tableView.dataSource = self
tableView.backgroundColor = .background
tableView.backgroundColor = .clear
tableView.rowHeight = SelectionView.rowHeight
tableView.estimatedRowHeight = SelectionView.rowHeight
tableView.separatorInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class SettingsView: UIView {

lazy var tableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .grouped)
tableView.backgroundColor = .background
tableView.backgroundColor = .surfaceSunken
tableView.separatorStyle = .none
tableView.dataSource = self
tableView.delegate = self
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/warp-ds/warp-ios.git", "0.0.17"..."999.0.0")
.package(url: "https://github.com/warp-ds/warp-ios.git", "0.0.22"..."999.0.0")
],
targets: [
.target(
Expand Down

0 comments on commit 87e2733

Please sign in to comment.