Skip to content

Commit

Permalink
Update color and spacing (#409)
Browse files Browse the repository at this point in the history
* update color and spacing

* Update config.yml

* Update config.yml

* Update config.yml
  • Loading branch information
milad-schibsted authored Jul 29, 2024
1 parent 6250fa1 commit 405f4ee
Show file tree
Hide file tree
Showing 68 changed files with 193 additions and 163 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ version: 2
jobs:
build-and-test:
macos:
xcode: "15.0.0"
xcode: "15.4.0"
shell: /bin/bash --login -o pipefail
steps:
- checkout
- run: xcodebuild build test -project 'CharcoalDemo/CharcoalDemo.xcodeproj' -scheme 'CharcoalDemo' -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 14 Pro,OS=16.4' -scmProvider system | xcpretty
- run: xcodebuild build test -project 'CharcoalDemo/CharcoalDemo.xcodeproj' -scheme 'CharcoalDemo' -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 15 Pro,OS=17.5' -scmProvider system | xcpretty

swiftlint:
docker:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/finn-no/FinniversKit.git",
"state" : {
"revision" : "2021c0371174f91c8225e4a621be1f5e87617bd7",
"version" : "134.0.0"
"revision" : "f717edf981afd685282d6d2d92e5d95430b603e8",
"version" : "143.1.0"
}
},
{
Expand All @@ -23,8 +23,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/warp-ds/warp-ios.git",
"state" : {
"revision" : "cad18003de0e0900a152a461c47f48e96c7487d8",
"version" : "0.0.4"
"revision" : "528dc6eacf33b5bb18d094b6154df3071d261620",
"version" : "0.0.16"
}
}
],
Expand Down
4 changes: 2 additions & 2 deletions CharcoalDemo/CharcoalDemo/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

let navigationBarAppearance = UINavigationBar.appearance()
navigationBarAppearance.isTranslucent = false
navigationBarAppearance.tintColor = .textAction
navigationBarAppearance.tintColor = .textLink

let appearance = UINavigationBarAppearance()
appearance.backgroundColor = Theme.mainBackground

