mirror of
https://github.com/zhigang1992/GitHawk.git
synced 2026-05-30 04:07:44 +08:00
add styles
This commit is contained in:
@@ -17,9 +17,9 @@ final class NotificationDetailsCell: UICollectionViewCell {
|
||||
|
||||
weak var delegate: NotificationDetailsCellDelegate? = nil
|
||||
|
||||
private let reasonImageView = UIImageView()
|
||||
private let markButton = UIButton(type: .custom)
|
||||
private let dateLabel = UILabel()
|
||||
fileprivate let reasonImageView = UIImageView()
|
||||
fileprivate let markButton = UIButton(type: .custom)
|
||||
fileprivate let dateLabel = UILabel()
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
@@ -47,6 +47,7 @@ extension NotificationDetailsCell: IGListBindable {
|
||||
|
||||
func bindViewModel(_ viewModel: Any) {
|
||||
guard let viewModel = viewModel as? NotificationDetailsViewModel else { return }
|
||||
markButton.isHidden = viewModel.read
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
39
Classes/Views/Styles.swift
Normal file
39
Classes/Views/Styles.swift
Normal file
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// Layout.swift
|
||||
// Freetime
|
||||
//
|
||||
// Created by Ryan Nystrom on 5/12/17.
|
||||
// Copyright © 2017 Ryan Nystrom. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
struct Styles {
|
||||
|
||||
struct Sizes {
|
||||
static let gutter: CGFloat = 15
|
||||
static let icon = CGSize(width: 25, height: 25)
|
||||
static let avatarCornerRadius: CGFloat = 3
|
||||
}
|
||||
|
||||
struct Fonts {
|
||||
static let bodyFont = UIFont.systemFont(ofSize: 17)
|
||||
static let secondaryFont = UIFont.systemFont(ofSize: 17)
|
||||
static let titleFont = UIFont.boldSystemFont(ofSize: 17)
|
||||
}
|
||||
|
||||
struct Colors {
|
||||
static let blue = UIColor.fromHex("0366d6")
|
||||
static let green = UIColor.fromHex("28a745")
|
||||
static let red = UIColor.fromHex("cb2431")
|
||||
|
||||
struct Gray {
|
||||
static let dark = UIColor.fromHex("24292e")
|
||||
static let medium = UIColor.fromHex("586069")
|
||||
static let light = UIColor.fromHex("a3aab1")
|
||||
static let ligher = UIColor.fromHex("fafbfc")
|
||||
static let border = UIColor.fromHex("dfe2e5")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
36
Classes/Views/UIColor+Hex.swift
Normal file
36
Classes/Views/UIColor+Hex.swift
Normal file
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// UIColor+Hex.swift
|
||||
// Freetime
|
||||
//
|
||||
// Created by Ryan Nystrom on 5/12/17.
|
||||
// Copyright © 2017 Ryan Nystrom. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
extension UIColor {
|
||||
|
||||
// http://stackoverflow.com/a/27203691/940936
|
||||
static func fromHex(_ hex: String) -> UIColor {
|
||||
var cString:String = hex.trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
|
||||
|
||||
if (cString.hasPrefix("#")) {
|
||||
cString.remove(at: cString.startIndex)
|
||||
}
|
||||
|
||||
if ((cString.characters.count) != 6) {
|
||||
return UIColor.gray
|
||||
}
|
||||
|
||||
var rgbValue:UInt32 = 0
|
||||
Scanner(string: cString).scanHexInt32(&rgbValue)
|
||||
|
||||
return UIColor(
|
||||
red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0,
|
||||
green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0,
|
||||
blue: CGFloat(rgbValue & 0x0000FF) / 255.0,
|
||||
alpha: CGFloat(1.0)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,6 +25,7 @@
|
||||
297AE8821EC0D5C200B44A1F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 297AE86F1EC0D5C200B44A1F /* LaunchScreen.storyboard */; };
|
||||
297AE8831EC0D5C200B44A1F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 297AE8711EC0D5C200B44A1F /* Main.storyboard */; };
|
||||
299F2A121EC3BCF0006CE9D7 /* GithubSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 299F2A111EC3BCF0006CE9D7 /* GithubSession.swift */; };
|
||||
29A195021EC66B8B00C3E289 /* UIColor+Hex.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29A195011EC66B8B00C3E289 /* UIColor+Hex.swift */; };
|
||||
29C9FDC51EC65FEE00EE3A52 /* Branch.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29C9FDB11EC65FEE00EE3A52 /* Branch.swift */; };
|
||||
29C9FDC61EC65FEE00EE3A52 /* Comment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29C9FDB21EC65FEE00EE3A52 /* Comment.swift */; };
|
||||
29C9FDC71EC65FEE00EE3A52 /* Commit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29C9FDB31EC65FEE00EE3A52 /* Commit.swift */; };
|
||||
@@ -48,6 +49,7 @@
|
||||
29C9FDDB1EC6627200EE3A52 /* NotificationDetailsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29C9FDDA1EC6627200EE3A52 /* NotificationDetailsCell.swift */; };
|
||||
29C9FDDD1EC6628200EE3A52 /* NotificationDetailsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29C9FDDC1EC6628200EE3A52 /* NotificationDetailsViewModel.swift */; };
|
||||
29C9FDDF1EC662E200EE3A52 /* NotificationReason.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29C9FDDE1EC662E200EE3A52 /* NotificationReason.swift */; };
|
||||
29C9FDE11EC667AE00EE3A52 /* Styles.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29C9FDE01EC667AE00EE3A52 /* Styles.swift */; };
|
||||
29F3A3351EC3D2440048865D /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 29F3A3341EC3D2440048865D /* ViewController.swift */; };
|
||||
DD90977AA501F48119302FB5 /* Pods_Freetime.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CB244B0359DB993E361ADAC6 /* Pods_Freetime.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
@@ -85,6 +87,7 @@
|
||||
297AE8721EC0D5C200B44A1F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
297AE8731EC0D5C200B44A1F /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
299F2A111EC3BCF0006CE9D7 /* GithubSession.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GithubSession.swift; sourceTree = "<group>"; };
|
||||
29A195011EC66B8B00C3E289 /* UIColor+Hex.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+Hex.swift"; sourceTree = "<group>"; };
|
||||
29C9FDB11EC65FEE00EE3A52 /* Branch.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Branch.swift; sourceTree = "<group>"; };
|
||||
29C9FDB21EC65FEE00EE3A52 /* Comment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Comment.swift; sourceTree = "<group>"; };
|
||||
29C9FDB31EC65FEE00EE3A52 /* Commit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Commit.swift; sourceTree = "<group>"; };
|
||||
@@ -108,6 +111,7 @@
|
||||
29C9FDDA1EC6627200EE3A52 /* NotificationDetailsCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationDetailsCell.swift; sourceTree = "<group>"; };
|
||||
29C9FDDC1EC6628200EE3A52 /* NotificationDetailsViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationDetailsViewModel.swift; sourceTree = "<group>"; };
|
||||
29C9FDDE1EC662E200EE3A52 /* NotificationReason.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationReason.swift; sourceTree = "<group>"; };
|
||||
29C9FDE01EC667AE00EE3A52 /* Styles.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Styles.swift; sourceTree = "<group>"; };
|
||||
29F3A3341EC3D2440048865D /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||
29F63FD01EC530BD007F55E4 /* Github API.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = "Github API.playground"; sourceTree = "<group>"; };
|
||||
29F63FD11EC530E7007F55E4 /* TextViews.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = TextViews.playground; sourceTree = "<group>"; };
|
||||
@@ -270,6 +274,8 @@
|
||||
297AE86C1EC0D5C200B44A1F /* Views */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
29C9FDE01EC667AE00EE3A52 /* Styles.swift */,
|
||||
29A195011EC66B8B00C3E289 /* UIColor+Hex.swift */,
|
||||
);
|
||||
path = Views;
|
||||
sourceTree = "<group>";
|
||||
@@ -478,10 +484,12 @@
|
||||
29C9FDC91EC65FEE00EE3A52 /* Html.swift in Sources */,
|
||||
29C9FDC71EC65FEE00EE3A52 /* Commit.swift in Sources */,
|
||||
299F2A121EC3BCF0006CE9D7 /* GithubSession.swift in Sources */,
|
||||
29A195021EC66B8B00C3E289 /* UIColor+Hex.swift in Sources */,
|
||||
29C9FDCB1EC65FEE00EE3A52 /* Label.swift in Sources */,
|
||||
29C9FDD31EC65FEE00EE3A52 /* Repository.swift in Sources */,
|
||||
29C9FDD11EC65FEE00EE3A52 /* PullRequest.swift in Sources */,
|
||||
29C9FDD01EC65FEE00EE3A52 /* Permission.swift in Sources */,
|
||||
29C9FDE11EC667AE00EE3A52 /* Styles.swift in Sources */,
|
||||
297AE87C1EC0D5C200B44A1F /* Secrets.swift in Sources */,
|
||||
29C9FDD61EC65FEE00EE3A52 /* Status.swift in Sources */,
|
||||
29F3A3351EC3D2440048865D /* ViewController.swift in Sources */,
|
||||
|
||||
Reference in New Issue
Block a user