modifying button border changes

This commit is contained in:
Sumanth Nadigadda 2022-05-03 23:26:38 +05:30
parent 7fb91d9b1e
commit 5f6e987da8

View File

@ -43,6 +43,7 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol {
@objc public convenience init(asPrimaryButton isPrimary: Bool, makeTiny istiny: Bool) { @objc public convenience init(asPrimaryButton isPrimary: Bool, makeTiny istiny: Bool) {
self.init() self.init()
model = ButtonModel.init(with: "", action: ActionOpenPageModel(pageType: "noop"))
buttonSize = istiny ? .tiny : .standard buttonSize = istiny ? .tiny : .standard
isPrimary ? stylePrimary() : styleSecondary() isPrimary ? stylePrimary() : styleSecondary()
} }
@ -90,6 +91,8 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol {
if buttonModel?.style == .primary { if buttonModel?.style == .primary {
layer.borderWidth = 0 layer.borderWidth = 0
} else if buttonModel?.style == .secondary {
layer.borderWidth = 1
} }
if let titleColor = buttonModel?.enabledColors.text { if let titleColor = buttonModel?.enabledColors.text {
@ -111,7 +114,6 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol {
} }
if let borderColor = buttonModel?.enabledColors.border { if let borderColor = buttonModel?.enabledColors.border {
layer.borderWidth = 1
self.borderColor = borderColor self.borderColor = borderColor
} }
} else { } else {
@ -120,7 +122,6 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol {
} }
if let borderColor = buttonModel?.disabledColors.border { if let borderColor = buttonModel?.disabledColors.border {
layer.borderWidth = 1
self.borderColor = borderColor self.borderColor = borderColor
} }
} }
@ -160,7 +161,6 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol {
guard let model = model as? ButtonModel else { return } guard let model = model as? ButtonModel else { return }
style()
setTitle(model.title, for: .normal) setTitle(model.title, for: .normal)
if let accessibilityText = model.accessibilityText { if let accessibilityText = model.accessibilityText {
accessibilityLabel = accessibilityText accessibilityLabel = accessibilityText