Skip to content

Commit

Permalink
test: 💍 update search testcase for background color (#700)
Browse files Browse the repository at this point in the history
Also to configure navigation bar title theming

Co-authored-by: David Xu <dyongxu@gmail.com>
  • Loading branch information
dyongxu and davxu authored Jun 6, 2024
1 parent c5b4586 commit 1962c68
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import SwiftUI
struct SearchFontAndColor: View {
@State private var queryString = ""

// Update Navigation Bar Title Appearance
init() {
UINavigationBar.appearance().largeTitleTextAttributes = [.font: UIFont.preferredFioriFont(forTextStyle: .largeTitle)]
UINavigationBar.appearance().titleTextAttributes = [.font: UIFont.preferredFioriFont(forTextStyle: .title3)]
}

// following code demonstrate a workaround for styling search bar
// font and test color
// reference issue: https://developer.apple.com/forums/thread/709773
Expand All @@ -12,14 +18,18 @@ struct SearchFontAndColor: View {
List(ColorEntity.filterColors(self.queryString)) { color in
Text(color.name)
.foregroundColor(color.fioriColor)
.font(.fiori(forTextStyle: .body))
.font(.fiori(forTextStyle: .footnote))
}
.navigationTitle("Colors")
.font(.fiori(forTextStyle: .title1))
}
.searchable(text: self.$queryString, prompt: "Color name")
.navigationBarTitleDisplayMode(.inline)
.foregroundColor(.preferredColor(.red5))
.font(.fiori(forTextStyle: .title3))
.onAppear {
UISearchTextField.appearance().backgroundColor = UIColor(Color.preferredColor(.blue1))
}
}
}

Expand Down

0 comments on commit 1962c68

Please sign in to comment.