added TitleLockup
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
54a96e47b3
commit
0a86a121ad
@ -44,6 +44,7 @@
|
||||
EA3C3BB728996775000CA526 /* ToggleViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA3C3BB328996775000CA526 /* ToggleViewController.swift */; };
|
||||
EA4DB30428DCD25B00103EE3 /* BadgeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA4DB30328DCD25B00103EE3 /* BadgeViewController.swift */; };
|
||||
EA5E3050294D11540082B959 /* TileContainerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA5E304F294D11540082B959 /* TileContainerViewController.swift */; };
|
||||
EA5E30552950EA6E0082B959 /* TitleLockupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA5E30542950EA6E0082B959 /* TitleLockupViewController.swift */; };
|
||||
EA84F76228BE4AE500D67ABC /* RadioSwatchGroupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA84F76128BE4AE500D67ABC /* RadioSwatchGroupViewController.swift */; };
|
||||
EA89201928B56DF5006B9984 /* RadioBoxGroupViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA89201828B56DF5006B9984 /* RadioBoxGroupViewController.swift */; };
|
||||
EA89204628B66CE2006B9984 /* ScrollViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA89203F28B66CE2006B9984 /* ScrollViewController.swift */; };
|
||||
@ -109,6 +110,7 @@
|
||||
EA3C3BB328996775000CA526 /* ToggleViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ToggleViewController.swift; sourceTree = "<group>"; };
|
||||
EA4DB30328DCD25B00103EE3 /* BadgeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BadgeViewController.swift; sourceTree = "<group>"; };
|
||||
EA5E304F294D11540082B959 /* TileContainerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TileContainerViewController.swift; sourceTree = "<group>"; };
|
||||
EA5E30542950EA6E0082B959 /* TitleLockupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitleLockupViewController.swift; sourceTree = "<group>"; };
|
||||
EA84F76128BE4AE500D67ABC /* RadioSwatchGroupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatchGroupViewController.swift; sourceTree = "<group>"; };
|
||||
EA89201828B56DF5006B9984 /* RadioBoxGroupViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioBoxGroupViewController.swift; sourceTree = "<group>"; };
|
||||
EA89203F28B66CE2006B9984 /* ScrollViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScrollViewController.swift; sourceTree = "<group>"; };
|
||||
@ -256,6 +258,7 @@
|
||||
EAC9257F29119FC400091998 /* TextLinkViewController.swift */,
|
||||
EA0FC2C02912DC5500DF80B4 /* TextLinkCaretViewController.swift */,
|
||||
EA5E304F294D11540082B959 /* TileContainerViewController.swift */,
|
||||
EA5E30542950EA6E0082B959 /* TitleLockupViewController.swift */,
|
||||
EA3C3BB328996775000CA526 /* ToggleViewController.swift */,
|
||||
);
|
||||
path = ViewControllers;
|
||||
@ -401,6 +404,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
EA3C3BB728996775000CA526 /* ToggleViewController.swift in Sources */,
|
||||
EA5E30552950EA6E0082B959 /* TitleLockupViewController.swift in Sources */,
|
||||
EAB5FEEF2927E28400998C17 /* ButtonGroupViewController.swift in Sources */,
|
||||
EA89204C28B66CE2006B9984 /* ScrollWrapperView.swift in Sources */,
|
||||
EA89205128B68307006B9984 /* TextField.swift in Sources */,
|
||||
|
||||
@ -84,6 +84,7 @@ class MenuViewController: UITableViewController {
|
||||
MenuComponent(title: "TextLink", completed: true, viewController: TextLinkViewController.self),
|
||||
MenuComponent(title: "TextLinkCaret", completed: true, viewController: TextLinkCaretViewController.self),
|
||||
MenuComponent(title: "TileContainer", completed: false, viewController: TileContainerViewController.self),
|
||||
MenuComponent(title: "TitleLockup", completed: true, viewController: TitleLockupViewController.self),
|
||||
MenuComponent(title: "Toggle", completed: true, viewController: ToggleViewController.self)
|
||||
]
|
||||
|
||||
|
||||
127
VDSSample/ViewControllers/TitleLockupViewController.swift
Normal file
127
VDSSample/ViewControllers/TitleLockupViewController.swift
Normal file
@ -0,0 +1,127 @@
|
||||
//
|
||||
// TitleLockupViewController.swift
|
||||
// VDSSample
|
||||
//
|
||||
// Created by Matt Bruce on 12/19/22.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import VDS
|
||||
import VDSColorTokens
|
||||
|
||||
class TitleLockupViewController: BaseViewController {
|
||||
|
||||
lazy var textPositionPickerSelectorView = {
|
||||
PickerSelectorView(title: "left",
|
||||
picker: self.picker,
|
||||
items: TitleLockupTextPosition.allCases)
|
||||
}()
|
||||
|
||||
lazy var titleTextStylePickerSelectorView = {
|
||||
PickerSelectorView(title: "",
|
||||
picker: self.picker,
|
||||
items: TitleLockupitleTypographicalStyle.allCases.sorted{ $0.rawValue < $1.rawValue })
|
||||
}()
|
||||
|
||||
lazy var otherTextStylePickerSelectorView = {
|
||||
PickerSelectorView(title: "",
|
||||
picker: self.picker,
|
||||
items: TitleLockupOtherTypographicalStyle.allCases.sorted{ $0.rawValue < $1.rawValue })
|
||||
}()
|
||||
|
||||
lazy var subtitleColorPickerSelectorView = {
|
||||
PickerSelectorView<Use>(title: "",
|
||||
picker: self.picker,
|
||||
items: [.primary, .secondary])
|
||||
}()
|
||||
|
||||
var eyebrowTextField = TextField()
|
||||
var titleTextField = TextField()
|
||||
var subTitleTextField = TextField()
|
||||
|
||||
var titleLockup = TitleLockup()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
addContentTopView(view: titleLockup)
|
||||
|
||||
setupForm()
|
||||
setupPicker()
|
||||
setupModel()
|
||||
}
|
||||
|
||||
override func allTextFields() -> [UITextField]? { [eyebrowTextField, titleTextField, subTitleTextField] }
|
||||
|
||||
func setupForm(){
|
||||
addFormRow(label: "Surface", view: surfacePickerSelectorView)
|
||||
addFormRow(label: "Text Position", view: textPositionPickerSelectorView)
|
||||
|
||||
addFormRow(label: "Title Style", view: titleTextStylePickerSelectorView)
|
||||
addFormRow(label: "Other Style", view: otherTextStylePickerSelectorView)
|
||||
|
||||
addFormRow(label: "Eyebrow Text", view: eyebrowTextField)
|
||||
addFormRow(label: "Title Text", view: titleTextField)
|
||||
|
||||
addFormRow(label: "Subtitle Color", view: subtitleColorPickerSelectorView)
|
||||
addFormRow(label: "Subtitle Text", view: subTitleTextField)
|
||||
|
||||
eyebrowTextField
|
||||
.textPublisher
|
||||
.sink { [weak self] text in
|
||||
self?.titleLockup.eyebrowText = text
|
||||
}.store(in: &subscribers)
|
||||
|
||||
titleTextField
|
||||
.textPublisher
|
||||
.sink { [weak self] text in
|
||||
self?.titleLockup.titleText = text
|
||||
}.store(in: &subscribers)
|
||||
|
||||
subTitleTextField
|
||||
.textPublisher
|
||||
.sink { [weak self] text in
|
||||
self?.titleLockup.subTitleText = text
|
||||
}.store(in: &subscribers)
|
||||
}
|
||||
|
||||
func setupModel() {
|
||||
titleLockup.eyebrowText = "Today only."
|
||||
titleLockup.titleText = "Get more of our best"
|
||||
titleLockup.subTitleText = "Get both of our best and pay less. Pair 5G Home Internet with Verizon mobile to save every month."
|
||||
|
||||
//setup UI
|
||||
surfacePickerSelectorView.text = titleLockup.surface.rawValue
|
||||
textPositionPickerSelectorView.text = titleLockup.textPosition.rawValue
|
||||
otherTextStylePickerSelectorView.text = titleLockup.otherTypograpicalStyle.rawValue
|
||||
titleTextStylePickerSelectorView.text = titleLockup.titleTypograpicalStyle.rawValue
|
||||
subtitleColorPickerSelectorView.text = titleLockup.subTitleColor.rawValue
|
||||
eyebrowTextField.text = titleLockup.eyebrowText
|
||||
titleTextField.text = titleLockup.titleText
|
||||
subTitleTextField.text = titleLockup.subTitleText
|
||||
}
|
||||
|
||||
//Picker
|
||||
func setupPicker(){
|
||||
surfacePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.titleLockup.surface = item
|
||||
self?.contentTopView.backgroundColor = item.color
|
||||
}
|
||||
|
||||
textPositionPickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.titleLockup.textPosition = item
|
||||
}
|
||||
|
||||
titleTextStylePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.titleLockup.titleTypograpicalStyle = item
|
||||
}
|
||||
|
||||
otherTextStylePickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.titleLockup.otherTypograpicalStyle = item
|
||||
}
|
||||
|
||||
subtitleColorPickerSelectorView.onPickerDidSelect = { [weak self] item in
|
||||
self?.titleLockup.subTitleColor = item
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user