From da3b1d53c82ed84275f357efd44e027c2498cb9b Mon Sep 17 00:00:00 2001 From: Fernando Bunn Date: Wed, 27 Nov 2024 17:17:55 -0300 Subject: [PATCH] Improve navigation bar --- DuckDuckGo/AIChat/AIChatViewController.swift | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/DuckDuckGo/AIChat/AIChatViewController.swift b/DuckDuckGo/AIChat/AIChatViewController.swift index a02ad8a0cf..39e7c43857 100644 --- a/DuckDuckGo/AIChat/AIChatViewController.swift +++ b/DuckDuckGo/AIChat/AIChatViewController.swift @@ -31,23 +31,35 @@ final class AIChatViewController: UIViewController { } private func setupNavigationBar() { - let imageView = UIImageView(image: UIImage(systemName: "globe")) + let imageView = UIImageView(image: UIImage(named: "Logo")) imageView.contentMode = .scaleAspectFit + imageView.translatesAutoresizingMaskIntoConstraints = false + + let imageSize: CGFloat = 32 + NSLayoutConstraint.activate([ + imageView.widthAnchor.constraint(equalToConstant: imageSize), + imageView.heightAnchor.constraint(equalToConstant: imageSize) + ]) let titleLabel = UILabel() titleLabel.text = UserText.aiChatTitle - titleLabel.font = UIFont.systemFont(ofSize: 17, weight: .semibold) let stackView = UIStackView(arrangedSubviews: [imageView, titleLabel]) stackView.axis = .horizontal stackView.spacing = 8 - stackView.alignment = .leading + stackView.alignment = .center stackView.distribution = .fill let leftBarButtonItem = UIBarButtonItem(customView: stackView) navigationItem.leftBarButtonItem = leftBarButtonItem - let closeButton = UIBarButtonItem(barButtonSystemItem: .close, target: self, action: #selector(closeButtonTapped)) + let closeButton = UIBarButtonItem( + image: UIImage(named: "Close-24")!, + style: .plain, + target: self, + action: #selector(closeButtonTapped) + ) + closeButton.tintColor = .label navigationItem.rightBarButtonItem = closeButton }