update to deal with tooltip model
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
66673cb294
commit
5502bee9d7
@ -105,13 +105,13 @@ class InputFieldViewController: BaseViewController<InputField> {
|
|||||||
tooltipTitleTextField
|
tooltipTitleTextField
|
||||||
.textPublisher
|
.textPublisher
|
||||||
.sink { [weak self] text in
|
.sink { [weak self] text in
|
||||||
self?.component.tooltipTitle = text
|
self?.updateTooltip()
|
||||||
}.store(in: &subscribers)
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
tooltipContentTextField
|
tooltipContentTextField
|
||||||
.textPublisher
|
.textPublisher
|
||||||
.sink { [weak self] text in
|
.sink { [weak self] text in
|
||||||
self?.component.tooltipContent = text
|
self?.updateTooltip()
|
||||||
}.store(in: &subscribers)
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -123,8 +123,7 @@ class InputFieldViewController: BaseViewController<InputField> {
|
|||||||
component.helperText = "For example: 123 Verizon St"
|
component.helperText = "For example: 123 Verizon St"
|
||||||
component.errorText = "Enter a valid address."
|
component.errorText = "Enter a valid address."
|
||||||
component.successText = "Good job entering a valid address!"
|
component.successText = "Good job entering a valid address!"
|
||||||
component.tooltipTitle = "Check the formatting of your address"
|
component.tooltipModel = .init(title: "Check the formatting of your address", content:"House/Building number then street name")
|
||||||
component.tooltipContent = "House/Building number then street name"
|
|
||||||
|
|
||||||
component
|
component
|
||||||
.publisher(for: .valueChanged)
|
.publisher(for: .valueChanged)
|
||||||
@ -147,8 +146,8 @@ class InputFieldViewController: BaseViewController<InputField> {
|
|||||||
errorTextField.text = component.errorText
|
errorTextField.text = component.errorText
|
||||||
showSuccessSwitch.isOn = component.showSuccess
|
showSuccessSwitch.isOn = component.showSuccess
|
||||||
successTextField.text = component.successText
|
successTextField.text = component.successText
|
||||||
tooltipTitleTextField.text = component.tooltipTitle
|
tooltipTitleTextField.text = component.tooltipModel?.title
|
||||||
tooltipContentTextField.text = component.tooltipContent
|
tooltipContentTextField.text = component.tooltipModel?.content
|
||||||
if let width = component.width {
|
if let width = component.width {
|
||||||
widthTextField.text = String(describing: width)
|
widthTextField.text = String(describing: width)
|
||||||
}
|
}
|
||||||
@ -165,6 +164,11 @@ class InputFieldViewController: BaseViewController<InputField> {
|
|||||||
self?.component.helperTextPlacement = item
|
self?.component.helperTextPlacement = item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateTooltip() {
|
||||||
|
component.tooltipModel = .init(title: tooltipTitleTextField.text,
|
||||||
|
content: tooltipContentTextField.text)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -177,8 +181,7 @@ extension InputFieldViewController: ComponentSampleable {
|
|||||||
component.helperText = "For example: 123 Verizon St"
|
component.helperText = "For example: 123 Verizon St"
|
||||||
component.errorText = "Enter a valid address."
|
component.errorText = "Enter a valid address."
|
||||||
component.successText = "Good job entering a valid address!"
|
component.successText = "Good job entering a valid address!"
|
||||||
component.tooltipTitle = "Check the formatting of your address"
|
component.tooltipModel = .init(title: "Check the formatting of your address", content: "House/Building number then street name")
|
||||||
component.tooltipContent = "House/Building number then street name"
|
|
||||||
return ComponentSample(component: component, trailingPinningType: .lessThanOrEqual)
|
return ComponentSample(component: component, trailingPinningType: .lessThanOrEqual)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -89,13 +89,13 @@ class TextAreaViewController: BaseViewController<TextArea> {
|
|||||||
tooltipTitleTextField
|
tooltipTitleTextField
|
||||||
.textPublisher
|
.textPublisher
|
||||||
.sink { [weak self] text in
|
.sink { [weak self] text in
|
||||||
self?.component.tooltipTitle = text
|
self?.updateTooltip()
|
||||||
}.store(in: &subscribers)
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
tooltipContentTextField
|
tooltipContentTextField
|
||||||
.textPublisher
|
.textPublisher
|
||||||
.sink { [weak self] text in
|
.sink { [weak self] text in
|
||||||
self?.component.tooltipContent = text
|
self?.updateTooltip()
|
||||||
}.store(in: &subscribers)
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -105,8 +105,7 @@ class TextAreaViewController: BaseViewController<TextArea> {
|
|||||||
component.labelText = "Street Address"
|
component.labelText = "Street Address"
|
||||||
component.helperText = "For example: 123 Verizon St"
|
component.helperText = "For example: 123 Verizon St"
|
||||||
component.errorText = "Enter a valid address."
|
component.errorText = "Enter a valid address."
|
||||||
component.tooltipTitle = "Check the formatting of your address"
|
component.tooltipModel = .init(title: "Check the formatting of your address", content:"House/Building number then street name")
|
||||||
component.tooltipContent = "House/Building number then street name"
|
|
||||||
|
|
||||||
component
|
component
|
||||||
.publisher(for: .valueChanged)
|
.publisher(for: .valueChanged)
|
||||||
@ -126,8 +125,8 @@ class TextAreaViewController: BaseViewController<TextArea> {
|
|||||||
helperTextField.text = component.helperText
|
helperTextField.text = component.helperText
|
||||||
showErrorSwitch.isOn = component.showError
|
showErrorSwitch.isOn = component.showError
|
||||||
errorTextField.text = component.errorText
|
errorTextField.text = component.errorText
|
||||||
tooltipTitleTextField.text = component.tooltipTitle
|
tooltipTitleTextField.text = component.tooltipModel?.title
|
||||||
tooltipContentTextField.text = component.tooltipContent
|
tooltipContentTextField.text = component.tooltipModel?.content
|
||||||
}
|
}
|
||||||
|
|
||||||
//Picker
|
//Picker
|
||||||
@ -137,6 +136,12 @@ class TextAreaViewController: BaseViewController<TextArea> {
|
|||||||
self?.contentTopView.backgroundColor = item.color
|
self?.contentTopView.backgroundColor = item.color
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateTooltip() {
|
||||||
|
component.tooltipModel = .init(title: tooltipTitleTextField.text,
|
||||||
|
content: tooltipContentTextField.text)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension TextAreaViewController: ComponentSampleable {
|
extension TextAreaViewController: ComponentSampleable {
|
||||||
@ -146,8 +151,8 @@ extension TextAreaViewController: ComponentSampleable {
|
|||||||
component.labelText = "Street Address"
|
component.labelText = "Street Address"
|
||||||
component.helperText = "For example: 123 Verizon St"
|
component.helperText = "For example: 123 Verizon St"
|
||||||
component.errorText = "Enter a valid address."
|
component.errorText = "Enter a valid address."
|
||||||
component.tooltipTitle = "Check the formatting of your address"
|
component.tooltipModel = .init(title: "Check the formatting of your address",
|
||||||
component.tooltipContent = "House/Building number then street name"
|
content:"House/Building number then street name")
|
||||||
return ComponentSample(component: component, trailingPinningType: .lessThanOrEqual)
|
return ComponentSample(component: component, trailingPinningType: .lessThanOrEqual)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -195,7 +195,6 @@ extension TitleLockupViewController: ComponentSampleable {
|
|||||||
component.eyebrowModel = eyebrowModel
|
component.eyebrowModel = eyebrowModel
|
||||||
component.titleModel = titleModel
|
component.titleModel = titleModel
|
||||||
component.subTitleModel = subTitleModel
|
component.subTitleModel = subTitleModel
|
||||||
component.debugBorder(show: true)
|
|
||||||
return ComponentSample(component: component)
|
return ComponentSample(component: component)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,27 +79,27 @@ class TrailingTooltipLabelViewController: BaseViewController<TrailingTooltipLabe
|
|||||||
titleTextField
|
titleTextField
|
||||||
.textPublisher
|
.textPublisher
|
||||||
.sink { [weak self] text in
|
.sink { [weak self] text in
|
||||||
self?.component.tooltipTitle = text
|
self?.updateTooltip()
|
||||||
}.store(in: &subscribers)
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
contentTextField
|
contentTextField
|
||||||
.textPublisher
|
.textPublisher
|
||||||
.sink { [weak self] text in
|
.sink { [weak self] text in
|
||||||
self?.component.tooltipContent = text
|
self?.updateTooltip()
|
||||||
}.store(in: &subscribers)
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
closeButtonTextField
|
closeButtonTextField
|
||||||
.textPublisher
|
.textPublisher
|
||||||
.sink { [weak self] text in
|
.sink { [weak self] text in
|
||||||
self?.component.tooltipCloseButtonText = text
|
self?.updateTooltip()
|
||||||
}.store(in: &subscribers)
|
}.store(in: &subscribers)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func setupModel() {
|
func setupModel() {
|
||||||
component.labelText = "5G Ultra Wideband is available in your area"
|
component.labelText = "5G Ultra Wideband is available in your area"
|
||||||
component.tooltipTitle = "5G Ultra Wideband is available in your area."
|
component.tooltipModel = .init(title: "Check the formatting of your address",
|
||||||
component.tooltipContent = "$799.99 (128 GB only)"
|
content:"House/Building number then street name")
|
||||||
|
|
||||||
//setup UI
|
//setup UI
|
||||||
surfacePickerSelectorView.text = component.surface.rawValue
|
surfacePickerSelectorView.text = component.surface.rawValue
|
||||||
@ -114,10 +114,9 @@ class TrailingTooltipLabelViewController: BaseViewController<TrailingTooltipLabe
|
|||||||
//setup UI
|
//setup UI
|
||||||
surfacePickerSelectorView.text = component.surface.rawValue
|
surfacePickerSelectorView.text = component.surface.rawValue
|
||||||
disabledSwitch.isOn = !component.isEnabled
|
disabledSwitch.isOn = !component.isEnabled
|
||||||
titleTextField.text = component.tooltipTitle
|
titleTextField.text = component.tooltipModel?.title
|
||||||
contentTextField.text = component.tooltipContent
|
contentTextField.text = component.tooltipModel?.content
|
||||||
closeButtonTextField.text = component.tooltipCloseButtonText
|
closeButtonTextField.text = component.tooltipModel?.closeButtonText
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Picker
|
//Picker
|
||||||
@ -166,14 +165,20 @@ class TrailingTooltipLabelViewController: BaseViewController<TrailingTooltipLabe
|
|||||||
self?.fontCategory = item
|
self?.fontCategory = item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateTooltip() {
|
||||||
|
component.tooltipModel = .init(closeButtonText: closeButtonTextField.text ?? "Close",
|
||||||
|
title: titleTextField.text,
|
||||||
|
content: contentTextField.text)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension TrailingTooltipLabelViewController: ComponentSampleable {
|
extension TrailingTooltipLabelViewController: ComponentSampleable {
|
||||||
static func makeSample() -> ComponentSample {
|
static func makeSample() -> ComponentSample {
|
||||||
let component = Self.makeComponent()
|
let component = Self.makeComponent()
|
||||||
component.labelText = "5G Ultra Wideband is available in your area"
|
component.labelText = "5G Ultra Wideband is available in your area"
|
||||||
component.tooltipTitle = "5G Ultra Wideband is available in your area."
|
component.tooltipModel = .init(title: "Check the formatting of your address",
|
||||||
component.tooltipContent = "$799.99 (128 GB only)"
|
content:"House/Building number then street name")
|
||||||
return ComponentSample(component: component, trailingPinningType: .lessThanOrEqual)
|
return ComponentSample(component: component, trailingPinningType: .lessThanOrEqual)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user