Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply new design for Balance module (#247) #275

Merged
merged 1 commit into from
Dec 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions BankWallet/BankWallet/Modules/Balance/Views/BalanceCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class BalanceCell: UITableViewCell {
roundedBackground.addSubview(nameLabel)
nameLabel.snp.makeConstraints { maker in
maker.leading.equalTo(self.coinIconImageView.snp.trailing).offset(BalanceTheme.cellSmallMargin)
maker.top.equalToSuperview().offset(BalanceTheme.nameTopMargin)
maker.centerY.equalTo(self.coinIconImageView.snp.centerY)
}
nameLabel.font = BalanceTheme.cellTitleFont
nameLabel.textColor = BalanceTheme.cellTitleColor
Expand All @@ -82,30 +82,30 @@ class BalanceCell: UITableViewCell {
roundedBackground.addSubview(rateLabel)
rateLabel.snp.makeConstraints { maker in
maker.leading.equalToSuperview().offset(BalanceTheme.cellBigMargin)
maker.top.equalTo(self.nameLabel.snp.bottom).offset(BalanceTheme.valueTopMargin)
maker.top.equalTo(self.nameLabel.snp.bottom).offset(BalanceTheme.rateTopMargin)
}
rateLabel.font = BalanceTheme.cellSubtitleFont
rateLabel.font = BalanceTheme.rateFont
rateLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
rateLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)

roundedBackground.addSubview(currencyValueLabel)
currencyValueLabel.snp.makeConstraints { maker in
roundedBackground.addSubview(coinValueLabel)
coinValueLabel.snp.makeConstraints { maker in
maker.leading.equalTo(self.refreshButton.snp.trailing).offset(BalanceTheme.cellSmallMargin).priority(.high)
maker.trailing.equalToSuperview().offset(-BalanceTheme.cellBigMargin)
maker.centerY.equalTo(self.nameLabel.snp.centerY)
}
currencyValueLabel.font = BalanceTheme.cellSubtitleFont
currencyValueLabel.textAlignment = .right
coinValueLabel.font = BalanceTheme.coinValueFont
coinValueLabel.textColor = BalanceTheme.coinValueColor
coinValueLabel.textAlignment = .right

roundedBackground.addSubview(coinValueLabel)
coinValueLabel.snp.makeConstraints { maker in
roundedBackground.addSubview(currencyValueLabel)
currencyValueLabel.snp.makeConstraints { maker in
maker.leading.equalTo(self.rateLabel.snp.trailing).offset(BalanceTheme.cellSmallMargin)
maker.bottom.equalTo(self.rateLabel).offset(BalanceTheme.coinLabelVerticalOffset)
maker.trailing.equalToSuperview().offset(-BalanceTheme.cellBigMargin)
maker.centerY.equalTo(self.rateLabel.snp.centerY)
}
coinValueLabel.font = BalanceTheme.cellTitleFont
coinValueLabel.textColor = BalanceTheme.cellTitleColor
coinValueLabel.textAlignment = .right
currencyValueLabel.font = BalanceTheme.currencyValueFont
currencyValueLabel.textAlignment = .right

roundedBackground.addSubview(syncLabel)
syncLabel.snp.makeConstraints { maker in
Expand Down Expand Up @@ -136,7 +136,7 @@ class BalanceCell: UITableViewCell {
roundedBackground.addSubview(receiveButton)
receiveButton.snp.makeConstraints { maker in
maker.leading.equalToSuperview().offset(BalanceTheme.cellSmallMargin)
maker.top.equalTo(self.coinValueLabel.snp.bottom).offset(BalanceTheme.buttonsTopMargin)
maker.top.equalTo(self.nameLabel.snp.bottom).offset(BalanceTheme.buttonsTopMargin)
maker.height.equalTo(BalanceTheme.buttonsHeight)
}
receiveButton.onTap = { [weak self] in self?.receive() }
Expand All @@ -147,7 +147,7 @@ class BalanceCell: UITableViewCell {
roundedBackground.addSubview(payButton)
payButton.snp.makeConstraints { maker in
maker.leading.equalTo(receiveButton.snp.trailing).offset(BalanceTheme.cellSmallMargin)
maker.top.equalTo(self.coinValueLabel.snp.bottom).offset(BalanceTheme.buttonsTopMargin)
maker.top.equalTo(self.nameLabel.snp.bottom).offset(BalanceTheme.buttonsTopMargin)
maker.trailing.equalToSuperview().offset(-BalanceTheme.cellSmallMargin)
maker.height.equalTo(BalanceTheme.buttonsHeight)
maker.width.equalTo(receiveButton)
Expand Down
59 changes: 29 additions & 30 deletions BankWallet/BankWallet/Theme/BalanceTheme.swift
Original file line number Diff line number Diff line change
@@ -1,50 +1,49 @@
import UIKit

class BalanceTheme {
static let amountFont = UIFont.cryptoTitle3
static let headerHeight: CGFloat = 44
static var headerSeparatorBackground: UIColor { return .cryptoSteel20 }
static let amountFont: UIFont = .systemFont(ofSize: 22, weight: .semibold)
static let amountColor = UIColor.cryptoYellow
static let amountColorSyncing = UIColor.cryptoYellow40

static let cellBigMargin: CGFloat = 12
static let cellSmallMargin: CGFloat = 8
static let cellButtonHorizontalMargin: CGFloat = 8
static let expandedCellHeight: CGFloat = 138
static let cellPadding: CGFloat = 8
static let cellHeight: CGFloat = 80

static var roundedBackgroundColor: UIColor { return .crypto_Steel20_White }
static let roundedBackgroundCornerRadius: CGFloat = 15

static let coinIconTintColor = UIColor.cryptoGray
static let spinnerLineWidth: CGFloat = 2
static let coinIconSide: CGFloat = 24

static let cellTitleFont = UIFont.cryptoHeadline
static var cellTitleColor: UIColor { return .crypto_White_Black }
static let cellSubtitleFont = UIFont.cryptoCaption1
static let buttonsTopMargin: CGFloat = 10
static let receiveButtonBackground = UIColor.cryptoGreen
static let buttonsTextColor = UIColor.black
static let selectedButtonsTextColor = UIColor.gray
static let payButtonBackground = UIColor.cryptoYellow
static let buttonsHeight: CGFloat = 50
static let expandedCellHeight: CGFloat = 130
static let cellPadding: CGFloat = 8
static let cellHeight: CGFloat = 72
static let buttonCornerRadius: CGFloat = 12
static let headerHeight: CGFloat = 44
static let buttonsAnimationDuration = 0.2

static let rateTopMargin: CGFloat = 19
static let rateFont = UIFont.cryptoCaption1
static let rateColor = UIColor.cryptoGray
static let rateExpiredColor = UIColor.cryptoGray50

static let spinnerLineWidth: CGFloat = 2
static let spinnerSideSize: CGFloat = 16

static let refreshButtonSize: CGFloat = 32
static let refreshButtonColor: UIColor = .cryptoGray
static let refreshButtonColorHighlighted: UIColor = .cryptoGray50

static var roundedBackgroundColor: UIColor { return .crypto_Steel20_White }
static var headerSeparatorBackground: UIColor { return .cryptoSteel20 }
static let roundedBackgroundCornerRadius: CGFloat = 15
static let cellButtonFont = UIFont.cryptoHeadline

static let rateColor = UIColor.cryptoGray
static let rateExpiredColor = UIColor.cryptoGray50
static let rateSpinnerSize: CGFloat = 18
static let rateSpinnerLeftMargin: CGFloat = 2
static let nonZeroBalanceTextColor = UIColor.cryptoYellow
static let nonZeroBalanceExpiredTextColor = UIColor.cryptoYellow40
static let zeroBalanceTextColor = UIColor.cryptoGray
static let spinnerSideSize: CGFloat = 16
static let coinIconSide: CGFloat = 24
static let nameTopMargin: CGFloat = 10
static let valueTopMargin: CGFloat = 13
static let coinLabelVerticalOffset: CGFloat = 1
static let coinValueFont: UIFont = .systemFont(ofSize: 14)
static let coinValueColor: UIColor = .white

static let currencyValueFont: UIFont = .systemFont(ofSize: 17, weight: .semibold)

static let buttonsTopMargin: CGFloat = 50
static let buttonsHeight: CGFloat = 50
static let buttonCornerRadius: CGFloat = 12
static let buttonsAnimationDuration = 0.2
}