Skip to content

Commit 3c1579b

Browse files
#ui-transation-cell: add note label (#75)
1 parent 0e00914 commit 3c1579b

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

GoMoney/Scences/Home/View/RecentExpenseCell.swift

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ class RecentExpenseCell: UITableViewCell {
1515
lazy var labelName = GMLabel(style: .regularBold)
1616
lazy var labelDate = GMLabel(style: .small)
1717
lazy var labelPrice = GMLabel(style: .regularBold)
18+
lazy var labelNote = {
19+
let lbl = GMLabel(style: .small)
20+
lbl.textAlignment = .right
21+
return lbl
22+
}()
1823

1924
lazy var stackInfo: UIStackView = {
2025
let stackView = UIStackView()
@@ -38,7 +43,7 @@ class RecentExpenseCell: UITableViewCell {
3843

3944
private func setView() {
4045
backgroundColor = K.Color.background
41-
addSubviews(icon, stackInfo, labelPrice)
46+
addSubviews(icon, stackInfo, labelPrice, labelNote)
4247

4348
icon.anchor(left: leftAnchor, paddingLeft: 4)
4449
icon.centerYToView(self)
@@ -54,7 +59,11 @@ class RecentExpenseCell: UITableViewCell {
5459
)
5560

5661
labelPrice.centerYToView(self)
57-
labelPrice.anchor(top: topAnchor, right: rightAnchor, paddingRight: 4)
62+
labelPrice.anchor(right: rightAnchor, paddingRight: 4)
63+
labelNote.anchor(top: labelPrice.bottomAnchor,
64+
right: labelPrice.rightAnchor,
65+
paddingTop: 4,
66+
width: 100)
5867
}
5968

6069
func bindView(transaction: Expense) {
@@ -63,6 +72,7 @@ class RecentExpenseCell: UITableViewCell {
6372
labelDate.text = transaction.getDate(.occuredOn)
6473
let currency = SettingsManager.shared.getValue(for: .currencyUnit)
6574
labelPrice.text = "\(transaction.amount.formatWithCommas()) \(currency)"
75+
labelNote.text = transaction.note
6676
switch transaction.type {
6777
case ExpenseType.income.rawValue:
6878
labelPrice.textColor = K.Color.saving

0 commit comments

Comments
 (0)