From 9150a62e57133102f49148ef4b0c7159f9a4b61f Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Mon, 19 Dec 2022 10:03:49 -0600 Subject: [PATCH] added highlight view Signed-off-by: Matt Bruce --- .../TileContainer/TileContainer.swift | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/VDS/Components/TileContainer/TileContainer.swift b/VDS/Components/TileContainer/TileContainer.swift index 91af8cbc..98a61649 100644 --- a/VDS/Components/TileContainer/TileContainer.swift +++ b/VDS/Components/TileContainer/TileContainer.swift @@ -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