fixed sample for width updates
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
70493edd0f
commit
c1c92f0926
@ -171,6 +171,7 @@ class DatePickerViewController: BaseViewController<DatePicker> {
|
||||
widthTextField
|
||||
.numberPublisher
|
||||
.sink { [weak self] number in
|
||||
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||
self?.component.width = number?.cgFloatValue
|
||||
}.store(in: &subscribers)
|
||||
|
||||
@ -479,3 +480,12 @@ extension DatePickerViewController {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension DatePickerViewController: ComponentSampleable {
|
||||
static func makeSample() -> ComponentSample {
|
||||
let c = Self()
|
||||
c.setupModel()
|
||||
c.setupCalendar()
|
||||
return ComponentSample(component: c.component)
|
||||
}
|
||||
}
|
||||
|
||||
@ -131,6 +131,7 @@ class DropdownSelectViewController: BaseViewController<DropdownSelect> {
|
||||
widthTextField
|
||||
.numberPublisher
|
||||
.sink { [weak self] number in
|
||||
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||
self?.component.width = number?.cgFloatValue
|
||||
}.store(in: &subscribers)
|
||||
|
||||
|
||||
@ -17,7 +17,7 @@ class FootnoteGroupViewController: BaseViewController<FootnoteGroup> {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
addContentTopView(view: component, pinTrailing: false)
|
||||
addContentTopView(view: component)
|
||||
setupPicker()
|
||||
setupModel()
|
||||
}
|
||||
@ -31,6 +31,7 @@ class FootnoteGroupViewController: BaseViewController<FootnoteGroup> {
|
||||
widthTextField
|
||||
.numberPublisher
|
||||
.sink { [weak self] number in
|
||||
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||
if let number {
|
||||
self?.component.width = .value(number.cgFloatValue)
|
||||
self?.percentageTextField.text = ""
|
||||
@ -42,6 +43,7 @@ class FootnoteGroupViewController: BaseViewController<FootnoteGroup> {
|
||||
percentageTextField
|
||||
.numberPublisher
|
||||
.sink { [weak self] number in
|
||||
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||
if let number, number.intValue > 9 {
|
||||
self?.component.width = .percentage(number.cgFloatValue)
|
||||
self?.widthTextField.text = ""
|
||||
@ -67,3 +69,11 @@ class FootnoteGroupViewController: BaseViewController<FootnoteGroup> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension FootnoteGroupViewController: ComponentSampleable {
|
||||
static func makeSample() -> ComponentSample {
|
||||
let c = Self()
|
||||
c.setupModel()
|
||||
return ComponentSample(component: c.component)
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ class FootnoteItemViewController: BaseViewController<FootnoteItem> {
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
addContentTopView(view: component, pinTrailing: false)
|
||||
addContentTopView(view: component)
|
||||
setupPicker()
|
||||
setupModel()
|
||||
}
|
||||
@ -92,6 +92,7 @@ class FootnoteItemViewController: BaseViewController<FootnoteItem> {
|
||||
widthTextField
|
||||
.numberPublisher
|
||||
.sink { [weak self] number in
|
||||
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||
if let number {
|
||||
self?.component.width = .value(number.cgFloatValue)
|
||||
self?.percentageTextField.text = ""
|
||||
@ -103,6 +104,7 @@ class FootnoteItemViewController: BaseViewController<FootnoteItem> {
|
||||
percentageTextField
|
||||
.numberPublisher
|
||||
.sink { [weak self] number in
|
||||
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||
if let number, number.intValue > 9 {
|
||||
self?.component.width = .percentage(number.cgFloatValue)
|
||||
self?.widthTextField.text = ""
|
||||
@ -164,3 +166,11 @@ class FootnoteItemViewController: BaseViewController<FootnoteItem> {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension FootnoteItemViewController: ComponentSampleable {
|
||||
static func makeSample() -> ComponentSample {
|
||||
let c = Self()
|
||||
c.setupModel()
|
||||
return ComponentSample(component: c.component)
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,6 +181,7 @@ class InputFieldViewController: BaseViewController<InputField> {
|
||||
widthTextField
|
||||
.numberPublisher
|
||||
.sink { [weak self] number in
|
||||
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||
self?.component.width = number?.cgFloatValue
|
||||
}.store(in: &subscribers)
|
||||
|
||||
@ -329,14 +330,8 @@ class InputFieldViewController: BaseViewController<InputField> {
|
||||
|
||||
extension InputFieldViewController: ComponentSampleable {
|
||||
static func makeSample() -> ComponentSample {
|
||||
let component = Self.makeComponent()
|
||||
component.fieldType = .text
|
||||
component.width = 328
|
||||
component.labelText = "Street Address"
|
||||
component.helperText = "For example: 123 Verizon St"
|
||||
component.errorText = "Enter a valid address."
|
||||
component.successText = "Good job entering a valid address!"
|
||||
component.tooltipModel = .init(title: "Check the formatting of your address", content: "House/Building number then street name")
|
||||
return ComponentSample(component: component, trailingPinningType: .lessThanOrEqual)
|
||||
let c = Self()
|
||||
c.setupModel()
|
||||
return ComponentSample(component: c.component)
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,6 +163,7 @@ class InputStepperViewController: BaseViewController<InputStepper> {
|
||||
widthTextField
|
||||
.numberPublisher
|
||||
.sink { [weak self] number in
|
||||
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||
if let number {
|
||||
self?.component.widthPercentage = nil
|
||||
self?.component.width = number.cgFloatValue
|
||||
@ -175,6 +176,7 @@ class InputStepperViewController: BaseViewController<InputStepper> {
|
||||
widthPercentageTextField
|
||||
.numberPublisher
|
||||
.sink { [weak self] number in
|
||||
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||
if let number, number.intValue > 10 {
|
||||
self?.component.width = nil
|
||||
self?.component.widthPercentage = number.cgFloatValue
|
||||
@ -253,3 +255,11 @@ class InputStepperViewController: BaseViewController<InputStepper> {
|
||||
helperTextPlacementPickerSelectorView.text = component.helperTextPlacement.rawValue
|
||||
}
|
||||
}
|
||||
|
||||
extension InputStepperViewController: ComponentSampleable {
|
||||
static func makeSample() -> ComponentSample {
|
||||
let c = Self()
|
||||
c.setupModel()
|
||||
return ComponentSample(component: c.component)
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,11 +101,8 @@ class TextAreaViewController: BaseViewController<TextArea> {
|
||||
widthTextField
|
||||
.numberPublisher
|
||||
.sink { [weak self] number in
|
||||
guard let number else {
|
||||
self?.component.width = nil
|
||||
return
|
||||
}
|
||||
self?.component.width = number.cgFloatValue
|
||||
self?.updateComponentConstraint(pinTrailing: number == nil)
|
||||
self?.component.width = number?.cgFloatValue
|
||||
}.store(in: &subscribers)
|
||||
|
||||
tooltipTitleTextField
|
||||
@ -182,13 +179,8 @@ class TextAreaViewController: BaseViewController<TextArea> {
|
||||
|
||||
extension TextAreaViewController: ComponentSampleable {
|
||||
static func makeSample() -> ComponentSample {
|
||||
let component = Self.makeComponent()
|
||||
component.width = 328
|
||||
component.labelText = "Street Address"
|
||||
component.helperText = "For example: 123 Verizon St"
|
||||
component.errorText = "Enter a valid address."
|
||||
component.tooltipModel = .init(title: "Check the formatting of your address",
|
||||
content:"House/Building number then street name")
|
||||
return ComponentSample(component: component, trailingPinningType: .lessThanOrEqual)
|
||||
let c = Self()
|
||||
c.setupModel()
|
||||
return ComponentSample(component: c.component)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user