refactored naming for enum
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
3b037d8443
commit
2ea6e9fb43
@ -38,14 +38,27 @@ open class TileContainer: Control {
|
||||
case transparent
|
||||
}
|
||||
|
||||
public enum ContainerPadding: String, Codable, EnumSubset {
|
||||
case spacing2X
|
||||
case spacing4X
|
||||
case spacing6X
|
||||
case spacing8X
|
||||
case spacing12X
|
||||
public enum ContainerPadding: String, Codable {
|
||||
case padding2X
|
||||
case padding4X
|
||||
case padding6X
|
||||
case padding8X
|
||||
case padding12X
|
||||
|
||||
public var defaultValue: VDSLayout.Spacing { .space4X }
|
||||
public var value: CGFloat {
|
||||
switch self {
|
||||
case .padding2X:
|
||||
return VDSLayout.Spacing.space2X.value
|
||||
case .padding4X:
|
||||
return VDSLayout.Spacing.space4X.value
|
||||
case .padding6X:
|
||||
return VDSLayout.Spacing.space6X.value
|
||||
case .padding8X:
|
||||
return VDSLayout.Spacing.space8X.value
|
||||
case .padding12X:
|
||||
return VDSLayout.Spacing.space12X.value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum ContainerScalingType: String, Codable, CaseIterable {
|
||||
@ -72,7 +85,7 @@ open class TileContainer: Control {
|
||||
|
||||
public var containerBackgroundColor: ContainerBackgroundColor = .white { didSet{ didChange() } }
|
||||
|
||||
public var containerPadding: ContainerPadding = .spacing4X { didSet{ didChange() } }
|
||||
public var containerPadding: ContainerPadding = .padding4X { didSet{ didChange() } }
|
||||
|
||||
public var aspectRatio: ContainerScalingType = .ratio1x1 { didSet{ didChange() } }
|
||||
|
||||
@ -153,13 +166,13 @@ open class TileContainer: Control {
|
||||
containerView.isUserInteractionEnabled = false
|
||||
containerView.backgroundColor = .clear
|
||||
|
||||
containerTopConstraint = containerView.topAnchor.constraint(equalTo: topAnchor, constant: containerPadding.value.doubleValue)
|
||||
containerTopConstraint = containerView.topAnchor.constraint(equalTo: topAnchor, constant: containerPadding.value)
|
||||
containerTopConstraint?.isActive = true
|
||||
containerBottomConstraint = containerView.bottomAnchor.constraint(equalTo: bottomAnchor, constant: containerPadding.value.doubleValue)
|
||||
containerBottomConstraint = containerView.bottomAnchor.constraint(equalTo: bottomAnchor, constant: containerPadding.value)
|
||||
containerBottomConstraint?.isActive = true
|
||||
containerLeadingConstraint = containerView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: containerPadding.value.doubleValue)
|
||||
containerLeadingConstraint = containerView.leadingAnchor.constraint(equalTo: leadingAnchor, constant: containerPadding.value)
|
||||
containerLeadingConstraint?.isActive = true
|
||||
containerTrailingConstraint = containerView.trailingAnchor.constraint(equalTo: trailingAnchor, constant: containerPadding.value.doubleValue)
|
||||
containerTrailingConstraint = containerView.trailingAnchor.constraint(equalTo: trailingAnchor, constant: containerPadding.value)
|
||||
containerTrailingConstraint?.isActive = true
|
||||
|
||||
highlightView.pinToSuperView()
|
||||
@ -252,10 +265,10 @@ open class TileContainer: Control {
|
||||
layer.borderColor = borderColorConfig.getColor(self).cgColor
|
||||
layer.borderWidth = showBorder ? VDSFormControls.widthBorder : 0
|
||||
|
||||
containerTopConstraint?.constant = containerPadding.value.doubleValue
|
||||
containerLeadingConstraint?.constant = containerPadding.value.doubleValue
|
||||
containerBottomConstraint?.constant = -containerPadding.value.doubleValue
|
||||
containerTrailingConstraint?.constant = -containerPadding.value.doubleValue
|
||||
containerTopConstraint?.constant = containerPadding.value
|
||||
containerLeadingConstraint?.constant = containerPadding.value
|
||||
containerBottomConstraint?.constant = -containerPadding.value
|
||||
containerTrailingConstraint?.constant = -containerPadding.value
|
||||
|
||||
if let width, aspectRatio == .none && height == nil{
|
||||
widthConstraint?.constant = width
|
||||
|
||||
@ -393,13 +393,13 @@ open class Tilet: TileContainer {
|
||||
extension TileContainer.ContainerPadding {
|
||||
fileprivate var tiletSpacing: CGFloat {
|
||||
switch self {
|
||||
case .spacing2X:
|
||||
case .padding2X:
|
||||
return 16
|
||||
case .spacing4X:
|
||||
case .padding4X:
|
||||
return 24
|
||||
case .spacing6X:
|
||||
case .padding6X:
|
||||
return 32
|
||||
case .spacing8X:
|
||||
case .padding8X:
|
||||
return 48
|
||||
default:
|
||||
return 16
|
||||
|
||||
@ -21,7 +21,7 @@ public struct VDSLayout {
|
||||
case space24X
|
||||
case space32X
|
||||
|
||||
public var doubleValue: Double {
|
||||
public var value: CGFloat {
|
||||
switch self {
|
||||
case .space1X:
|
||||
return 4
|
||||
|
||||
Loading…
Reference in New Issue
Block a user