Styling transaction section

pull/2/head
Michael Scoff 7 years ago
parent d0aab9391f
commit 6c766a49a2
  1. 4
      Trust.xcodeproj/project.pbxproj
  2. 28
      Trust/Extensions/CALayer.swift
  3. 6
      Trust/Transactions/TransactionsViewController.swift

@ -46,6 +46,7 @@
29336FE71F6B245D005E3BFC /* WelcomeViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29A13E271F6A903500E432A2 /* WelcomeViewModelTests.swift */; };
29358D991F78D1E400925D61 /* SnapshotHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29358D981F78D1E400925D61 /* SnapshotHelper.swift */; };
29358D9F1F78D5B700925D61 /* Screenshots.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29358D9E1F78D5B700925D61 /* Screenshots.swift */; };
29358DA91F79FD1C00925D61 /* CALayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29358DA81F79FD1C00925D61 /* CALayer.swift */; };
293B8B411F707F4600356286 /* TransactionViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 293B8B401F707F4600356286 /* TransactionViewModel.swift */; };
293B8B431F70815900356286 /* BalanceTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 293B8B421F70815900356286 /* BalanceTitleView.swift */; };
293B8B451F70A20200356286 /* TransactionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 293B8B441F70A20200356286 /* TransactionViewCell.swift */; };
@ -174,6 +175,7 @@
29285B411F6FB3E60044CF29 /* SendViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SendViewController.swift; sourceTree = "<group>"; };
29358D981F78D1E400925D61 /* SnapshotHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SnapshotHelper.swift; path = fastlane/SnapshotHelper.swift; sourceTree = SOURCE_ROOT; };
29358D9E1F78D5B700925D61 /* Screenshots.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Screenshots.swift; sourceTree = "<group>"; };
29358DA81F79FD1C00925D61 /* CALayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CALayer.swift; sourceTree = "<group>"; };
293B8B401F707F4600356286 /* TransactionViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionViewModel.swift; sourceTree = "<group>"; };
293B8B421F70815900356286 /* BalanceTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BalanceTitleView.swift; sourceTree = "<group>"; };
293B8B441F70A20200356286 /* TransactionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TransactionViewCell.swift; sourceTree = "<group>"; };
@ -549,6 +551,7 @@
29BE3FCF1F7071A200F6BFC2 /* UIColor.swift */,
29FF12F51F74799D00AFD326 /* NSAttributedString.swift */,
29FF12F71F747D6C00AFD326 /* Error.swift */,
29358DA81F79FD1C00925D61 /* CALayer.swift */,
);
path = Extensions;
sourceTree = "<group>";
@ -989,6 +992,7 @@
291ED08F1F6F613200E7E93A /* GetTransactionRequest.swift in Sources */,
295A59381F71C1B90092F0FC /* AccountsCoordinator.swift in Sources */,
296421971F70C1F200EB363B /* ErrorView.swift in Sources */,
29358DA91F79FD1C00925D61 /* CALayer.swift in Sources */,
29FF12F61F74799D00AFD326 /* NSAttributedString.swift in Sources */,
293B8B431F70815900356286 /* BalanceTitleView.swift in Sources */,
291F52B91F6B880F00B369AB /* EtherKeystore.swift in Sources */,

@ -0,0 +1,28 @@
// Copyright SIX DAY LLC. All rights reserved.
import Foundation
import UIKit
extension CALayer {
func addBorder(edge: UIRectEdge, color: UIColor, thickness: CGFloat) {
let border = CALayer()
switch edge {
case UIRectEdge.top:
border.frame = CGRect.init(x: 0, y: 0, width: frame.width, height: thickness)
break
case UIRectEdge.bottom:
border.frame = CGRect.init(x: 0, y: frame.height - thickness, width: frame.width, height: thickness)
break
case UIRectEdge.left:
border.frame = CGRect.init(x: 0, y: 0, width: thickness, height: frame.height)
break
case UIRectEdge.right:
border.frame = CGRect.init(x: frame.width - thickness, y: 0, width: thickness, height: frame.height)
break
default:
break
}
border.backgroundColor = color.cgColor
self.addSublayer(border)
}
}

@ -228,7 +228,11 @@ extension TransactionsViewController: UITableViewDataSource {
func tableView(_ tableView: UITableView, willDisplayHeaderView view: UIView, forSection section: Int) {
guard let header = view as? UITableViewHeaderFooterView else { return }
header.contentView.backgroundColor = UIColor(hex: "fafafa")
header.textLabel?.textColor = UIColor(hex: "555357")
header.textLabel?.font = UIFont.systemFont(ofSize: 14, weight: UIFontWeightMedium)
header.textLabel?.textColor = Colors.black
header.layer.addBorder(edge: .top, color: UIColor(hex: "e1e1e1"), thickness: 0.5)
header.layer.addBorder(edge: .bottom, color: UIColor(hex: "e1e1e1"), thickness: 0.5)
}
}

Loading…
Cancel
Save