adding tint color to modal templates
Signed-off-by: Jarrod Courtney <jarrod.courtney@verizon.com>
This commit is contained in:
parent
2fd4f3552f
commit
30d715d9ba
@ -28,7 +28,7 @@ open class ModalMoleculeListTemplate: MoleculeListTemplate {
|
||||
override open func handleNewData() {
|
||||
super.handleNewData()
|
||||
|
||||
closeButton = MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: { [weak self] _ in
|
||||
closeButton = MVMCoreUICommonViewsUtility.addCloseButton(to: view, tintColor: self.pageModel?.navigationBar?.tintColor.uiColor, action: { [weak self] _ in
|
||||
guard let self = self else { return }
|
||||
let closeAction = (self.templateModel as? ModalListPageTemplateModel)?.closeAction ??
|
||||
ActionBackModel()
|
||||
|
||||
@ -25,7 +25,8 @@ open class ModalMoleculeStackTemplate: MoleculeStackTemplate {
|
||||
|
||||
override open func handleNewData() {
|
||||
super.handleNewData()
|
||||
_ = MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: { [weak self] _ in
|
||||
|
||||
_ = MVMCoreUICommonViewsUtility.addCloseButton(to: view, tintColor: self.pageModel?.navigationBar?.tintColor.uiColor, action: { [weak self] _ in
|
||||
guard let self = self else { return }
|
||||
let closeAction = (self.templateModel as? ModalStackPageTemplateModel)?.closeAction ??
|
||||
ActionBackModel()
|
||||
|
||||
@ -23,7 +23,7 @@ open class ModalSectionListTemplate: SectionListTemplate {
|
||||
|
||||
override open func updateUI(for molecules: [MoleculeModelProtocol]? = nil) {
|
||||
super.updateUI(for: molecules)
|
||||
_ = MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: { [weak self] _ in
|
||||
_ = MVMCoreUICommonViewsUtility.addCloseButton(to: view, tintColor: self.pageModel?.navigationBar?.tintColor.uiColor, action: { [weak self] _ in
|
||||
guard let self = self else { return }
|
||||
let closeAction = (self.templateModel as? ModalSectionListTemplateModel)?.closeAction ??
|
||||
ActionBackModel()
|
||||
|
||||
@ -11,12 +11,12 @@ import Foundation
|
||||
public extension MVMCoreUICommonViewsUtility {
|
||||
|
||||
/// Add the close button (x) to the top right of the view. TODO: update this logic.
|
||||
@objc static func addCloseButton(to view: UIView, action: @escaping ButtonAction, centeredVertically: Bool = false) -> Button {
|
||||
@objc static func addCloseButton(to view: UIView, tintColor: UIColor? = .black, action: @escaping ButtonAction, centeredVertically: Bool = false) -> Button {
|
||||
let button = Button()
|
||||
if let image = MVMCoreUIUtility.imageNamed("nav_close")?.withRenderingMode(.alwaysTemplate) {
|
||||
button.setImage(image, for: .normal)
|
||||
}
|
||||
button.tintColor = .black
|
||||
button.tintColor = tintColor
|
||||
button.accessibilityLabel = MVMCoreUIUtility.hardcodedString(withKey: "AccCloseButton")
|
||||
button.addActionBlock(event: .touchUpInside, action)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user