refactored to use tokens instead of hardcoded values
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
1191901787
commit
410ee5afdf
@ -67,7 +67,7 @@ public class Badge: View, Accessable {
|
|||||||
|
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
accessibilityTraits = .staticText
|
accessibilityTraits = .staticText
|
||||||
layer.cornerRadius = 2
|
layer.cornerRadius = VDSFormControls.borderradius
|
||||||
|
|
||||||
addSubview(label)
|
addSubview(label)
|
||||||
label.pinToSuperView(.init(top: 2, left: 4, bottom: 2, right: 4))
|
label.pinToSuperView(.init(top: 2, left: 4, bottom: 2, right: 4))
|
||||||
|
|||||||
@ -146,7 +146,7 @@ open class Button: ButtonBase, Useable {
|
|||||||
super.updateView()
|
super.updateView()
|
||||||
let bgColor = backgroundColorConfiguration.getColor(self)
|
let bgColor = backgroundColorConfiguration.getColor(self)
|
||||||
let borderColor = borderColorConfiguration.getColor(self)
|
let borderColor = borderColorConfiguration.getColor(self)
|
||||||
let borderWidth = use == .secondary ? 1.0 : 0.0
|
let borderWidth = use == .secondary ? VDSFormControls.widthBorder : 0.0
|
||||||
let buttonHeight = size.height
|
let buttonHeight = size.height
|
||||||
let cornerRadius = size.cornerRadius
|
let cornerRadius = size.cornerRadius
|
||||||
let minWidth = size.minimumWidth
|
let minWidth = size.minimumWidth
|
||||||
|
|||||||
@ -371,8 +371,8 @@ open class CheckboxBase: Control, Accessable, DataTrackable, Errorable {
|
|||||||
|
|
||||||
selectorView.backgroundColor = backgroundColor
|
selectorView.backgroundColor = backgroundColor
|
||||||
selectorView.layer.borderColor = borderColor.cgColor
|
selectorView.layer.borderColor = borderColor.cgColor
|
||||||
selectorView.layer.cornerRadius = 2.0
|
selectorView.layer.cornerRadius = VDSFormControls.borderradius
|
||||||
selectorView.layer.borderWidth = 1.0
|
selectorView.layer.borderWidth = VDSFormControls.widthBorder
|
||||||
|
|
||||||
if shapeLayer == nil {
|
if shapeLayer == nil {
|
||||||
let bounds = selectorView.bounds
|
let bounds = selectorView.bounds
|
||||||
|
|||||||
@ -281,10 +281,10 @@ open class RadioBoxBase: Control, Accessable, DataTrackable{
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Configuration Properties
|
// MARK: - Configuration Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private var strikeThroughLineThickness: CGFloat = 1.0
|
private var strikeThroughLineThickness: CGFloat = VDSFormControls.widthBorder
|
||||||
private var selectorCornerRadius: CGFloat = 4.0
|
private var selectorCornerRadius: CGFloat = VDSFormControls.borderradius
|
||||||
private var selectorBorderWidthSelected: CGFloat = 2.0
|
private var selectorBorderWidthSelected: CGFloat = VDSFormControls.widthBorder + VDSFormControls.widthBorder
|
||||||
private var selectorBorderWidth: CGFloat = 1.0
|
private var selectorBorderWidth: CGFloat = VDSFormControls.widthBorder
|
||||||
|
|
||||||
private var backgroundColorConfiguration = ControlColorConfiguration().with {
|
private var backgroundColorConfiguration = ControlColorConfiguration().with {
|
||||||
$0.setSurfaceColors(VDSFormControlsColor.backgroundOnlight, VDSFormControlsColor.backgroundOndark, forState: .normal)
|
$0.setSurfaceColors(VDSFormControlsColor.backgroundOnlight, VDSFormControlsColor.backgroundOndark, forState: .normal)
|
||||||
@ -311,7 +311,7 @@ open class RadioBoxBase: Control, Accessable, DataTrackable{
|
|||||||
//get the colors
|
//get the colors
|
||||||
let backgroundColor = backgroundColorConfiguration.getColor(self)
|
let backgroundColor = backgroundColorConfiguration.getColor(self)
|
||||||
let borderColor = borderColorConfiguration.getColor(self)
|
let borderColor = borderColorConfiguration.getColor(self)
|
||||||
let borderWidth = isSelected || isHighlighted ? selectorBorderWidthSelected : selectorBorderWidth
|
let borderWidth = isSelected ? selectorBorderWidthSelected : selectorBorderWidth
|
||||||
|
|
||||||
selectorView.backgroundColor = backgroundColor
|
selectorView.backgroundColor = backgroundColor
|
||||||
selectorView.layer.borderColor = borderColor.cgColor
|
selectorView.layer.borderColor = borderColor.cgColor
|
||||||
|
|||||||
@ -373,7 +373,7 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, Errorable {
|
|||||||
selectorView.backgroundColor = backgroundColor
|
selectorView.backgroundColor = backgroundColor
|
||||||
selectorView.layer.borderColor = borderColor.cgColor
|
selectorView.layer.borderColor = borderColor.cgColor
|
||||||
selectorView.layer.cornerRadius = selectorView.bounds.width * 0.5
|
selectorView.layer.cornerRadius = selectorView.bounds.width * 0.5
|
||||||
selectorView.layer.borderWidth = 1.0
|
selectorView.layer.borderWidth = VDSFormControls.widthBorder
|
||||||
|
|
||||||
if shapeLayer == nil {
|
if shapeLayer == nil {
|
||||||
let selectedBounds = radioButtonSelectedSize
|
let selectedBounds = radioButtonSelectedSize
|
||||||
|
|||||||
@ -162,8 +162,8 @@ open class RadioSwatchBase: Control, Accessable, DataTrackable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Configuration Properties
|
// MARK: - Configuration Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private var strikeThroughLineThickness: CGFloat = 1.0
|
private var strikeThroughLineThickness: CGFloat = VDSFormControls.widthBorder
|
||||||
private var selectorBorderWidth: CGFloat = 1.0
|
private var selectorBorderWidth: CGFloat = VDSFormControls.widthBorder
|
||||||
public let swatchSize = CGSize(width: 48, height: 48)
|
public let swatchSize = CGSize(width: 48, height: 48)
|
||||||
public let fillSize = CGSize(width: 36, height: 36)
|
public let fillSize = CGSize(width: 36, height: 36)
|
||||||
public let disabledAlpha = 0.5
|
public let disabledAlpha = 0.5
|
||||||
|
|||||||
@ -285,8 +285,8 @@ open class EntryField: Control, Accessable {
|
|||||||
|
|
||||||
containerView.backgroundColor = backgroundColorConfiguration.getColor(self)
|
containerView.backgroundColor = backgroundColorConfiguration.getColor(self)
|
||||||
containerView.layer.borderColor = borderColorConfiguration.getColor(self).cgColor
|
containerView.layer.borderColor = borderColorConfiguration.getColor(self).cgColor
|
||||||
containerView.layer.borderWidth = 1
|
containerView.layer.borderWidth = VDSFormControls.widthBorder
|
||||||
containerView.layer.cornerRadius = 4
|
containerView.layer.cornerRadius = VDSFormControls.borderradius
|
||||||
|
|
||||||
updateTitleLabel()
|
updateTitleLabel()
|
||||||
updateErrorLabel()
|
updateErrorLabel()
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import VDSColorTokens
|
import VDSColorTokens
|
||||||
|
import VDSFormControlsTokens
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
@objc(VDSTileContainer)
|
@objc(VDSTileContainer)
|
||||||
@ -181,8 +182,8 @@ open class TileContainer: Control {
|
|||||||
|
|
||||||
//corner radius
|
//corner radius
|
||||||
layer.cornerRadius = cornerRadius
|
layer.cornerRadius = cornerRadius
|
||||||
backgroundImageView.layer.cornerRadius = 8
|
backgroundImageView.layer.cornerRadius = cornerRadius
|
||||||
highlightView.layer.cornerRadius = 8
|
highlightView.layer.cornerRadius = cornerRadius
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +195,7 @@ open class TileContainer: Control {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Configuration
|
// MARK: - Configuration
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private let cornerRadius = 8.0
|
private let cornerRadius = VDSFormControls.borderradius * 2
|
||||||
|
|
||||||
private var backgroundColorConfig = BackgroundColorConfiguration()
|
private var backgroundColorConfig = BackgroundColorConfiguration()
|
||||||
|
|
||||||
@ -262,7 +263,7 @@ open class TileContainer: Control {
|
|||||||
}
|
}
|
||||||
|
|
||||||
layer.borderColor = borderColorConfig.getColor(self).cgColor
|
layer.borderColor = borderColorConfig.getColor(self).cgColor
|
||||||
layer.borderWidth = showBorder ? 1 : 0
|
layer.borderWidth = showBorder ? VDSFormControls.widthBorder : 0
|
||||||
|
|
||||||
containerTopConstraint?.constant = padding
|
containerTopConstraint?.constant = padding
|
||||||
containerLeadingConstraint?.constant = padding
|
containerLeadingConstraint?.constant = padding
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import VDSFormControlsTokens
|
||||||
|
|
||||||
extension UIView {
|
extension UIView {
|
||||||
public func pin(_ view: UIView, with edges: UIEdgeInsets = UIEdgeInsets.zero) {
|
public func pin(_ view: UIView, with edges: UIEdgeInsets = UIEdgeInsets.zero) {
|
||||||
@ -122,7 +123,7 @@ extension UIView {
|
|||||||
public func debugBorder(show shouldShow: Bool = true, color: UIColor = .red) {
|
public func debugBorder(show shouldShow: Bool = true, color: UIColor = .red) {
|
||||||
if shouldShow {
|
if shouldShow {
|
||||||
layer.borderColor = color.cgColor
|
layer.borderColor = color.cgColor
|
||||||
layer.borderWidth = 1
|
layer.borderWidth = VDSFormControls.widthBorder
|
||||||
} else {
|
} else {
|
||||||
layer.borderColor = UIColor.clear.cgColor
|
layer.borderColor = UIColor.clear.cgColor
|
||||||
layer.borderWidth = 0
|
layer.borderWidth = 0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user