Implemented TextColor changes to TitleLockup
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
d703595e5a
commit
4685c6d398
@ -258,22 +258,10 @@ open class TitleLockup: View {
|
||||
bottomSpacing: VDSLayout.space6X)
|
||||
]),
|
||||
])
|
||||
|
||||
private var textColorSecondaryConfiguration = SurfaceColorConfiguration(VDSColor.elementsSecondaryOnlight , VDSColor.elementsSecondaryOnlight).eraseToAnyColorable()
|
||||
|
||||
private var textColorPrimaryConfiguration = SurfaceColorConfiguration(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark).eraseToAnyColorable()
|
||||
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Overrides
|
||||
//--------------------------------------------------
|
||||
/// Called once when a view is initialized and is used to Setup additional UI or other constants and configurations.
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
|
||||
titleLabel.textColorConfiguration = textColorPrimaryConfiguration
|
||||
|
||||
}
|
||||
|
||||
open override func updateAccessibility() {
|
||||
super.updateAccessibility()
|
||||
var elements = [Any]()
|
||||
@ -330,6 +318,7 @@ open class TitleLockup: View {
|
||||
if let eyebrowModel, !eyebrowModel.text.isEmpty {
|
||||
eyebrowLabel.textAlignment = allLabelsTextAlignment
|
||||
eyebrowLabel.text = eyebrowModel.text
|
||||
eyebrowLabel.textColorConfiguration = eyebrowModel.textColor.configuration
|
||||
eyebrowLabel.attributes = eyebrowModel.textAttributes
|
||||
eyebrowLabel.numberOfLines = eyebrowModel.numberOfLines
|
||||
eyebrowLabel.surface = surface
|
||||
@ -339,15 +328,12 @@ open class TitleLockup: View {
|
||||
//When uniform size is true and the title is bold,
|
||||
//the eyebrow is always regular weight and the secondary color.
|
||||
eyebrowLabel.textStyle = otherStandardStyle.value.regular
|
||||
eyebrowLabel.textColorConfiguration = textColorSecondaryConfiguration
|
||||
} else {
|
||||
//When uniform size is true and the title is regular weight
|
||||
//the eyebrow is always bold and uses the primary color.
|
||||
eyebrowLabel.textStyle = otherStandardStyle.value.bold
|
||||
eyebrowLabel.textColorConfiguration = textColorPrimaryConfiguration
|
||||
}
|
||||
} else {
|
||||
eyebrowLabel.textColorConfiguration = textColorPrimaryConfiguration
|
||||
eyebrowLabel.textStyle = eyebrowModel.isBold ? otherStandardStyle.value.bold : otherStandardStyle.value.regular
|
||||
}
|
||||
addSubview(eyebrowLabel)
|
||||
@ -363,6 +349,7 @@ open class TitleLockup: View {
|
||||
if let titleModel, !titleModel.text.isEmpty {
|
||||
titleLabel.textAlignment = allLabelsTextAlignment
|
||||
titleLabel.textStyle = titleModel.textStyle
|
||||
titleLabel.textColorConfiguration = titleModel.textColor.configuration
|
||||
titleLabel.text = titleModel.text
|
||||
titleLabel.attributes = titleModel.textAttributes
|
||||
titleLabel.numberOfLines = titleModel.numberOfLines
|
||||
@ -381,7 +368,7 @@ open class TitleLockup: View {
|
||||
if let subTitleModel, !subTitleModel.text.isEmpty {
|
||||
subTitleLabel.textAlignment = allLabelsTextAlignment
|
||||
subTitleLabel.textStyle = otherStandardStyle.value.regular
|
||||
subTitleLabel.textColorConfiguration = subTitleModel.textColor == .secondary ? textColorSecondaryConfiguration : textColorPrimaryConfiguration
|
||||
subTitleLabel.textColorConfiguration = subTitleModel.textColor.configuration
|
||||
subTitleLabel.text = subTitleModel.text
|
||||
subTitleLabel.attributes = subTitleModel.textAttributes
|
||||
subTitleLabel.numberOfLines = subTitleModel.numberOfLines
|
||||
|
||||
@ -13,6 +13,9 @@ extension TitleLockup {
|
||||
/// Text that will be used for the eyebrow label.
|
||||
public var text: String
|
||||
|
||||
/// Text color that will be used for the eyebrow label
|
||||
public var textColor: TextColor
|
||||
|
||||
/// Used in combination with standardStyle to set the textStyle that will be used for the eyebrow label.
|
||||
public var isBold: Bool
|
||||
|
||||
@ -26,11 +29,13 @@ extension TitleLockup {
|
||||
public var numberOfLines: Int
|
||||
|
||||
public init(text: String,
|
||||
textColor: TextColor = .primary,
|
||||
isBold: Bool = true,
|
||||
standardStyle: OtherStandardStyle = .bodyLarge,
|
||||
textAttributes: [any LabelAttributeModel]? = nil,
|
||||
numberOfLines: Int = 0) {
|
||||
self.text = text
|
||||
self.textColor = textColor
|
||||
self.isBold = isBold
|
||||
self.standardStyle = standardStyle
|
||||
self.textAttributes = textAttributes
|
||||
@ -41,3 +46,4 @@ extension TitleLockup {
|
||||
public var textStyle: TextStyle { isBold ? standardStyle.value.bold : standardStyle.value.regular }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ extension TitleLockup {
|
||||
public var otherStandardStyle: OtherStandardStyle
|
||||
|
||||
/// Text color used in the subtitle label.
|
||||
public var textColor: Use
|
||||
public var textColor: TextColor
|
||||
|
||||
/// Array of LabelAttributeModel objects used in rendering the text in the subtitle label.
|
||||
public var textAttributes: [any LabelAttributeModel]?
|
||||
@ -31,7 +31,7 @@ extension TitleLockup {
|
||||
|
||||
public init(text: String,
|
||||
otherStandardStyle: OtherStandardStyle = .bodyLarge,
|
||||
textColor: Use = .primary,
|
||||
textColor: TextColor = .primary,
|
||||
textAttributes: [any LabelAttributeModel]? = nil,
|
||||
numberOfLines: Int = 0,
|
||||
lineBreakMode: NSLineBreakMode = .byWordWrapping) {
|
||||
|
||||
@ -14,7 +14,10 @@ extension TitleLockup {
|
||||
/// Text that will be used for the title label.
|
||||
public var text: String
|
||||
|
||||
/// Array of LabelAttributeModel objects used in rendering the text.
|
||||
/// Text color that will be used for the eyebrow label
|
||||
public var textColor: TitleTextColor
|
||||
|
||||
/// Array of LabelAttributeModel objects used in rendering the text.
|
||||
public var textAttributes: [any LabelAttributeModel]?
|
||||
|
||||
/// Used in combination with standardStyle to set the textStyle that will be used for the title label.
|
||||
@ -30,12 +33,14 @@ extension TitleLockup {
|
||||
public var lineBreakMode: NSLineBreakMode
|
||||
|
||||
public init(text: String,
|
||||
textColor: TitleTextColor = .primary,
|
||||
textAttributes: [any LabelAttributeModel]? = nil,
|
||||
isBold: Bool = true,
|
||||
standardStyle: TitleStandardStyle = .featureXSmall,
|
||||
numberOfLines: Int = 0,
|
||||
lineBreakMode: NSLineBreakMode = .byTruncatingTail) {
|
||||
self.text = text
|
||||
self.textColor = textColor
|
||||
self.isBold = isBold
|
||||
self.textAttributes = textAttributes
|
||||
self.standardStyle = standardStyle
|
||||
|
||||
Loading…
Reference in New Issue
Block a user