appearance.titleTextAttributes = [
.foregroundColor: UIColor.textPrimary,
.foregroundColor: UIColor.text,
.font: UIFont.bodyStrong
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

@testable import Charcoal
import MapKit
import Warp

class MapFilterDemoViewController: DemoViewController {
// MARK: - Private properties
Expand Down Expand Up @@ -33,8 +34,8 @@ class MapFilterDemoViewController: DemoViewController {
NSLayoutConstraint.activate([
mapView.centerYAnchor.constraint(equalTo: view.centerYAnchor),
mapView.heightAnchor.constraint(equalToConstant: 568),
mapView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: .spacingM),
mapView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -.spacingM),
mapView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: Warp.Spacing.spacing200),
mapView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -Warp.Spacing.spacing200),
])
}
}
2 changes: 1 addition & 1 deletion CharcoalDemo/CharcoalDemo/DemoTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class DemoTableViewController: UIViewController {

private lazy var tableView: UITableView = {
let tableView = UITableView(frame: .zero, style: .grouped)
tableView.backgroundColor = .bgPrimary
tableView.backgroundColor = .background
tableView.dataSource = dataSource
tableView.delegate = self
tableView.register(DemoTableViewCell.self)
Expand Down
4 changes: 2 additions & 2 deletions CharcoalDemo/CharcoalDemo/Utils/DemoTableViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class DemoTableViewCell: UITableViewCell {
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
textLabel?.font = .title3
textLabel?.textColor = .textPrimary
textLabel?.textColor = .text
backgroundColor = .clear

let view = UIView(frame: .zero)
Expand All @@ -31,7 +31,7 @@ class DemoTableViewCell: UITableViewCell {

override func setHighlighted(_ highlighted: Bool, animated: Bool) {
super.setHighlighted(highlighted, animated: animated)
selectedBackgroundView?.backgroundColor = UIColor.bgSecondary
selectedBackgroundView?.backgroundColor = .backgroundInfoSubtle
}

override func setSelected(_ selected: Bool, animated: Bool) {
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.
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ let package = Package(
),
],
dependencies: [
.package(url: "https://github.com/finn-no/FinniversKit.git", "134.0.0"..."999.0.0")
.package(url: "https://github.com/finn-no/FinniversKit.git", "143.1.0"..."999.0.0")
],
targets: [
.target(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
//

import UIKit
import Warp

extension UITableViewCell {
func layoutAccessoryView(size: CGFloat = 14) {
guard let accessoryView = accessoryView else {
return
}

let xPosition = bounds.width - size - .spacingXS * 3
let xPosition = bounds.width - size - Warp.Spacing.spacing50 * 3

accessoryView.frame = CGRect(x: xPosition, y: (bounds.height - size) / 2, width: size, height: size)
contentView.frame.size.width = xPosition - .spacingS
contentView.frame.size.width = xPosition - Warp.Spacing.spacing100
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ class FreeTextFilterSearchBar: UISearchBar {
let textFieldAppearanceInRoot = UITextField.appearance(whenContainedInInstancesOf: [AppearanceColoredTableView.self])
textFieldAppearanceInRoot.adjustsFontForContentSizeCategory = true
textFieldAppearanceInRoot.defaultTextAttributes = [
.foregroundColor: UIColor.textAction,
.foregroundColor: UIColor.textLink,
.font: UIFont.bodyRegular,
]

let textFieldAppearanceInSearch = UITextField.appearance(whenContainedInInstancesOf: [FreeTextFilterSearchBar.self])
textFieldAppearanceInRoot.adjustsFontForContentSizeCategory = true
textFieldAppearanceInSearch.defaultTextAttributes = [
.foregroundColor: UIColor.textPrimary,
.foregroundColor: UIColor.text,
.font: UIFont.bodyRegular,
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import FinniversKit
import UIKit
import Warp

public protocol FreeTextFilterDataSource: AnyObject {
func numberOfSuggestions(in freeTextFilterViewController: FreeTextFilterViewController) -> Int
Expand Down Expand Up @@ -250,9 +251,9 @@ private extension FreeTextFilterViewController {
view.addSubview(searchBar)

NSLayoutConstraint.activate([
searchBar.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: .spacingS),
searchBar.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: Warp.Spacing.spacing100),
searchBar.topAnchor.constraint(equalTo: view.topAnchor),
searchBar.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -.spacingS),
searchBar.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -Warp.Spacing.spacing100),

topShadowView.bottomAnchor.constraint(equalTo: searchBar.bottomAnchor),

Expand Down
10 changes: 5 additions & 5 deletions Sources/Charcoal/Filters/Grid/GridFilterCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ final class GridFilterCell: UICollectionViewCell {

private func setupStyles() {
if isSelected {
backgroundColor = .nmpBrandControlSelected
layer.borderColor = UIColor.nmpBrandControlSelected.cgColor
backgroundColor = .backgroundPrimary
layer.borderColor = UIColor.backgroundPrimary.cgColor
titleLabel.font = UIFont.bodyStrong(withSize: 20)
titleLabel.textColor = .textTertiary
titleLabel.textColor = .textInverted
} else {
backgroundColor = Theme.mainBackground
layer.borderColor = UIColor.btnDisabled.cgColor
layer.borderColor = UIColor.backgroundDisabled.cgColor
titleLabel.font = UIFont.bodyRegular(withSize: 20)
titleLabel.textColor = .textPrimary
titleLabel.textColor = .text
}
}
}
7 changes: 4 additions & 3 deletions Sources/Charcoal/Filters/Grid/GridFilterViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//

import FinniversKit
import Warp

public final class GridFilterViewController: FilterViewController {
private lazy var collectionView: UICollectionView = {
Expand All @@ -12,7 +13,7 @@ public final class GridFilterViewController: FilterViewController {
collectionView.allowsMultipleSelection = true
collectionView.dataSource = self
collectionView.delegate = self
collectionView.contentInset = UIEdgeInsets(top: .spacingM, left: edgeInset, bottom: 0, right: edgeInset)
collectionView.contentInset = UIEdgeInsets(top: Warp.Spacing.spacing200, left: edgeInset, bottom: 0, right: edgeInset)
collectionView.register(GridFilterCell.self)
return collectionView
}()
Expand Down Expand Up @@ -98,15 +99,15 @@ extension GridFilterViewController: UICollectionViewDelegateFlowLayout {
layout collectionViewLayout: UICollectionViewLayout,
sizeForItemAt indexPath: IndexPath) -> CGSize {
let numberOfItemsPerRow: CGFloat = 5
let side = ((collectionView.frame.width - edgeInset * 2) / numberOfItemsPerRow) - .spacingS
let side = ((collectionView.frame.width - edgeInset * 2) / numberOfItemsPerRow) - Warp.Spacing.spacing100

return CGSize(width: side, height: side)
}

public func collectionView(_ collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return .spacingS
return Warp.Spacing.spacing100
}

public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
Expand Down
11 changes: 6 additions & 5 deletions Sources/Charcoal/Filters/Inline/InlineFilterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//

import UIKit
import Warp

protocol InlineFilterViewDelegate: AnyObject {
func inlineFilterView(_ inlineFilteView: InlineFilterView, didChange segment: Segment, at index: Int)
Expand All @@ -14,7 +15,7 @@ final class InlineFilterView: UIView {
weak var delegate: InlineFilterViewDelegate?

override var intrinsicContentSize: CGSize {
return CGSize(width: collectionView.bounds.width, height: InlineSegmentCell.cellHeight + .spacingM)
return CGSize(width: collectionView.bounds.width, height: InlineSegmentCell.cellHeight + Warp.Spacing.spacing200)
}

// MARK: - Private properties
Expand All @@ -29,7 +30,7 @@ final class InlineFilterView: UIView {
collectionView.showsHorizontalScrollIndicator = false
collectionView.dataSource = self
collectionView.delegate = self
collectionView.contentInset = UIEdgeInsets(top: 0, leading: .spacingM, bottom: 0, trailing: .spacingM)
collectionView.contentInset = UIEdgeInsets(top: 0, leading: Warp.Spacing.spacing200, bottom: 0, trailing: Warp.Spacing.spacing200)
collectionView.register(InlineSegmentCell.self)
collectionView.translatesAutoresizingMaskIntoConstraints = false
return collectionView
Expand Down Expand Up @@ -118,13 +119,13 @@ extension InlineFilterView: UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
minimumInteritemSpacingForSectionAt section: Int) -> CGFloat {
return .spacingS
return Warp.Spacing.spacing100
}

func collectionView(_ collectionView: UICollectionView,
layout collectionViewLayout: UICollectionViewLayout,
minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return .spacingS
return Warp.Spacing.spacing100
}
}

Expand All @@ -133,7 +134,7 @@ extension InlineFilterView: UICollectionViewDelegateFlowLayout {
private extension InlineFilterView {
func setup() {
addSubview(collectionView)
collectionView.fillInSuperview(insets: UIEdgeInsets(top: .spacingS, leading: 0, bottom: -.spacingS, trailing: 0))
collectionView.fillInSuperview(insets: UIEdgeInsets(top: Warp.Spacing.spacing100, leading: 0, bottom: -Warp.Spacing.spacing100, trailing: 0))
collectionView.heightAnchor.constraint(equalToConstant: InlineSegmentCell.cellHeight).isActive = true
}

Expand Down
11 changes: 6 additions & 5 deletions Sources/Charcoal/Filters/Inline/SegmentButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//

import UIKit
import Warp

extension SegmentButton {
enum BorderStyle {
Expand All @@ -15,7 +16,7 @@ protocol SegmentButtonDelegate: AnyObject {
}

final class SegmentButton: UIButton {
static let borderColor: UIColor = .btnDisabled
static let borderColor: UIColor = .backgroundDisabled
static let borderWidth: CGFloat = 1.5

weak var delegate: SegmentButtonDelegate?
Expand All @@ -29,7 +30,7 @@ final class SegmentButton: UIButton {

private var borderLayer = CAShapeLayer()
private var maskLayer = CAShapeLayer()
private var selectedBackgroundColor: UIColor = .nmpBrandControlSelected
private var selectedBackgroundColor: UIColor = .backgroundPrimary

init(title: String) {
super.init(frame: .zero)
Expand Down Expand Up @@ -57,10 +58,10 @@ private extension SegmentButton {
titleLabel?.adjustsFontForContentSizeCategory = true

setTitle(title, for: .normal)
setTitleColor(.textPrimary, for: .normal)
setTitleColor(.textTertiary, for: .selected)
setTitleColor(.text, for: .normal)
setTitleColor(.textInverted, for: .selected)
backgroundColor = Theme.mainBackground
contentEdgeInsets = UIEdgeInsets(top: 0, leading: .spacingM, bottom: 0, trailing: .spacingM)
contentEdgeInsets = UIEdgeInsets(top: 0, leading: Warp.Spacing.spacing200, bottom: 0, trailing: Warp.Spacing.spacing200)

borderLayer.lineWidth = SegmentButton.borderWidth
borderLayer.fillColor = UIColor.clear.cgColor
Expand Down
5 changes: 3 additions & 2 deletions Sources/Charcoal/Filters/List/ListFilterViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//

import FinniversKit
import Warp

public final class ListFilterViewController: FilterViewController {
private enum Section: Int {
Expand Down Expand Up @@ -107,9 +108,9 @@ public final class ListFilterViewController: FilterViewController {
topShadowViewBottomAnchor.isActive = false

let searchBarConstraints = [
searchBar.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: .spacingS),
searchBar.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: Warp.Spacing.spacing100),
searchBar.topAnchor.constraint(equalTo: view.topAnchor),
searchBar.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -.spacingS),
searchBar.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -Warp.Spacing.spacing100),

topShadowView.bottomAnchor.constraint(equalTo: searchBar.bottomAnchor),
tableView.topAnchor.constraint(equalTo: searchBar.bottomAnchor),
Expand Down
5 changes: 3 additions & 2 deletions Sources/Charcoal/Filters/List/Views/ListFilterCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//

import FinniversKit
import Warp

final class ListFilterCell: CheckboxTableViewCell {
private lazy var checkboxImageView = ListFilterImageView(withAutoLayout: true)
Expand Down Expand Up @@ -89,7 +90,7 @@ final class ListFilterCell: CheckboxTableViewCell {

switch viewModel.checkboxStyle {
case .selectedBordered:
checkboxImageView.tintColor = .nmpBrandControlSelected
checkboxImageView.tintColor = .backgroundPrimary
checkboxImageView.setImage(UIImage(named: .checkboxBordered).withRenderingMode(.alwaysTemplate), for: .normal)
checkboxImageView.setImage(UIImage(named: .checkboxBorderedDisabled), for: .disabled)
case .selectedFilled:
Expand Down Expand Up @@ -151,7 +152,7 @@ final class ListFilterCell: CheckboxTableViewCell {

private func detailLabelConstraint(constantFor accessoryStyle: ListFilterCellViewModel.AccessoryStyle) -> CGFloat {
guard accessoryStyle == .chevron else { return 0 }
return -.spacingS
return -Warp.Spacing.spacing100
}

private func showSelectedBackground(_ show: Bool) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ extension MapPolygonFilterViewController: MKMapViewDelegate {
}
polygon.fillColor = state != .invalidPolygon ?
MapPolygonFilterView.overlayColor.withAlphaComponent(validPolygonAlphaComponent) :
UIColor.textCritical.withAlphaComponent(invalidPolygonAlphaComponent)
UIColor.textNegative.withAlphaComponent(invalidPolygonAlphaComponent)
polygon.lineWidth = 2

// MapKit renders overlays as vectors by default from iOS 13, but we are opting out of it.
Expand Down
13 changes: 7 additions & 6 deletions Sources/Charcoal/Filters/Map/Polygon/Views/InfoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@

import FinniversKit
import Foundation
import Warp

class InfoView: UIView {
// MARK: - Subviews

private lazy var boxView: UIView = {
let view = UIView(withAutoLayout: true)
view.backgroundColor = .bgPrimary
view.layer.cornerRadius = .spacingM
view.backgroundColor = .background
view.layer.cornerRadius = Warp.Spacing.spacing200

view.dropShadow(color: .black, opacity: 0.2, offset: CGSize(width: 0, height: 1), radius: 5)
return view
Expand Down Expand Up @@ -46,10 +47,10 @@ class InfoView: UIView {
boxView.fillInSuperview()

NSLayoutConstraint.activate([
label.topAnchor.constraint(equalTo: boxView.topAnchor, constant: .spacingS),
label.leadingAnchor.constraint(equalTo: boxView.leadingAnchor, constant: .spacingXL),
label.trailingAnchor.constraint(equalTo: boxView.trailingAnchor, constant: -.spacingXL),
label.bottomAnchor.constraint(equalTo: boxView.bottomAnchor, constant: -.spacingS),
label.topAnchor.constraint(equalTo: boxView.topAnchor, constant: Warp.Spacing.spacing100),
label.leadingAnchor.constraint(equalTo: boxView.leadingAnchor, constant: Warp.Spacing.spacing400),
label.trailingAnchor.constraint(equalTo: boxView.trailingAnchor, constant: -Warp.Spacing.spacing400),
label.bottomAnchor.constraint(equalTo: boxView.bottomAnchor, constant: -Warp.Spacing.spacing100),
])
}

Expand Down
Loading

0 comments on commit 405f4ee

Please sign in to comment.