added highlight view
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
2fca1a9a7f
commit
9150a62e57
@ -45,6 +45,8 @@ open class TileContainer: Control {
|
|||||||
|
|
||||||
public var containerView = View()
|
public var containerView = View()
|
||||||
|
|
||||||
|
public var highlightView = View()
|
||||||
|
|
||||||
public var containerBackgroundColor: ContainerBackgroundColor = .white { didSet{ didChange() } }
|
public var containerBackgroundColor: ContainerBackgroundColor = .white { didSet{ didChange() } }
|
||||||
|
|
||||||
public var containerPadding: ContainerPadding = .sixteen { didSet{ didChange() } }
|
public var containerPadding: ContainerPadding = .sixteen { didSet{ didChange() } }
|
||||||
@ -114,13 +116,19 @@ open class TileContainer: Control {
|
|||||||
super.setup()
|
super.setup()
|
||||||
addSubview(backgroundImageView)
|
addSubview(backgroundImageView)
|
||||||
addSubview(containerView)
|
addSubview(containerView)
|
||||||
|
addSubview(highlightView)
|
||||||
backgroundImageView.pinToSuperView()
|
backgroundImageView.pinToSuperView()
|
||||||
|
backgroundImageView.isUserInteractionEnabled = false
|
||||||
backgroundImageView.isHidden = true
|
backgroundImageView.isHidden = true
|
||||||
|
|
||||||
containerView.pinToSuperView()
|
containerView.pinToSuperView()
|
||||||
|
containerView.isUserInteractionEnabled = false
|
||||||
containerView.backgroundColor = .clear
|
containerView.backgroundColor = .clear
|
||||||
|
|
||||||
|
highlightView.pinToSuperView()
|
||||||
|
highlightView.isUserInteractionEnabled = false
|
||||||
|
highlightView.isHidden = true
|
||||||
|
highlightView.backgroundColor = .clear
|
||||||
layer.cornerRadius = cornerRadius
|
layer.cornerRadius = cornerRadius
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -146,6 +154,11 @@ open class TileContainer: Control {
|
|||||||
$0.lightColor = VDSColor.backgroundPrimaryLight
|
$0.lightColor = VDSColor.backgroundPrimaryLight
|
||||||
$0.darkColor = VDSColor.backgroundPrimaryDark
|
$0.darkColor = VDSColor.backgroundPrimaryDark
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var hightLightViewColorConfig = SurfaceColorConfiguration().with {
|
||||||
|
$0.lightColor = VDSColor.paletteWhite.withAlphaComponent(0.3)
|
||||||
|
$0.darkColor = VDSColor.paletteBlack.withAlphaComponent(0.3)
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - State
|
// MARK: - State
|
||||||
@ -180,6 +193,9 @@ open class TileContainer: Control {
|
|||||||
open override func updateView() {
|
open override func updateView() {
|
||||||
super.updateView()
|
super.updateView()
|
||||||
|
|
||||||
|
highlightView.backgroundColor = hightLightViewColorConfig.getColor(self)
|
||||||
|
highlightView.isHidden = !isHighlighted
|
||||||
|
|
||||||
if let backgroundImage {
|
if let backgroundImage {
|
||||||
backgroundImageView.image = backgroundImage
|
backgroundImageView.image = backgroundImage
|
||||||
backgroundImageView.isHidden = false
|
backgroundImageView.isHidden = false
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user