initial work
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
6012d35e84
commit
977a376ce3
@ -107,6 +107,7 @@
|
||||
EAF7F0CC289DA24F00B287F5 /* DownloadArtifactoryItems.sh in Resources */ = {isa = PBXBuildFile; fileRef = EAF7F0C8289DA24F00B287F5 /* DownloadArtifactoryItems.sh */; };
|
||||
EAF7F0CD289DA24F00B287F5 /* Artifactory.sh in Resources */ = {isa = PBXBuildFile; fileRef = EAF7F0C9289DA24F00B287F5 /* Artifactory.sh */; };
|
||||
EAF7F11A28A14A0E00B287F5 /* RadioButtonGroupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF7F11928A14A0E00B287F5 /* RadioButtonGroupViewController.swift */; };
|
||||
EAFD5AA42CB5D95600C87DE1 /* TileletGroupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAFD5AA32CB5D95600C87DE1 /* TileletGroupViewController.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
@ -213,6 +214,7 @@
|
||||
EAF7F0C8289DA24F00B287F5 /* DownloadArtifactoryItems.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = DownloadArtifactoryItems.sh; sourceTree = "<group>"; };
|
||||
EAF7F0C9289DA24F00B287F5 /* Artifactory.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = Artifactory.sh; sourceTree = "<group>"; };
|
||||
EAF7F11928A14A0E00B287F5 /* RadioButtonGroupViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RadioButtonGroupViewController.swift; sourceTree = "<group>"; };
|
||||
EAFD5AA32CB5D95600C87DE1 /* TileletGroupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TileletGroupViewController.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -371,6 +373,7 @@
|
||||
EA0FC2C02912DC5500DF80B4 /* TextLinkCaretViewController.swift */,
|
||||
EA5E304F294D11540082B959 /* TileContainerViewController.swift */,
|
||||
EA5E305B295111050082B959 /* TileletViewController.swift */,
|
||||
EAFD5AA32CB5D95600C87DE1 /* TileletGroupViewController.swift */,
|
||||
EA5E30542950EA6E0082B959 /* TitleLockupViewController.swift */,
|
||||
EA3C3BB328996775000CA526 /* ToggleViewController.swift */,
|
||||
EAB2375F29E88D5D00AABE9A /* TooltipViewController.swift */,
|
||||
@ -538,6 +541,7 @@
|
||||
EA5E3050294D11540082B959 /* TileContainerViewController.swift in Sources */,
|
||||
445BA07A29C088470036A7C5 /* NotificationViewController.swift in Sources */,
|
||||
EAEEEC942B1F824500531FC2 /* Bundle.swift in Sources */,
|
||||
EAFD5AA42CB5D95600C87DE1 /* TileletGroupViewController.swift in Sources */,
|
||||
EAF7F11A28A14A0E00B287F5 /* RadioButtonGroupViewController.swift in Sources */,
|
||||
EA89204628B66CE2006B9984 /* ScrollViewController.swift in Sources */,
|
||||
EA471F402A97BEAA00CE9E58 /* CustomRotorable.swift in Sources */,
|
||||
|
||||
@ -109,7 +109,7 @@ class LabelViewController: BaseViewController<Label> {
|
||||
|
||||
|
||||
let fullText = "Here is a sample of text that has an inline text link that you can click on!"
|
||||
let linkText = "inline text link"
|
||||
let linkText = "that has an inline text link that you"
|
||||
|
||||
sampleLabel.textStyle = .titleLarge
|
||||
sampleLabel.text = fullText
|
||||
|
||||
@ -106,6 +106,7 @@ class MenuViewController: UITableViewController, TooltipLaunchable {
|
||||
MenuComponent(title: "TextLinkCaret", completed: true, viewController: TextLinkCaretViewController.self),
|
||||
MenuComponent(title: "TileContainer", completed: true, viewController: TileContainerViewController.self),
|
||||
MenuComponent(title: "Tilelet", completed: true, viewController: TileletViewController.self),
|
||||
MenuComponent(title: "TileletGroup", completed: true, viewController: TileletGroupViewController.self),
|
||||
MenuComponent(title: "TitleLockup", completed: true, viewController: TitleLockupViewController.self),
|
||||
MenuComponent(title: "Toggle", completed: true, viewController: ToggleViewController.self),
|
||||
MenuComponent(title: "Tooltip", completed: true, viewController: TooltipViewController.self),
|
||||
|
||||
179
VDSSample/ViewControllers/TileletGroupViewController.swift
Normal file
179
VDSSample/ViewControllers/TileletGroupViewController.swift
Normal file
@ -0,0 +1,179 @@
|
||||
//
|
||||
// TileletGroupViewController.swift
|
||||
// VDSSample
|
||||
//
|
||||
// Created by Matt Bruce on 10/8/24.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import VDS
|
||||
import VDSCoreTokens
|
||||
|
||||
class TileletGroupViewController: BaseViewController<TileletGroup> {
|
||||
var collectionView: UICollectionView!
|
||||
|
||||
public enum RowQuantity: String, CaseIterable {
|
||||
case none, one, two, three, four
|
||||
|
||||
init(quantity: Int){
|
||||
|
||||
if quantity == 1 {
|
||||
self = .one
|
||||
} else if quantity == 2 {
|
||||
self = .two
|
||||
} else if quantity == 3 {
|
||||
self = .three
|
||||
} else if quantity == 4 {
|
||||
self = .four
|
||||
} else {
|
||||
self = .none
|
||||
}
|
||||
|
||||
}
|
||||
var intValue: Int {
|
||||
switch self {
|
||||
case .none:
|
||||
return 0
|
||||
case .one:
|
||||
return 1
|
||||
case .two:
|
||||
return 2
|
||||
case .three:
|
||||
return 3
|
||||
case .four:
|
||||
return 4
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lazy var rowQuantitySelectorView = {
|
||||
PickerSelectorView<RowQuantity>(title: "",
|
||||
picker: self.picker,
|
||||
items: RowQuantity.allCases)
|
||||
}()
|
||||
|
||||
var disabledSwitch = Toggle()
|
||||
var widthTextField = NumericField()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
|
||||
component.tilelets = [
|
||||
makeTilelet(badge: "Here's the badge", title: "Title goes here"),
|
||||
makeTilelet(eyebrow: "Here's the eyebrow", title: "Title goes here"),
|
||||
makeTilelet(title: "Title goes here", subTitle: "Here's the subTitle"),
|
||||
makeTilelet(eyebrow: "Here's the eyebrow", subTitle: "Here's the subTitle"),
|
||||
makeTilelet(badge: "Here's the badge", eyebrow: "Here's the eyebrow", title: "Title goes here"),
|
||||
makeTilelet(badge: "Here's the badge", title: "Title goes here", subTitle: "Here's the subTitle"),
|
||||
makeTilelet(badge: "Here's the badge", subTitle: "Here's the subTitle")
|
||||
]
|
||||
|
||||
addContentTopView(view: component)
|
||||
widthTextField.placeholder = "Active RowQty == none"
|
||||
setupPicker()
|
||||
setupModel()
|
||||
|
||||
debugViewSwitch.onChange = { [weak self] sender in
|
||||
self?.component.debugBorder(show: sender.isOn, color: .blue)
|
||||
}
|
||||
}
|
||||
|
||||
func makeTilelet(badge: String? = nil, eyebrow: String? = nil, title: String? = nil, subTitle: String? = nil) -> Tilelet {
|
||||
var badgeModel: Tilelet.BadgeModel?
|
||||
if let badge {
|
||||
badgeModel = Tilelet.BadgeModel(text: badge)
|
||||
}
|
||||
|
||||
var eyebrowModel: Tilelet.EyebrowModel?
|
||||
if let eyebrow {
|
||||
eyebrowModel = Tilelet.EyebrowModel(text: eyebrow)
|
||||
}
|
||||
|
||||
var titleModel: Tilelet.TitleModel?
|
||||
if let title {
|
||||
titleModel = Tilelet.TitleModel(text: title)
|
||||
}
|
||||
|
||||
var subTitleModel: Tilelet.SubTitleModel?
|
||||
if let subTitle {
|
||||
subTitleModel = Tilelet.SubTitleModel(text: subTitle)
|
||||
}
|
||||
|
||||
return .init().with {
|
||||
$0.surface = .light
|
||||
$0.badgeModel = badgeModel
|
||||
$0.eyebrowModel = eyebrowModel
|
||||
$0.titleModel = titleModel
|
||||
$0.subTitleModel = subTitleModel
|
||||
}
|
||||
}
|
||||
|
||||
override func setupForm(){
|
||||
super.setupForm()
|
||||
addActionRow()
|
||||
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
||||
addFormRow(label: "Disabled", view: disabledSwitch, pinTrailing: false)
|
||||
addFormRow(label: "Width", view: widthTextField)
|
||||
addFormRow(label: "Row Quantity", view: rowQuantitySelectorView)
|
||||
|
||||
disabledSwitch.onChange = { [weak self] sender in
|
||||
self?.component.isEnabled = !sender.isOn
|
||||
}
|
||||
|
||||
widthTextField
|
||||
.numberPublisher
|
||||
.sink { [weak self] number in
|
||||
if let number {
|
||||
// self?.component.childWidth = .value(number.cgFloatValue)
|
||||
}
|
||||
}.store(in: &subscribers)
|
||||
}
|
||||
|
||||
func setupModel() {
|
||||
//setup UI
|
||||
surfacePickerSelectorView.text = component.surface.rawValue
|
||||
disabledSwitch.isOn = !component.isEnabled
|
||||
rowQuantitySelectorView.text = RowQuantity(quantity: component.rowQuantity).rawValue
|
||||
widthTextField.text = ""
|
||||
}
|
||||
|
||||
func setupPicker(){
|
||||
|
||||
surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.component.surface = item
|
||||
self?.contentTopView.backgroundColor = item.color
|
||||
}
|
||||
|
||||
rowQuantitySelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.widthTextField.isEnabled = item.intValue == 0
|
||||
|
||||
if item != .none {
|
||||
self?.widthTextField.text = ""
|
||||
//self?.component.childWidth = nil
|
||||
}
|
||||
|
||||
if UIDevice.isIPad {
|
||||
self?.component.rowQuantityTablet = item.intValue
|
||||
} else {
|
||||
self?.component.rowQuantityPhone = item.intValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
//extension ButtoGroupViewController: ComponentSampleable {
|
||||
// static func makeSample() -> ComponentSample {
|
||||
// let component = Self.makeComponent()
|
||||
// let onClick: (ButtonBase) -> Void = { button in print("\(button.text!) clicked")}
|
||||
// component.buttons = [
|
||||
// Button().with{ $0.use = .secondary; $0.text = "Secondary"; $0.onClick = onClick},
|
||||
// Button().with{ $0.use = .primary; $0.text = "Primary"; $0.onClick = onClick },
|
||||
// TextLink().with { $0.size = .large; $0.text = "Large Text Link"; $0.onClick = onClick },
|
||||
// TextLink().with { $0.text = "Widge Label Button"; $0.onClick = onClick },
|
||||
// TextLinkCaret().with { $0.text = "Text Link Caret"; $0.onClick = onClick}
|
||||
// ]
|
||||
//
|
||||
// return ComponentSample(component: component)
|
||||
// }
|
||||
//}
|
||||
Loading…
Reference in New Issue
Block a user