From 59d26348002b9a11a2d11040b15e340e2aeb730c Mon Sep 17 00:00:00 2001 From: Vasavi Kanamarlapudi Date: Wed, 17 Jul 2024 18:33:14 +0530 Subject: [PATCH] Digital ACT-191 ONEAPP-9311 story: addressing PR feedback --- .../CarouselViewController.swift | 43 +++++++------------ 1 file changed, 16 insertions(+), 27 deletions(-) diff --git a/VDSSample/ViewControllers/CarouselViewController.swift b/VDSSample/ViewControllers/CarouselViewController.swift index cc7025d..675c262 100644 --- a/VDSSample/ViewControllers/CarouselViewController.swift +++ b/VDSSample/ViewControllers/CarouselViewController.swift @@ -15,12 +15,6 @@ class CarouselViewController: BaseViewController { let label = Label() - lazy var scalingTypePickerSelectorView = { - PickerSelectorView(title: "", - picker: self.picker, - items: Tilelet.AspectRatio.allCases) - }() - lazy var paginationDisplayPickerSelectorView = { PickerSelectorView(title: "", picker: self.picker, @@ -68,8 +62,8 @@ class CarouselViewController: BaseViewController { var widthTextField = NumericField() var percentageTextField = NumericField() var exampleSwitch = Toggle() - var emptyData: [Any] = [] - var rows: [Any] = [] + var emptyData: [UIView] = [] + var rows: [UIView] = [] override func viewDidLoad() { super.viewDidLoad() @@ -83,7 +77,6 @@ class CarouselViewController: BaseViewController { //add form rows addFormRow(label: "onChange", view: label) addFormRow(label: "Surface", view: surfacePickerSelectorView) - addFormRow(label: "Aspect Ratio", view: scalingTypePickerSelectorView) addFormRow(label: "Pagination Display", view: paginationDisplayPickerSelectorView) addFormRow(label: "Peek", view: peekPickerSelectorView) addFormRow(label: "Gutter", view: gutterPickerSelectorView) @@ -136,7 +129,7 @@ class CarouselViewController: BaseViewController { exampleSwitch.onChange = { [weak self] sender in guard let self else { return } - component.data = sender.isOn ? rows : emptyData + component.views = sender.isOn ? rows : emptyData component.slotAlignment = nil } @@ -144,7 +137,6 @@ class CarouselViewController: BaseViewController { func setupModel() { //setup UI - scalingTypePickerSelectorView.text = component.aspectRatio.rawValue paginationDisplayPickerSelectorView.text = component.paginationDisplay.rawValue peekPickerSelectorView.text = component.peek.rawValue gutterPickerSelectorView.text = component.gutter.rawValue @@ -152,18 +144,19 @@ class CarouselViewController: BaseViewController { paginationKindPickerSelectorView.text = ButtonIcon.Kind.lowContrast.rawValue paginationFloatingSwitch.isOn = true paginationInsetField.text = UIDevice.isIPad ? "12" : "8" - rows.append(Label().with { $0.text = "Slot 1"; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping}) - rows.append(Label().with { $0.text = "Slot 2"; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping}) - rows.append(Label().with { $0.text = "Slot 3"; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping}) - rows.append(Label().with { $0.text = "Slot 4"; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping}) - rows.append(Label().with { $0.text = "Slot 5"; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping}) - rows.append(Label().with { $0.text = "Slot 6"; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping}) - rows.append(Label().with { $0.text = "Slot 7"; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping}) - rows.append(Label().with { $0.text = "Slot 8"; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping}) - rows.append(Label().with { $0.text = "Slot 9"; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping}) - rows.append(Label().with { $0.text = "Slot 10"; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping}) - emptyData = [{},{},{},{},{},{},{},{},{},{}] - component.data = exampleSwitch.isOn ? rows : emptyData + 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(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 = .boldTitleSmall; $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 = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping}) + rows.append(Label().with { $0.text = "With trade-in. Any condition guaranteed"; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping}) + rows.append(Label().with { $0.text = "iPhone 14 Plus get it on us."; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping}) + rows.append(Label().with { $0.text = "Double the storage on us"; $0.textStyle = .boldTitleSmall; $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}) + emptyData = [UIView(),UIView(),UIView(),UIView()] + component.views = rows //exampleSwitch.isOn ? rows : emptyData component.renderItemStyle = .init(backgroundColor: "#d9d9d9", height: 100, width: 100, borderRadius: 12.0) label.text = "1" @@ -180,10 +173,6 @@ class CarouselViewController: BaseViewController { self?.contentTopView.backgroundColor = item.color } - scalingTypePickerSelectorView.onPickerDidSelect = { [weak self] item in - self?.component.aspectRatio = item - } - paginationDisplayPickerSelectorView.onPickerDidSelect = { [weak self] item in self?.component.paginationDisplay = item if (self?.component.peek == Carousel.Peek.none) && item == .none {