Digital ACT-191 ONEAPP-9311 story: addressing PR feedback

This commit is contained in:
Vasavi Kanamarlapudi 2024-07-17 18:33:14 +05:30
parent 41c56485d4
commit 59d2634800

View File

@ -15,12 +15,6 @@ class CarouselViewController: BaseViewController<Carousel> {
let label = Label() let label = Label()
lazy var scalingTypePickerSelectorView = {
PickerSelectorView(title: "",
picker: self.picker,
items: Tilelet.AspectRatio.allCases)
}()
lazy var paginationDisplayPickerSelectorView = { lazy var paginationDisplayPickerSelectorView = {
PickerSelectorView(title: "", PickerSelectorView(title: "",
picker: self.picker, picker: self.picker,
@ -68,8 +62,8 @@ class CarouselViewController: BaseViewController<Carousel> {
var widthTextField = NumericField() var widthTextField = NumericField()
var percentageTextField = NumericField() var percentageTextField = NumericField()
var exampleSwitch = Toggle() var exampleSwitch = Toggle()
var emptyData: [Any] = [] var emptyData: [UIView] = []
var rows: [Any] = [] var rows: [UIView] = []
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
@ -83,7 +77,6 @@ class CarouselViewController: BaseViewController<Carousel> {
//add form rows //add form rows
addFormRow(label: "onChange", view: label) addFormRow(label: "onChange", view: label)
addFormRow(label: "Surface", view: surfacePickerSelectorView) addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Aspect Ratio", view: scalingTypePickerSelectorView)
addFormRow(label: "Pagination Display", view: paginationDisplayPickerSelectorView) addFormRow(label: "Pagination Display", view: paginationDisplayPickerSelectorView)
addFormRow(label: "Peek", view: peekPickerSelectorView) addFormRow(label: "Peek", view: peekPickerSelectorView)
addFormRow(label: "Gutter", view: gutterPickerSelectorView) addFormRow(label: "Gutter", view: gutterPickerSelectorView)
@ -136,7 +129,7 @@ class CarouselViewController: BaseViewController<Carousel> {
exampleSwitch.onChange = { [weak self] sender in exampleSwitch.onChange = { [weak self] sender in
guard let self else { return } guard let self else { return }
component.data = sender.isOn ? rows : emptyData component.views = sender.isOn ? rows : emptyData
component.slotAlignment = nil component.slotAlignment = nil
} }
@ -144,7 +137,6 @@ class CarouselViewController: BaseViewController<Carousel> {
func setupModel() { func setupModel() {
//setup UI //setup UI
scalingTypePickerSelectorView.text = component.aspectRatio.rawValue
paginationDisplayPickerSelectorView.text = component.paginationDisplay.rawValue paginationDisplayPickerSelectorView.text = component.paginationDisplay.rawValue
peekPickerSelectorView.text = component.peek.rawValue peekPickerSelectorView.text = component.peek.rawValue
gutterPickerSelectorView.text = component.gutter.rawValue gutterPickerSelectorView.text = component.gutter.rawValue
@ -152,18 +144,19 @@ class CarouselViewController: BaseViewController<Carousel> {
paginationKindPickerSelectorView.text = ButtonIcon.Kind.lowContrast.rawValue paginationKindPickerSelectorView.text = ButtonIcon.Kind.lowContrast.rawValue
paginationFloatingSwitch.isOn = true paginationFloatingSwitch.isOn = true
paginationInsetField.text = UIDevice.isIPad ? "12" : "8" paginationInsetField.text = UIDevice.isIPad ? "12" : "8"
rows.append(Label().with { $0.text = "Slot 1"; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping}) let onClick: (ButtonBase) -> Void = { button in print("\(button.text!) clicked")}
rows.append(Label().with { $0.text = "Slot 2"; $0.textStyle = .boldTitleSmall; $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 10% off"; $0.textStyle = UIDevice.isIPad ? .bodyLarge : .bodySmall; $0.lineBreakMode = .byWordWrapping})
rows.append(Label().with { $0.text = "Slot 3"; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping}) rows.append(Button().with{ $0.use = .secondary; $0.text = "Secondary"; $0.onClick = onClick})
rows.append(Label().with { $0.text = "Slot 4"; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping}) rows.append(Label().with { $0.text = "Get iPhone 15 on us. Online only. "; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping})
rows.append(Label().with { $0.text = "Slot 5"; $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 = "Slot 6"; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping}) rows.append(Label().with { $0.text = "Unlimited plans. No trade-in required."; $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 = "With trade-in. Any condition guaranteed"; $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 = "iPhone 14 Plus get it on us."; $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 = "Double the storage on us"; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping})
rows.append(Label().with { $0.text = "Slot 10"; $0.textStyle = .boldTitleSmall; $0.lineBreakMode = .byWordWrapping}) rows.append(Button().with{ $0.use = .secondary; $0.text = "Get iPhone 15"; $0.onClick = onClick})
emptyData = [{},{},{},{},{},{},{},{},{},{}] rows.append(Button().with{ $0.use = .secondary; $0.text = "Get iPhone 14 Plus"; $0.onClick = onClick})
component.data = exampleSwitch.isOn ? rows : emptyData emptyData = [UIView(),UIView(),UIView(),UIView()]
component.views = rows //exampleSwitch.isOn ? rows : emptyData
component.renderItemStyle = .init(backgroundColor: "#d9d9d9", height: 100, width: 100, borderRadius: 12.0) component.renderItemStyle = .init(backgroundColor: "#d9d9d9", height: 100, width: 100, borderRadius: 12.0)
label.text = "1" label.text = "1"
@ -180,10 +173,6 @@ class CarouselViewController: BaseViewController<Carousel> {
self?.contentTopView.backgroundColor = item.color self?.contentTopView.backgroundColor = item.color
} }
scalingTypePickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.component.aspectRatio = item
}
paginationDisplayPickerSelectorView.onPickerDidSelect = { [weak self] item in paginationDisplayPickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.component.paginationDisplay = item self?.component.paginationDisplay = item
if (self?.component.peek == Carousel.Peek.none) && item == .none { if (self?.component.peek == Carousel.Peek.none) && item == .none {