added highlight view

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2022-12-19 10:03:49 -06:00
parent 2fca1a9a7f
commit 9150a62e57

View File

@ -45,6 +45,8 @@ open class TileContainer: Control {
public var containerView = View()
public var highlightView = View()
public var containerBackgroundColor: ContainerBackgroundColor = .white { didSet{ didChange() } }
public var containerPadding: ContainerPadding = .sixteen { didSet{ didChange() } }
@ -114,13 +116,19 @@ open class TileContainer: Control {
super.setup()
addSubview(backgroundImageView)
addSubview(containerView)
addSubview(highlightView)
backgroundImageView.pinToSuperView()
backgroundImageView.isUserInteractionEnabled = false
backgroundImageView.isHidden = true
containerView.pinToSuperView()
containerView.isUserInteractionEnabled = false
containerView.backgroundColor = .clear
highlightView.pinToSuperView()
highlightView.isUserInteractionEnabled = false
highlightView.isHidden = true
highlightView.backgroundColor = .clear
layer.cornerRadius = cornerRadius
}
@ -146,6 +154,11 @@ open class TileContainer: Control {
$0.lightColor = VDSColor.backgroundPrimaryLight
$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
@ -180,6 +193,9 @@ open class TileContainer: Control {
open override func updateView() {
super.updateView()
highlightView.backgroundColor = hightLightViewColorConfig.getColor(self)
highlightView.isHidden = !isHighlighted
if let backgroundImage {
backgroundImageView.image = backgroundImage
backgroundImageView.isHidden = false