Skip to content

Commit 8b32428

Browse files
authored
govukapp-1295: gray squares when button shapes on (#300)
* Use filled() button config with clear background to prevent colour change when buttons shapes is on * Make sure AppErrorView is hidden when search loads. Hide App error view button if no title (this is what was causing grey square)
1 parent b9abf79 commit 8b32428

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

GOVKit/Sources/GOVKit/SwiftUIViews/AppErrorView.swift

+1
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,6 @@ public struct AppErrorView: View {
5252
? String.common.localized("openWebLinkHint")
5353
: ""
5454
)
55+
.opacity(viewModel?.buttonTitle == nil ? 0 : 1)
5556
}
5657
}

Production/govuk_ios/ViewControllers/SearchHistoryViewController.swift

+3-2
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,12 @@ final class SearchHistoryViewController: BaseViewController {
6161
}()
6262

6363
private lazy var deleteButton: UIButton = {
64-
var configuration = UIButton.Configuration.plain()
64+
var configuration = UIButton.Configuration.filled()
6565
configuration.contentInsets = .zero
6666
configuration.titleAlignment = .trailing
67+
configuration.baseForegroundColor = UIColor.govUK.text.link
68+
configuration.baseBackgroundColor = .clear
6769
let button = UIButton(configuration: configuration)
68-
button.tintColor = UIColor.govUK.text.link
6970
button.setTitle(String.search.localized("clearHistoryButtonTitle"), for: .normal)
7071
button.titleLabel?.font = UIFont.govUK.body
7172
button.titleLabel?.adjustsFontForContentSizeCategory = true

Production/govuk_ios/ViewControllers/SearchViewController.swift

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class SearchViewController: BaseViewController,
2121
localView.showsVerticalScrollIndicator = false
2222
localView.contentInsetAdjustmentBehavior = .always
2323
localView.backgroundColor = .govUK.fills.surfaceModal
24+
localView.isHidden = true
2425
return localView
2526
}()
2627

Production/govuk_ios/Views/Search/SearchHistoryCell.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import UIComponents
33

44
class SearchHistoryCell: UITableViewCell {
55
private let deleteButton: UIButton = {
6-
var buttonConfig = UIButton.Configuration.plain()
6+
var buttonConfig = UIButton.Configuration.filled()
77
buttonConfig.image = UIImage(systemName: "xmark")
88
buttonConfig.baseForegroundColor = UIColor.govUK.text.trailingIcon
9+
buttonConfig.baseBackgroundColor = .clear
910
buttonConfig.contentInsets = .zero
1011

1112
let imageConfig = UIImage.SymbolConfiguration(pointSize: 12, weight: .semibold)

0 commit comments

Comments
 (0)