diff --git a/VDSSample.xcodeproj/project.pbxproj b/VDSSample.xcodeproj/project.pbxproj index 9675c37..b62a794 100644 --- a/VDSSample.xcodeproj/project.pbxproj +++ b/VDSSample.xcodeproj/project.pbxproj @@ -32,6 +32,7 @@ /* End PBXAggregateTarget section */ /* Begin PBXBuildFile section */ + 1832AC5B2BA1347B008AE476 /* BreadcrumbsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.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 */ + 1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BreadcrumbsViewController.swift; sourceTree = ""; }; 445BA07929C088470036A7C5 /* NotificationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationViewController.swift; sourceTree = ""; }; 44604AD829CE1CF900E62B51 /* LineViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineViewController.swift; sourceTree = ""; }; 5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonViewController.swift; sourceTree = ""; }; @@ -308,18 +310,19 @@ isa = PBXGroup; children = ( EA89203E28B66CE2006B9984 /* ScrollViewController */, - EA3C3BB228996775000CA526 /* MenuViewController.swift */, - EAD062A22A3913920015965D /* DropShawdowViewController.swift */, EA297A672A02F5320031ED56 /* TableViewTestController.swift */, - EAB1D2C828AAAA1D00DAE764 /* BaseViewController.swift */, - EA4DB30328DCD25B00103EE3 /* BadgeViewController.swift */, + EAD062A22A3913920015965D /* DropShawdowViewController.swift */, + EA3C3BB228996775000CA526 /* MenuViewController.swift */, EAD062AC2A3B86950015965D /* BadgeIndicatorViewController.swift */, - EA81410D2A0ED8DC004F60D2 /* ButtonIconViewController.swift */, + EA4DB30328DCD25B00103EE3 /* BadgeViewController.swift */, + EAB1D2C828AAAA1D00DAE764 /* BaseViewController.swift */, + 1832AC5A2BA1347B008AE476 /* BreadcrumbsViewController.swift */, EAB5FEEE2927E28400998C17 /* ButtonGroupViewController.swift */, + EA81410D2A0ED8DC004F60D2 /* ButtonIconViewController.swift */, 5FC35BE828D5235A004EBEAC /* ButtonViewController.swift */, - EA0D1C2E2A66CFE900E5C127 /* CheckboxViewController.swift */, - EAF7F09B2899B92400B287F5 /* CheckboxItemViewController.swift */, EA89204D28B67332006B9984 /* CheckBoxGroupViewController.swift */, + EAF7F09B2899B92400B287F5 /* CheckboxItemViewController.swift */, + EA0D1C2E2A66CFE900E5C127 /* CheckboxViewController.swift */, EA985C00296CC21C00F2FF2E /* IconViewController.swift */, EAA5EEAC28EB6924003B3210 /* InputFieldViewController.swift */, EAB1D2D328AC409F00DAE764 /* LabelViewController.swift */, @@ -327,17 +330,17 @@ EAD0688F2A55FC11002E3A2D /* LoaderViewController.swift */, 445BA07929C088470036A7C5 /* NotificationViewController.swift */, EA89201828B56DF5006B9984 /* RadioBoxGroupViewController.swift */, - EA0D1C302A673F3500E5C127 /* RadioButtonViewController.swift */, - EA0D1C322A673FD400E5C127 /* RadioButtonItemViewController.swift */, EAF7F11928A14A0E00B287F5 /* RadioButtonGroupViewController.swift */, + EA0D1C322A673FD400E5C127 /* RadioButtonItemViewController.swift */, + EA0D1C302A673F3500E5C127 /* RadioButtonViewController.swift */, EA5F86CD2A1E863F00BC83E4 /* TabsContainerViewController.swift */, EA596AB92A16B2ED00300C4B /* TabsViewController.swift */, EA985C24296E06EA00F2FF2E /* TextAreaViewController.swift */, EA0FC2C02912DC5500DF80B4 /* TextLinkCaretViewController.swift */, EAC9257F29119FC400091998 /* TextLinkViewController.swift */, EA5E304F294D11540082B959 /* TileContainerViewController.swift */, - EA5E30542950EA6E0082B959 /* TitleLockupViewController.swift */, EA5E305B295111050082B959 /* TileletViewController.swift */, + EA5E30542950EA6E0082B959 /* TitleLockupViewController.swift */, EA3C3BB328996775000CA526 /* ToggleViewController.swift */, EAB2375F29E88D5D00AABE9A /* TooltipViewController.swift */, EAB2376B29E9E74900AABE9A /* TrailingTooltipLabelViewController.swift */, @@ -526,6 +529,7 @@ EA89204E28B67332006B9984 /* CheckBoxGroupViewController.swift in Sources */, EAA5EEAD28EB6924003B3210 /* InputFieldViewController.swift in Sources */, EA985C25296E06EA00F2FF2E /* TextAreaViewController.swift in Sources */, + 1832AC5B2BA1347B008AE476 /* BreadcrumbsViewController.swift in Sources */, EA81410E2A0ED8DC004F60D2 /* ButtonIconViewController.swift in Sources */, EA985C20296DECF600F2FF2E /* IconName.swift in Sources */, EA89204928B66CE2006B9984 /* KeyboardFrameChangeListening.swift in Sources */, diff --git a/VDSSample/ViewControllers/BreadcrumbsViewController.swift b/VDSSample/ViewControllers/BreadcrumbsViewController.swift new file mode 100644 index 0000000..2264c75 --- /dev/null +++ b/VDSSample/ViewControllers/BreadcrumbsViewController.swift @@ -0,0 +1,92 @@ +// +// BreadcrumbsViewController.swift +// VDSSample +// +// Created by Kanamarlapudi, Vasavi on 05/03/24. +// + +import Foundation +import UIKit +import VDS +import VDSColorTokens +import Combine + +class BreadcrumbsViewController: BaseViewController { + + var selectedSwitch = Toggle() + var sampleSwitch = Toggle() + var selectedCrumbLabel = Label().with { $0.textStyle = .boldBodyMedium } + var allBreadcrumbs: [Breadcrumbs.BreadcrumbItemModel] = [ + .init(text: "Home"), + .init(text: "Support", enabeled: false), + .init(text: "Servie & Apps"), + .init(text: "My Verizon"), + .init(text: "Bill"), + .init(text: "Mobile Billing & Payments"), + .init(text: "Billing statement FAQs", selected: true) + ] + + var some: [Breadcrumbs.BreadcrumbItemModel] = [ + .init(text: "Plans"), + .init(text: "Upgrade Plan"), + .init(text: "Billing Statement Frequently Asked Questions About Stuff You don't want to see", selected: true) + ] + + override func viewDidLoad() { + super.viewDidLoad() + let stack = UIStackView(arrangedSubviews: [component, selectedCrumbLabel]).with { + $0.axis = .vertical + $0.spacing = 25 + } + addContentTopView(view: stack) + setupPicker() + setupModel() + } + + override func setupForm(){ + super.setupForm() + addFormRow(label: "Surface", view: surfacePickerSelectorView) + addFormRow(label: "Last Crumb Selected", view: selectedSwitch) + addFormRow(label: "Large Sample", view: sampleSwitch) + + selectedSwitch.onChange = { [weak self] sender in + guard let self else { return } + component.breadcrumbs.last?.isSelected = sender.isOn + } + + sampleSwitch.onChange = { [weak self] sender in + guard let self else { return } + self.component.breadcrumbModels = sender.isOn ? self.allBreadcrumbs : self.some + selectedSwitch.isOn = true + updatedCrumbLabel(crumb: component.breadcrumbs.last ?? nil) + } + } + + func setupPicker(){ + surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in + self?.component.surface = item + self?.contentTopView.backgroundColor = item.color + self?.selectedCrumbLabel.surface = item + } + } + + func updatedCrumbLabel(crumb: BreadcrumbItem?) { + selectedCrumbLabel.text = "Selected Crumb : \(crumb?.text ?? "")" + } + + func setupModel() { + //setup UI + component.breadcrumbModels = allBreadcrumbs + selectedSwitch.isOn = true + sampleSwitch.isOn = true + surfacePickerSelectorView.text = component.surface.rawValue + + updatedCrumbLabel(crumb: component.breadcrumbs.last ?? nil) + //test setup to show component was picked + component.onBreadcrumbDidSelect = { [weak self] crumb in + guard let self else { return } + self.updatedCrumbLabel(crumb: crumb) + } + + } +} diff --git a/VDSSample/ViewControllers/MenuViewController.swift b/VDSSample/ViewControllers/MenuViewController.swift index 0ef29b7..8465c6f 100644 --- a/VDSSample/ViewControllers/MenuViewController.swift +++ b/VDSSample/ViewControllers/MenuViewController.swift @@ -70,6 +70,7 @@ class MenuViewController: UITableViewController, TooltipLaunchable { MenuComponent(title: "TableView Tester", completed: true, viewController: TableViewTestController.self), MenuComponent(title: "Badge", completed: true, viewController: BadgeViewController.self), MenuComponent(title: "Badge Indicator", completed: true, viewController: BadgeIndicatorViewController.self), + MenuComponent(title: "Breadcrumbs", completed: true, viewController: BreadcrumbsViewController.self), MenuComponent(title: "Button", completed: true, viewController: ButtonViewController.self), MenuComponent(title: "ButtonGroup", completed: true, viewController: ButtonGroupViewController.self), MenuComponent(title: "ButtonIcon", completed: true, viewController: ButtonIconViewController.self),