titleLockup update for Janet release
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
e3e5ed68fb
commit
19f0744cc1
@ -46,6 +46,11 @@ open class TitleLockup: View {
|
||||
$0.distribution = .fill
|
||||
}
|
||||
|
||||
///This logic applies when the type style and size used for the title and subtitle/eyebrow is exactly the same (not including the type weight). This should be automatically detected.
|
||||
private var isUniformSize: Bool {
|
||||
otherStandardStyle.value == titleModel?.standardStyle.value
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Configuration Properties
|
||||
//--------------------------------------------------
|
||||
@ -53,7 +58,39 @@ open class TitleLockup: View {
|
||||
open var standardStyleConfiguration: StandardStyleConfigurationProvider = StandardStyleConfigurationProvider(styleConfigurations: [
|
||||
|
||||
.init(deviceType: .iPad,
|
||||
titleStandardStyles: [.titleSmall, .titleMedium],
|
||||
titleStandardStyles: [.bodySmall],
|
||||
spacingConfigurations: [
|
||||
.init(otherStandardStyles: [.bodySmall],
|
||||
topSpacing: VDSLayout.Spacing.space1X.value,
|
||||
bottomSpacing: VDSLayout.Spacing.space1X.value)
|
||||
]),
|
||||
|
||||
.init(deviceType: .iPad,
|
||||
titleStandardStyles: [.bodyMedium],
|
||||
spacingConfigurations: [
|
||||
.init(otherStandardStyles: [.bodyMedium],
|
||||
topSpacing: VDSLayout.Spacing.space1X.value,
|
||||
bottomSpacing: VDSLayout.Spacing.space1X.value)
|
||||
]),
|
||||
|
||||
.init(deviceType: .iPad,
|
||||
titleStandardStyles: [.bodyLarge],
|
||||
spacingConfigurations: [
|
||||
.init(otherStandardStyles: [.bodyLarge],
|
||||
topSpacing: VDSLayout.Spacing.space1X.value,
|
||||
bottomSpacing: VDSLayout.Spacing.space1X.value)
|
||||
]),
|
||||
|
||||
.init(deviceType: .iPad,
|
||||
titleStandardStyles: [.titleSmall],
|
||||
spacingConfigurations: [
|
||||
.init(otherStandardStyles: [.bodySmall, .bodyMedium, .bodyLarge, .titleSmall],
|
||||
topSpacing: VDSLayout.Spacing.space2X.value,
|
||||
bottomSpacing: VDSLayout.Spacing.space2X.value)
|
||||
]),
|
||||
|
||||
.init(deviceType: .iPad,
|
||||
titleStandardStyles: [.titleMedium],
|
||||
spacingConfigurations: [
|
||||
.init(otherStandardStyles: [.bodySmall, .bodyMedium, .bodyLarge],
|
||||
topSpacing: VDSLayout.Spacing.space2X.value,
|
||||
@ -100,6 +137,30 @@ open class TitleLockup: View {
|
||||
bottomSpacing: VDSLayout.Spacing.space6X.value),
|
||||
]),
|
||||
|
||||
.init(deviceType: .iPhone,
|
||||
titleStandardStyles: [.bodySmall],
|
||||
spacingConfigurations: [
|
||||
.init(otherStandardStyles: [.bodySmall],
|
||||
topSpacing: VDSLayout.Spacing.space1X.value,
|
||||
bottomSpacing: VDSLayout.Spacing.space1X.value)
|
||||
]),
|
||||
|
||||
.init(deviceType: .iPhone,
|
||||
titleStandardStyles: [.bodyMedium],
|
||||
spacingConfigurations: [
|
||||
.init(otherStandardStyles: [.bodyMedium],
|
||||
topSpacing: VDSLayout.Spacing.space1X.value,
|
||||
bottomSpacing: VDSLayout.Spacing.space1X.value)
|
||||
]),
|
||||
|
||||
.init(deviceType: .iPhone,
|
||||
titleStandardStyles: [.bodyLarge],
|
||||
spacingConfigurations: [
|
||||
.init(otherStandardStyles: [.bodyLarge],
|
||||
topSpacing: VDSLayout.Spacing.space1X.value,
|
||||
bottomSpacing: VDSLayout.Spacing.space1X.value)
|
||||
]),
|
||||
|
||||
.init(deviceType: .iPhone,
|
||||
titleStandardStyles: [.titleSmall],
|
||||
spacingConfigurations: [
|
||||
@ -153,6 +214,10 @@ open class TitleLockup: View {
|
||||
]),
|
||||
])
|
||||
|
||||
private var textColorSecondaryConfiguration = SurfaceColorConfiguration(VDSColor.elementsSecondaryOnlight , VDSColor.elementsSecondaryOnlight).eraseToAnyColorable()
|
||||
|
||||
private var textColorPrimaryConfiguration = SurfaceColorConfiguration(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark).eraseToAnyColorable()
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Public Properties
|
||||
//--------------------------------------------------
|
||||
@ -182,6 +247,8 @@ open class TitleLockup: View {
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
|
||||
titleLabel.textColorConfiguration = textColorPrimaryConfiguration
|
||||
|
||||
accessibilityElements = [eyebrowLabel, titleLabel, subTitleLabel]
|
||||
addSubview(stackView)
|
||||
|
||||
@ -247,6 +314,11 @@ open class TitleLockup: View {
|
||||
eyebrowLabel.attributes = eyebrowModel.textAttributes
|
||||
eyebrowLabel.numberOfLines = eyebrowModel.numberOfLines
|
||||
eyebrowLabel.surface = surface
|
||||
if let titleModel, isUniformSize && titleModel.isBold {
|
||||
eyebrowLabel.textColorConfiguration = textColorSecondaryConfiguration
|
||||
} else {
|
||||
eyebrowLabel.textColorConfiguration = textColorPrimaryConfiguration
|
||||
}
|
||||
} else {
|
||||
eyebrowLabel.reset()
|
||||
}
|
||||
@ -267,11 +339,11 @@ open class TitleLockup: View {
|
||||
subTitleTextIsEmpty = false
|
||||
subTitleLabel.textPosition = allLabelsTextPosition
|
||||
subTitleLabel.textStyle = otherStandardStyle.value.regular
|
||||
subTitleLabel.textColorConfiguration = subTitleModel.textColor == .secondary ? textColorSecondaryConfiguration : textColorPrimaryConfiguration
|
||||
subTitleLabel.text = subTitleModel.text
|
||||
subTitleLabel.attributes = subTitleModel.textAttributes
|
||||
subTitleLabel.numberOfLines = subTitleModel.numberOfLines
|
||||
subTitleLabel.surface = surface
|
||||
subTitleLabel.disabled = subTitleModel.textColor == .secondary
|
||||
} else {
|
||||
subTitleLabel.reset()
|
||||
}
|
||||
|
||||
@ -23,6 +23,10 @@ extension TitleLockup {
|
||||
case titleMedium
|
||||
case titleSmall
|
||||
|
||||
case bodyLarge
|
||||
case bodyMedium
|
||||
case bodySmall
|
||||
|
||||
public var defaultValue: TextStyle.StandardStyle {.featureXSmall }
|
||||
|
||||
public var value: TextStyle.StandardStyle {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user