added visual label for click

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-03-28 13:21:43 -05:00
parent aa51edddf9
commit 134f45795a

View File

@ -11,6 +11,7 @@ import VDS
class NotificationViewController: BaseViewController {
var notificationView = Notification()
let label = Label()
let titleTextField = TextField()
let subTitleTextField = TextField()
let buttonGroupToggle = Toggle()
@ -52,6 +53,7 @@ class NotificationViewController: BaseViewController {
addFormRow(label: "Title", view: titleTextField)
addFormRow(label: "SubTitle", view: subTitleTextField)
addFormRow(label: "Hide Button Group", view: buttonGroupToggle)
addFormRow(label: "Button Action", view: label)
addFormRow(label: "First Button Text", view: firstButtonTextField)
addFormRow(label: "Second Button Text", view: secondButtonTextField)
@ -67,6 +69,7 @@ class NotificationViewController: BaseViewController {
if toggle.isOn {
self?.notificationView.primaryButtonModel = nil
self?.notificationView.secondaryButtonModel = nil
self?.label.text = ""
} else {
self?.setupButtons(with: self?.firstButtonDefaultText, secondButtonText: self?.secondButtonDefaultText)
}
@ -105,14 +108,14 @@ class NotificationViewController: BaseViewController {
func setupButtons(with firstButtonText: String? = nil, secondButtonText: String? = nil) {
if let firstButtonText {
notificationView.primaryButtonModel = .init(text: firstButtonText, onClick: { button in
print("\(button.text!) button click")
notificationView.primaryButtonModel = .init(text: firstButtonText, onClick: { [weak self] button in
self?.label.text = "\(button.text!) button click"
})
}
if let secondButtonText {
notificationView.secondaryButtonModel = .init(text: secondButtonText, onClick: { button in
print("\(button.text!) button click")
notificationView.secondaryButtonModel = .init(text: secondButtonText, onClick: { [weak self] button in
self?.label.text = "\(button.text!) button click"
})
}
}