updated trailing tooltip label
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
01c7df3c69
commit
a2696ece91
@ -36,8 +36,6 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
|
|||||||
|
|
||||||
open var tooltipCloseButtonText: String = "Close" { didSet { didChange() } }
|
open var tooltipCloseButtonText: String = "Close" { didSet { didChange() } }
|
||||||
|
|
||||||
open var tooltipSize: Tooltip.Size = .medium { didSet { didChange() } }
|
|
||||||
|
|
||||||
open var tooltipTitle: String = "" { didSet { didChange() } }
|
open var tooltipTitle: String = "" { didSet { didChange() } }
|
||||||
|
|
||||||
open var tooltipContent: String = "" { didSet { didChange() } }
|
open var tooltipContent: String = "" { didSet { didChange() } }
|
||||||
@ -68,36 +66,28 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
|
|||||||
label.text = labelText
|
label.text = labelText
|
||||||
label.textStyle = labelTextStyle
|
label.textStyle = labelTextStyle
|
||||||
label.textPosition = labelTextPosition
|
label.textPosition = labelTextPosition
|
||||||
|
label.attributes = labelAttributes
|
||||||
label.surface = surface
|
label.surface = surface
|
||||||
label.disabled = disabled
|
label.disabled = disabled
|
||||||
|
|
||||||
//add tooltip
|
//add tooltip
|
||||||
if let labelText, !labelText.isEmpty, !tooltipTitle.isEmpty, !tooltipContent.isEmpty {
|
if let labelText, !labelText.isEmpty, !tooltipTitle.isEmpty, !tooltipContent.isEmpty {
|
||||||
//create the model
|
label.addTooltip(model: .init(surface: surface, closeButtonText: tooltipCloseButtonText, title: tooltipTitle, content: tooltipContent))
|
||||||
let model = Label.TooltipModel(surface: surface,
|
|
||||||
closeButtonText: tooltipCloseButtonText,
|
|
||||||
size: tooltipSize,
|
|
||||||
title: tooltipTitle,
|
|
||||||
content: tooltipContent)
|
|
||||||
|
|
||||||
//add the model
|
|
||||||
label.addTooltip(model: model)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extension Label {
|
extension Label {
|
||||||
public struct TooltipModel {
|
public struct TooltipModel {
|
||||||
public var surface: Surface
|
public var surface: Surface
|
||||||
public var closeButtonText: String
|
public var closeButtonText: String
|
||||||
public var size: Tooltip.Size
|
|
||||||
public var title: String
|
public var title: String
|
||||||
public var content: String
|
public var content: String
|
||||||
|
|
||||||
public init(surface: Surface = .light, closeButtonText: String = "Close", size: Tooltip.Size = .medium, title: String, content: String) {
|
public init(surface: Surface = .light, closeButtonText: String = "Close", title: String, content: String) {
|
||||||
self.surface = surface
|
self.surface = surface
|
||||||
self.closeButtonText = closeButtonText
|
self.closeButtonText = closeButtonText
|
||||||
self.size = size
|
|
||||||
self.title = title
|
self.title = title
|
||||||
self.content = content
|
self.content = content
|
||||||
}
|
}
|
||||||
@ -117,7 +107,6 @@ extension Label {
|
|||||||
if let text = text, !text.isEmpty {
|
if let text = text, !text.isEmpty {
|
||||||
let tooltip = TooltipLabelAttribute(surface: surface,
|
let tooltip = TooltipLabelAttribute(surface: surface,
|
||||||
closeButtonText: model.closeButtonText,
|
closeButtonText: model.closeButtonText,
|
||||||
size: model.size,
|
|
||||||
title: model.title,
|
title: model.title,
|
||||||
content: model.content)
|
content: model.content)
|
||||||
newAttributes.append(tooltip)
|
newAttributes.append(tooltip)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user