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.eyebrowModel = eyebrowModel
|
||||||
$0.titleModel = titleModel
|
$0.titleModel = titleModel
|
||||||
$0.subTitleModel = subTitleModel
|
$0.subTitleModel = subTitleModel
|
||||||
|
$0.directionalIconModel = .init(iconColor: .token(.paletteWhite), size: .small)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,27 +14,21 @@ class TileletGroupViewController: BaseViewController<TileletGroup> {
|
|||||||
var collectionView: UICollectionView!
|
var collectionView: UICollectionView!
|
||||||
|
|
||||||
public enum RowQuantity: String, CaseIterable {
|
public enum RowQuantity: String, CaseIterable {
|
||||||
case none, one, two, three, four
|
case one, two, three, four
|
||||||
|
|
||||||
init(quantity: Int){
|
init(quantity: Int){
|
||||||
|
|
||||||
if quantity == 1 {
|
if quantity == 1 {
|
||||||
self = .one
|
self = .one
|
||||||
} else if quantity == 2 {
|
} else if quantity == 2 {
|
||||||
self = .two
|
self = .two
|
||||||
} else if quantity == 3 {
|
} else if quantity == 3 {
|
||||||
self = .three
|
self = .three
|
||||||
} else if quantity == 4 {
|
|
||||||
self = .four
|
|
||||||
} else {
|
} else {
|
||||||
self = .none
|
self = .four
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
var intValue: Int {
|
var intValue: Int {
|
||||||
switch self {
|
switch self {
|
||||||
case .none:
|
|
||||||
return 0
|
|
||||||
case .one:
|
case .one:
|
||||||
return 1
|
return 1
|
||||||
case .two:
|
case .two:
|
||||||
@ -59,18 +53,8 @@ class TileletGroupViewController: BaseViewController<TileletGroup> {
|
|||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
|
|
||||||
component.tilelets = [
|
resetTilets()
|
||||||
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)
|
addContentTopView(view: component)
|
||||||
widthTextField.placeholder = "Active RowQty == none"
|
|
||||||
setupPicker()
|
setupPicker()
|
||||||
setupModel()
|
setupModel()
|
||||||
|
|
||||||
@ -79,6 +63,15 @@ class TileletGroupViewController: BaseViewController<TileletGroup> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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(){
|
override func setupForm(){
|
||||||
super.setupForm()
|
super.setupForm()
|
||||||
addActionRow()
|
addActionRow()
|
||||||
@ -91,13 +84,13 @@ class TileletGroupViewController: BaseViewController<TileletGroup> {
|
|||||||
self?.component.isEnabled = !sender.isOn
|
self?.component.isEnabled = !sender.isOn
|
||||||
}
|
}
|
||||||
|
|
||||||
widthTextField
|
// widthTextField
|
||||||
.numberPublisher
|
// .numberPublisher
|
||||||
.sink { [weak self] number in
|
// .sink { [weak self] number in
|
||||||
if let number {
|
// if let number {
|
||||||
// self?.component.childWidth = .value(number.cgFloatValue)
|
// // self?.component.childWidth = .value(number.cgFloatValue)
|
||||||
}
|
// }
|
||||||
}.store(in: &subscribers)
|
// }.store(in: &subscribers)
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupModel() {
|
func setupModel() {
|
||||||
@ -118,32 +111,12 @@ class TileletGroupViewController: BaseViewController<TileletGroup> {
|
|||||||
rowQuantitySelectorView.onPickerDidSelect = { [weak self] item in
|
rowQuantitySelectorView.onPickerDidSelect = { [weak self] item in
|
||||||
self?.widthTextField.isEnabled = item.intValue == 0
|
self?.widthTextField.isEnabled = item.intValue == 0
|
||||||
|
|
||||||
if item != .none {
|
|
||||||
self?.widthTextField.text = ""
|
|
||||||
//self?.component.childWidth = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
if UIDevice.isIPad {
|
if UIDevice.isIPad {
|
||||||
self?.component.rowQuantityTablet = item.intValue
|
self?.component.rowQuantityTablet = item.intValue
|
||||||
} else {
|
} else {
|
||||||
self?.component.rowQuantityPhone = item.intValue
|
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