updated samples
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
48c9c087f8
commit
be7d68636a
@ -140,6 +140,7 @@ extension BaseViewController {
|
||||
$0.eyebrowModel = eyebrowModel
|
||||
$0.titleModel = titleModel
|
||||
$0.subTitleModel = subTitleModel
|
||||
$0.directionalIconModel = .init(iconColor: .token(.paletteWhite), size: .small)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -14,27 +14,21 @@ class TileletGroupViewController: BaseViewController<TileletGroup> {
|
||||
var collectionView: UICollectionView!
|
||||
|
||||
public enum RowQuantity: String, CaseIterable {
|
||||
case none, one, two, three, four
|
||||
case 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
|
||||
self = .four
|
||||
}
|
||||
|
||||
}
|
||||
var intValue: Int {
|
||||
switch self {
|
||||
case .none:
|
||||
return 0
|
||||
case .one:
|
||||
return 1
|
||||
case .two:
|
||||
@ -59,18 +53,8 @@ class TileletGroupViewController: BaseViewController<TileletGroup> {
|
||||
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")
|
||||
]
|
||||
|
||||
resetTilets()
|
||||
addContentTopView(view: component)
|
||||
widthTextField.placeholder = "Active RowQty == none"
|
||||
setupPicker()
|
||||
setupModel()
|
||||
|
||||
@ -78,7 +62,16 @@ class TileletGroupViewController: BaseViewController<TileletGroup> {
|
||||
self?.component.debugBorder(show: sender.isOn, color: .blue)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func resetTilets() {
|
||||
component.tilelets = [
|
||||
makeTilelet(badge: "Here's the badge", title: "Title goes here"),
|
||||
makeTilelet(title: "Title goes here"),
|
||||
makeTilelet(subTitle: "Here's the subTitle"),
|
||||
makeTilelet(eyebrow: "Here's the eyebrow", subTitle: "Here's the subTitle")
|
||||
]
|
||||
}
|
||||
|
||||
override func setupForm(){
|
||||
super.setupForm()
|
||||
addActionRow()
|
||||
@ -91,13 +84,13 @@ class TileletGroupViewController: BaseViewController<TileletGroup> {
|
||||
self?.component.isEnabled = !sender.isOn
|
||||
}
|
||||
|
||||
widthTextField
|
||||
.numberPublisher
|
||||
.sink { [weak self] number in
|
||||
if let number {
|
||||
// self?.component.childWidth = .value(number.cgFloatValue)
|
||||
}
|
||||
}.store(in: &subscribers)
|
||||
// widthTextField
|
||||
// .numberPublisher
|
||||
// .sink { [weak self] number in
|
||||
// if let number {
|
||||
// // self?.component.childWidth = .value(number.cgFloatValue)
|
||||
// }
|
||||
// }.store(in: &subscribers)
|
||||
}
|
||||
|
||||
func setupModel() {
|
||||
@ -118,32 +111,12 @@ class TileletGroupViewController: BaseViewController<TileletGroup> {
|
||||
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
|
||||
}
|
||||
self?.resetTilets()
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
//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