-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: 고객10명추가 버튼, 초기화 버튼을 view에 추가 * feat: businessHoursLabel를 view에 추가 * feat: waitLabel, workLabel을 BankView에 추가 * feat: CustomView 구현 * feat: customerStackView, waitStackView, workStackView view에 추가 * feat: baseStackView 구현 및 레이아웃 설정 * feat: CustomerView layout 설정 * refactor: baseStackView layout 조정, businessHoursLabel 컬러 변경 Co-authored-by: dudu <whqtkf12@naver.com>
- Loading branch information
1 parent
fdba3d7
commit d42c955
Showing
4 changed files
with
195 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
131 changes: 131 additions & 0 deletions
131
BankManagerUIApp/BankManagerUIApp/BankController/BankView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
// | ||
// BankView.swift | ||
// BankManagerUIApp | ||
// | ||
// Created by Eddy, dudu. | ||
// | ||
|
||
import UIKit | ||
|
||
class BankView: UIView { | ||
private lazy var baseStackView: UIStackView = { | ||
let stackView = UIStackView(arrangedSubviews: [ | ||
buttonStackView, | ||
businessHoursLabel, | ||
workStateStackView, | ||
customerStackView]) | ||
|
||
stackView.axis = .vertical | ||
stackView.spacing = 15 | ||
|
||
return stackView | ||
}() | ||
|
||
private lazy var buttonStackView: UIStackView = { | ||
let stackView = UIStackView(arrangedSubviews: [addCustomerbutton, resetButton]) | ||
stackView.distribution = .fillEqually | ||
|
||
return stackView | ||
}() | ||
|
||
private lazy var addCustomerbutton: UIButton = { | ||
let button = UIButton() | ||
button.setTitle("고객 10명 추가", for: .normal) | ||
button.setTitleColor(.systemBlue, for: .normal) | ||
|
||
return button | ||
}() | ||
|
||
private lazy var resetButton: UIButton = { | ||
let button = UIButton() | ||
button.setTitle("초기화", for: .normal) | ||
button.setTitleColor(.systemRed, for: .normal) | ||
|
||
return button | ||
}() | ||
|
||
private lazy var businessHoursLabel: UILabel = { | ||
let label = UILabel() | ||
label.text = "업무시간 - 00:00:000" | ||
label.textAlignment = .center | ||
label.font = .preferredFont(forTextStyle: .title3) | ||
|
||
return label | ||
}() | ||
|
||
private lazy var workStateStackView: UIStackView = { | ||
let stackView = UIStackView(arrangedSubviews: [waitLabel, workLabel]) | ||
stackView.distribution = .fillEqually | ||
|
||
return stackView | ||
}() | ||
|
||
private lazy var waitLabel: UILabel = { | ||
let label = UILabel() | ||
label.text = "대기중" | ||
label.textAlignment = .center | ||
label.textColor = .white | ||
label.font = .preferredFont(forTextStyle: .title1) | ||
label.backgroundColor = .systemGreen | ||
|
||
return label | ||
}() | ||
|
||
private lazy var workLabel: UILabel = { | ||
let label = UILabel() | ||
label.text = "업무중" | ||
label.textAlignment = .center | ||
label.textColor = .white | ||
label.font = .preferredFont(forTextStyle: .title1) | ||
label.backgroundColor = .systemIndigo | ||
|
||
return label | ||
}() | ||
|
||
private lazy var customerStackView: UIStackView = { | ||
let stackView = UIStackView(arrangedSubviews: [waitStackView, workStackView]) | ||
|
||
return stackView | ||
}() | ||
|
||
private lazy var waitStackView: UIStackView = { | ||
let stackView = UIStackView() | ||
stackView.axis = .vertical | ||
|
||
return stackView | ||
}() | ||
|
||
private lazy var workStackView: UIStackView = { | ||
let stackView = UIStackView() | ||
stackView.axis = .vertical | ||
|
||
return stackView | ||
}() | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
layout() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
} | ||
|
||
// MARK: - layout | ||
|
||
extension BankView { | ||
private func layout() { | ||
baseStackView.translatesAutoresizingMaskIntoConstraints = false | ||
addSubview(baseStackView) | ||
|
||
// MARK: - baseStackView | ||
|
||
NSLayoutConstraint.activate([ | ||
baseStackView.topAnchor.constraint(equalTo: safeAreaLayoutGuide.topAnchor), | ||
baseStackView.bottomAnchor.constraint(equalTo: safeAreaLayoutGuide.bottomAnchor), | ||
baseStackView.leadingAnchor.constraint(equalTo: safeAreaLayoutGuide.leadingAnchor), | ||
baseStackView.trailingAnchor.constraint(equalTo: safeAreaLayoutGuide.trailingAnchor) | ||
]) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
BankManagerUIApp/BankManagerUIApp/BankController/CustomerView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// CustomerView.swift | ||
// BankManagerUIApp | ||
// | ||
// Created by Eddy on 2022/05/03. | ||
// | ||
|
||
import UIKit | ||
|
||
class CustomerView: UIView { | ||
let customer: Customer | ||
|
||
init(customer: Customer) { | ||
self.customer = customer | ||
super.init() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
private lazy var customerLabel: UILabel = { | ||
let label = UILabel() | ||
|
||
if customer.workType == .loan { | ||
label.textColor = .systemPurple | ||
} | ||
|
||
label.text = "\(customer.waitingNumber) - \(customer.workType.name)" | ||
|
||
return label | ||
}() | ||
} | ||
|
||
// MARK: - layout | ||
|
||
extension CustomerView { | ||
|
||
private func layout() { | ||
customerLabel.translatesAutoresizingMaskIntoConstraints = false | ||
addSubview(customerLabel) | ||
|
||
// MARK: - customerLabel | ||
|
||
NSLayoutConstraint.activate([ | ||
customerLabel.topAnchor.constraint(equalTo: self.topAnchor), | ||
customerLabel.bottomAnchor.constraint(equalTo: self.bottomAnchor), | ||
customerLabel.leadingAnchor.constraint(equalTo: self.leadingAnchor), | ||
customerLabel.trailingAnchor.constraint(equalTo: self.trailingAnchor) | ||
]) | ||
} | ||
} |