Digital ACT-191 ONEAPP-7013 story: Refactored code, updated views data, and added info label for testing purpose.
This commit is contained in:
parent
1ed92734a4
commit
304ee8ff7e
@ -60,12 +60,17 @@ class CarouselViewController: BaseViewController<Carousel> {
|
||||
var paginationFloatingSwitch = Toggle()
|
||||
var paginationInsetField = NumericField()
|
||||
var selectedIndexField = NumericField()
|
||||
var emptyData: [UIView] = []
|
||||
var rows: [UIView] = []
|
||||
var infoLabel = Label().with { $0.textStyle = .boldBodyMedium }
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
addContentTopView(view: component)
|
||||
infoLabel.text = "Added Border To Slot Only For VQA Test."
|
||||
let stack = UIStackView(arrangedSubviews: [component, infoLabel]).with {
|
||||
$0.axis = .vertical
|
||||
$0.spacing = 25
|
||||
}
|
||||
addContentTopView(view: stack)
|
||||
setupPicker()
|
||||
setupModel()
|
||||
}
|
||||
@ -123,18 +128,17 @@ class CarouselViewController: BaseViewController<Carousel> {
|
||||
paginationFloatingSwitch.isOn = true
|
||||
paginationInsetField.text = UIDevice.isIPad ? "12" : "8"
|
||||
let onClick: (ButtonBase) -> Void = { button in print("\(button.text!) clicked")}
|
||||
rows.append(Label().with { $0.text = "Offer you best deals on phones, tablets, home, internet and more. Pre order the new version mobiles and get 10% off"; $0.textStyle = UIDevice.isIPad ? .bodyLarge : .bodySmall; $0.lineBreakMode = .byWordWrapping})
|
||||
rows.append(Label().with { $0.text = "Offer you best deals on phones, tablets, home, internet and more. Pre order the new version mobiles and get off *T&C apply."; $0.textStyle = UIDevice.isIPad ? .bodyLarge : .bodySmall; $0.lineBreakMode = .byWordWrapping})
|
||||
rows.append(Button().with{ $0.use = .secondary; $0.text = "Secondary"; $0.onClick = onClick})
|
||||
rows.append(Label().with { $0.text = "Get iPhone 15 on us. Online only. "; $0.textStyle = UIDevice.isIPad ? .bodyLarge : .bodySmall; $0.lineBreakMode = .byWordWrapping})
|
||||
rows.append(Button().with{ $0.use = .primary; $0.text = "Primary"; $0.onClick = onClick})
|
||||
rows.append(Label().with { $0.text = "Unlimited plans. No trade-in required."; $0.textStyle = UIDevice.isIPad ? .bodyLarge : .bodySmall; $0.lineBreakMode = .byWordWrapping})
|
||||
rows.append(Label().with { $0.text = "With trade-in. Any condition guaranteed"; $0.textStyle = UIDevice.isIPad ? .bodyLarge : .bodySmall; $0.lineBreakMode = .byWordWrapping})
|
||||
rows.append(Label().with { $0.text = "iPhone 14 Plus get it on us."; $0.textStyle = UIDevice.isIPad ? .bodyLarge : .bodySmall; $0.lineBreakMode = .byWordWrapping})
|
||||
rows.append(Label().with { $0.text = "Double the storage on us"; $0.textStyle = UIDevice.isIPad ? .bodyLarge : .bodySmall; $0.lineBreakMode = .byWordWrapping})
|
||||
rows.append(Button().with{ $0.use = .secondary; $0.text = "Get iPhone 15"; $0.onClick = onClick})
|
||||
rows.append(Button().with{ $0.use = .secondary; $0.text = "Get iPhone 14 Plus"; $0.onClick = onClick})
|
||||
rows.append(Button().with{ $0.use = .primary; $0.text = "More"; $0.onClick = onClick})
|
||||
rows.append(Button().with{ $0.use = .secondary; $0.text = "Shop"; $0.onClick = onClick})
|
||||
rows.append(Button().with{ $0.use = .secondary; $0.text = "Buy"; $0.onClick = onClick})
|
||||
rows.append(Button().with{ $0.use = .secondary; $0.text = "Offer"; $0.onClick = onClick})
|
||||
component.views = rows
|
||||
// component.renderItemStyle = .init(backgroundColor: "#d9d9d9", height: 100, width: 100, borderRadius: 12.0)
|
||||
label.text = "0"
|
||||
|
||||
// Callback when moving the carousel. Returns selectedGroupIndex.
|
||||
@ -148,6 +152,7 @@ class CarouselViewController: BaseViewController<Carousel> {
|
||||
surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.component.surface = item
|
||||
self?.contentTopView.backgroundColor = item.color
|
||||
self?.infoLabel.surface = item
|
||||
}
|
||||
|
||||
paginationDisplayPickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
|
||||
Loading…
Reference in New Issue
Block a user