made changes to textlink as per core specs.

This commit is contained in:
Vasavi Kanamarlapudi 2022-04-05 14:20:22 +05:30
parent 8007a0f822
commit 137b467a1e
6 changed files with 71 additions and 7 deletions

View File

@ -28,8 +28,8 @@ import UIKit
// x should be according to the text, not the button
let x = textRect.origin.x
// Line is 1 point below the text
let y = textRect.origin.y + textRect.size.height + 1
// Line is 0 point below the text
let y = textRect.origin.y + textRect.size.height + 0
context.move(to: CGPoint(x: x, y: y))
context.addLine(to: CGPoint(x: x + textRect.size.width, y: y))
@ -56,6 +56,7 @@ import UIKit
}
setTitleColor((model.inverted ? model.enabledColor_inverted : model.enabledColor).uiColor, for: .normal)
setTitleColor((model.inverted ? model.disabledColor_inverted : model.disabledColor).uiColor, for: .disabled)
setTitleColor((model.inverted ? model.activeColor_inverted : model.activeColor).uiColor, for: .highlighted)
isEnabled = model.enabled
set(with: model.action, delegateObject: delegateObject, additionalData: additionalData)
}
@ -82,7 +83,7 @@ extension Link {
backgroundColor = .clear
contentMode = .redraw
setTitleColor(.mvmBlack, for: .normal)
setTitleColor(.mvmCoolGray6, for: .disabled)
setTitleColor(.mvmCoolGray3, for: .disabled)
titleLabel?.numberOfLines = 1
titleLabel?.lineBreakMode = .byTruncatingTail
titleLabel?.textAlignment = .left

View File

@ -24,8 +24,11 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol, EnableableMode
public var enabled = true
public var enabledColor = Color(uiColor: .mvmBlack)
public var enabledColor_inverted = Color(uiColor: .mvmWhite)
public var disabledColor = Color(uiColor: .mvmCoolGray6)
public var disabledColor = Color(uiColor: .mvmCoolGray3)
public var disabledColor_inverted = Color(uiColor: .mvmCoolGray10)
public var activeColor = Color(uiColor: .mvmGray44)
public var activeColor_inverted = Color(uiColor: .mvmGray65)
public var inverted = false
//--------------------------------------------------
@ -53,6 +56,8 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol, EnableableMode
case enabledColor_inverted
case disabledColor
case disabledColor_inverted
case activeColor
case activeColor_inverted
case inverted
}
@ -92,6 +97,14 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol, EnableableMode
if let disabledColor_inverted = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledColor_inverted) {
self.disabledColor_inverted = disabledColor_inverted
}
if let activeColor = try typeContainer.decodeIfPresent(Color.self, forKey: .activeColor) {
self.activeColor = activeColor
}
if let activeColor_inverted = try typeContainer.decodeIfPresent(Color.self, forKey: .activeColor_inverted) {
self.activeColor_inverted = activeColor_inverted
}
}
public func encode(to encoder: Encoder) throws {
@ -107,5 +120,7 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol, EnableableMode
try container.encode(enabledColor_inverted, forKey: .enabledColor_inverted)
try container.encode(disabledColor, forKey: .disabledColor)
try container.encode(disabledColor_inverted, forKey: .disabledColor_inverted)
try container.encode(activeColor, forKey: .activeColor)
try container.encode(activeColor_inverted, forKey: .activeColor_inverted)
}
}

View File

@ -52,6 +52,8 @@ extension UIColor {
"coolGray3": (.mvmCoolGray3, "#D8DADA"),
"coolGray6": (.mvmCoolGray6, "#747676"),
"coolGray10": (.mvmCoolGray10, "#333333"),
"gray44": (.mvmGray44, "#6F7171"),
"gray65": (.mvmGray65, "#A7A7A7"),
"upGold1": (.vzupGold1, "#F9D542"),
"upGold2": (.vzupGold2, "#F4CA53"),
"upGold3": (.vzupGold3, "#CC9B2D")]
@ -197,6 +199,12 @@ extension UIColor {
/// HEX: #333333
public static let mvmCoolGray10 = UIColor.assetColor(named: "coolGray10")
/// HEX: #6F7171
public static let mvmGray44 = UIColor.assetColor(named: "gray44")
/// HEX: #A7A7A7
public static let mvmGray65 = UIColor.assetColor(named: "gray65")
//--------------------------------------------------
// MARK: - VZ UP Brand
//--------------------------------------------------

View File

@ -1,6 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
}
}
}

View File

@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x71",
"green" : "0x71",
"red" : "0x6F"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xA7",
"green" : "0xA7",
"red" : "0xA7"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}