Digital ACT-191 ONEAPP-6830 story: added new scrollbar page

This commit is contained in:
vasavk 2024-03-19 17:50:52 +05:30
parent a5f2116470
commit 503449cd66
3 changed files with 92 additions and 0 deletions

View File

@ -32,6 +32,7 @@
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
1808BEBE2BA4479500129230 /* CarouselScrollbarViewConttroller.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1808BEBD2BA4479500129230 /* CarouselScrollbarViewConttroller.swift */; };
445BA07A29C088470036A7C5 /* NotificationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 445BA07929C088470036A7C5 /* NotificationViewController.swift */; };
44604AD929CE1CF900E62B51 /* LineViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44604AD829CE1CF900E62B51 /* LineViewController.swift */; };
5FC35BE928D5235A004EBEAC /* ButtonViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */; };
@ -127,6 +128,7 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
1808BEBD2BA4479500129230 /* CarouselScrollbarViewConttroller.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselScrollbarViewConttroller.swift; sourceTree = "<group>"; };
445BA07929C088470036A7C5 /* NotificationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationViewController.swift; sourceTree = "<group>"; };
44604AD829CE1CF900E62B51 /* LineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineViewController.swift; sourceTree = "<group>"; };
5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonViewController.swift; sourceTree = "<group>"; };
@ -317,6 +319,7 @@
EA81410D2A0ED8DC004F60D2 /* ButtonIconViewController.swift */,
EAB5FEEE2927E28400998C17 /* ButtonGroupViewController.swift */,
5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */,
1808BEBD2BA4479500129230 /* CarouselScrollbarViewConttroller.swift */,
EA0D1C2E2A66CFE900E5C127 /* CheckboxViewController.swift */,
EAF7F09B2899B92400B287F5 /* CheckboxItemViewController.swift */,
EA89204D28B67332006B9984 /* CheckBoxGroupViewController.swift */,
@ -493,6 +496,7 @@
EA89205128B68307006B9984 /* TextField.swift in Sources */,
EA297A682A02F5320031ED56 /* TableViewTestController.swift in Sources */,
44604AD929CE1CF900E62B51 /* LineViewController.swift in Sources */,
1808BEBE2BA4479500129230 /* CarouselScrollbarViewConttroller.swift in Sources */,
EA3C3BB528996775000CA526 /* StoryboardInitable.swift in Sources */,
EA89201928B56DF5006B9984 /* RadioBoxGroupViewController.swift in Sources */,
EA3C3BB628996775000CA526 /* MenuViewController.swift in Sources */,

View File

@ -0,0 +1,87 @@
//
// CarouselScrollbarViewConttroller.swift
// VDSSample
//
// Created by Kanamarlapudi, Vasavi on 15/03/24.
//
import Foundation
import UIKit
import VDS
import Combine
import VDSColorTokens
class CarouselScrollbarViewConttroller: BaseViewController<CarouselScrollbar> {
lazy var layoutPickerSelectorView = {
PickerSelectorView(title: "1UP",
picker: self.picker,
items: CarouselScrollbar.Layout.allCases)
}()
var slidesTextField = NumericField()
var disabledSwitch = Toggle()
var positionTextField = NumericField()
override func viewDidLoad() {
super.viewDidLoad()
addContentTopView(view: component)
setupPicker()
setupModel()
}
override func setupForm(){
super.setupForm()
addFormRow(label: "Disabled", view: disabledSwitch)
addFormRow(label: "Surface", view: surfacePickerSelectorView)
addFormRow(label: "Layout", view: layoutPickerSelectorView)
addFormRow(label: "Number Of Slides", view: slidesTextField)
addFormRow(label: "Position", view: positionTextField)
disabledSwitch.onChange = { [weak self] sender in
self?.component.isEnabled = !sender.isOn
}
slidesTextField
.numberPublisher
.sink { [weak self] number in
guard let number else {
self?.component.numberOfSlides = nil
return
}
self?.component.numberOfSlides = number.intValue
}.store(in: &subscribers)
positionTextField
.numberPublisher
.sink { [weak self] number in
guard let number else {
self?.component.position = nil
return
}
self?.component.position = number.intValue
}.store(in: &subscribers)
}
func setupModel() {
//setup UI
component.numberOfSlides = 8
surfacePickerSelectorView.text = component.surface.rawValue
disabledSwitch.isOn = !component.isEnabled
slidesTextField.text = String(component.numberOfSlides ?? 1)
}
func setupPicker(){
surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.component.surface = item
self?.contentTopView.backgroundColor = item.color
}
layoutPickerSelectorView.onPickerDidSelect = { [weak self] item in
self?.component.selectedLayout = item
}
}
}

View File

@ -73,6 +73,7 @@ class MenuViewController: UITableViewController, TooltipLaunchable {
MenuComponent(title: "Button", completed: true, viewController: ButtonViewController.self),
MenuComponent(title: "ButtonGroup", completed: true, viewController: ButtonGroupViewController.self),
MenuComponent(title: "ButtonIcon", completed: true, viewController: ButtonIconViewController.self),
MenuComponent(title: "Carousel Scrollbar", completed: false, viewController: CarouselScrollbarViewConttroller.self),
MenuComponent(title: "Checkbox", completed: true, viewController: CheckboxViewController.self),
MenuComponent(title: "CheckboxItem", completed: true, viewController: CheckboxItemViewController.self),
MenuComponent(title: "CheckboxGroup", completed: true, viewController: CheckboxGroupViewController.self),