Digital ACT-191 ONEAPP-6827 story: updating selected state data
This commit is contained in:
parent
d647a29871
commit
87bb4eac1e
@ -18,9 +18,8 @@ class BreadcrumbsViewController: BaseViewController<Breadcrumbs> {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
let label = actionLabel
|
||||
addContentTopView(view: .makeWrapper(for: component))
|
||||
|
||||
component.breadcrumbItems = [
|
||||
makeBreadcrumbItem("Home", label: label).with{ $0.link = "https://www.verizon.com/" },
|
||||
makeBreadcrumbItem("Support", label: label).with{ $0.link = "https://www.verizon.com/"; $0.selectable = false },
|
||||
@ -29,18 +28,30 @@ class BreadcrumbsViewController: BaseViewController<Breadcrumbs> {
|
||||
makeBreadcrumbItem("Bill", label: label).with{ $0.link = "https://www.verizon.com/" },
|
||||
makeBreadcrumbItem("Billing statement FAQs", label: label).with{ $0.link = "https://www.verizon.com/"; $0.selectable = true }
|
||||
]
|
||||
addContentTopView(view: component)
|
||||
setupPicker()
|
||||
setupModel()
|
||||
}
|
||||
|
||||
override func setupForm(){
|
||||
super.setupForm()
|
||||
addActionRow()
|
||||
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
||||
addFormRow(label: "Last Crumb Selected", view: selectedSwitch)
|
||||
|
||||
selectedSwitch.onChange = { [weak self] sender in
|
||||
guard let self else { return }
|
||||
self.component.selected = !self.component.selected
|
||||
// self.component.selected = !self.component.selected
|
||||
let label = actionLabel
|
||||
print("switch flag: \(sender.isOn)")
|
||||
component.breadcrumbItems = [
|
||||
makeBreadcrumbItem("Home", label: label).with{ $0.link = "https://www.verizon.com/" },
|
||||
makeBreadcrumbItem("Support", label: label).with{ $0.link = "https://www.verizon.com/"; $0.selectable = false },
|
||||
makeBreadcrumbItem("Servie & Apps", label: label).with{ $0.link = "https://www.verizon.com/" },
|
||||
makeBreadcrumbItem("My Verizon", label: label).with{ $0.link = "https://www.verizon.com/"; $0.selectable = false },
|
||||
makeBreadcrumbItem("Bill", label: label).with{ $0.link = "https://www.verizon.com/" },
|
||||
makeBreadcrumbItem("Bill History ", label: label).with{ $0.link = "https://www.verizon.com/"; $0.selectable = sender.isOn}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,6 +65,23 @@ class BreadcrumbsViewController: BaseViewController<Breadcrumbs> {
|
||||
|
||||
func setupModel() {
|
||||
//setup UI
|
||||
selectedSwitch.isOn = true
|
||||
surfacePickerSelectorView.text = component.surface.rawValue
|
||||
}
|
||||
}
|
||||
//
|
||||
//extension BreadcrumbsViewController: ComponentSampleable {
|
||||
// static func makeSample() -> ComponentSample {
|
||||
// let component = Self.makeComponent()
|
||||
// let onClick: (ButtonBase) -> Void = { button in print("\(button.text!) clicked")}
|
||||
// component.breadcrumbItems = [
|
||||
// BreadcrumbItem().with { $0.text = "Home"; $0.onClick = onClick },
|
||||
// BreadcrumbItem().with { $0.text = "Support"; $0.onClick = onClick },
|
||||
// BreadcrumbItem().with { $0.text = "Servie & Apps"; $0.onClick = onClick },
|
||||
// BreadcrumbItem().with { $0.text = "My Verizon"; $0.onClick = onClick },
|
||||
// BreadcrumbItem().with { $0.text = "Bill"; $0.onClick = onClick },
|
||||
// BreadcrumbItem().with { $0.text = "Billing statement FAQs"; $0.onClick = onClick }
|
||||
// ]
|
||||
// return ComponentSample(component: component)
|
||||
// }
|
||||
//}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user