Digital ACT-191 ONEAPP-10586 story: addressing feedback - Added textfield for footnote text, tooltip title and content. Removed 'hideSymbol'. Added 'none' to set empty text to symbolType.
This commit is contained in:
parent
7343b670e9
commit
1922791580
@ -15,6 +15,7 @@ class FootnoteViewController: BaseViewController<Footnote> {
|
||||
case asterisk
|
||||
case doubleAsterisk
|
||||
case character
|
||||
case none
|
||||
|
||||
public static var defaultValue: Self { .asterisk }
|
||||
|
||||
@ -27,6 +28,8 @@ class FootnoteViewController: BaseViewController<Footnote> {
|
||||
return "**"
|
||||
case .character:
|
||||
return "1."
|
||||
case .none:
|
||||
return ""
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -49,9 +52,11 @@ class FootnoteViewController: BaseViewController<Footnote> {
|
||||
items: Footnote.Size.allCases)
|
||||
}()
|
||||
|
||||
var hideSymbolSwitch = Toggle()
|
||||
var footnoteTextField = TextField()
|
||||
var widthTextField = NumericField()
|
||||
var percentageTextField = NumericField()
|
||||
var tooltipTitleTextField = TextField()
|
||||
var tooltipContentTextField = TextField()
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
@ -66,13 +71,17 @@ class FootnoteViewController: BaseViewController<Footnote> {
|
||||
addFormRow(label: "Kind", view: kindPickerSelectorView)
|
||||
addFormRow(label: "Size", view: sizePickerSelectorView)
|
||||
addFormRow(label: "Symbol Type", view: symbolTypePickerSelectorView)
|
||||
addFormRow(label: "Hide Symbol", view: hideSymbolSwitch)
|
||||
addFormRow(label: "Text", view: footnoteTextField)
|
||||
addFormRow(label: "Width", view: widthTextField)
|
||||
addFormRow(label: "Percentage (1-100)", view: percentageTextField)
|
||||
addFormRow(label: "ToolTip Title", view: tooltipTitleTextField)
|
||||
addFormRow(label: "ToolTip Content", view: tooltipContentTextField)
|
||||
|
||||
hideSymbolSwitch.publisher(for: .valueChanged).sink { [weak self] control in
|
||||
self?.component.hideSymbol = control.isOn
|
||||
}.store(in: &subscribers)
|
||||
footnoteTextField
|
||||
.textPublisher
|
||||
.sink { [weak self] text in
|
||||
self?.component.text = text
|
||||
}.store(in: &subscribers)
|
||||
|
||||
widthTextField
|
||||
.numberPublisher
|
||||
@ -96,15 +105,29 @@ class FootnoteViewController: BaseViewController<Footnote> {
|
||||
}
|
||||
}.store(in: &subscribers)
|
||||
|
||||
tooltipTitleTextField
|
||||
.textPublisher
|
||||
.sink { [weak self] text in
|
||||
self?.updateTooltip()
|
||||
}.store(in: &subscribers)
|
||||
|
||||
tooltipContentTextField
|
||||
.textPublisher
|
||||
.sink { [weak self] text in
|
||||
self?.updateTooltip()
|
||||
}.store(in: &subscribers)
|
||||
}
|
||||
|
||||
func setupModel() {
|
||||
component.text = "Service is included for free for two years with activation of any iPhone15 model. Connection and response times vary based on location, site conditions, and other factors. See support.apple.com/en-us/HT213885 for more information."
|
||||
component.tooltipModel = .init(title: "Check your item.", content:"Here is the content for your item.")
|
||||
component.tooltipModel = nil
|
||||
|
||||
footnoteTextField.text = component.text
|
||||
sizePickerSelectorView.text = component.size.rawValue
|
||||
kindPickerSelectorView.text = component.kind.rawValue
|
||||
symbolTypePickerSelectorView.text = SymbolType.defaultValue.text
|
||||
tooltipTitleTextField.text = component.tooltipModel?.title
|
||||
tooltipContentTextField.text = component.tooltipModel?.content
|
||||
}
|
||||
|
||||
func setupPicker() {
|
||||
@ -125,4 +148,13 @@ class FootnoteViewController: BaseViewController<Footnote> {
|
||||
self?.component.symbolType = item.text
|
||||
}
|
||||
}
|
||||
|
||||
func updateTooltip() {
|
||||
let title = tooltipTitleTextField.text ?? ""
|
||||
let content = tooltipContentTextField.text ?? ""
|
||||
|
||||
component.tooltipModel = !title.isEmpty || !content.isEmpty ? .init(title: title,
|
||||
content: content) : nil
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user