mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 13:33:42 +00:00
Search improvements
This commit is contained in:
parent
e3daa738ce
commit
784fc8cfc6
@ -30,16 +30,10 @@ struct SearchSuggestions: View {
|
||||
HStack {
|
||||
Image(systemName: "magnifyingglass")
|
||||
HStack(spacing: 0) {
|
||||
if suggestion.hasPrefix(state.suggestionsText.lowercased()) {
|
||||
Text(state.suggestionsText.lowercased())
|
||||
.lineLimit(1)
|
||||
.layoutPriority(2)
|
||||
.foregroundColor(.secondary)
|
||||
}
|
||||
|
||||
Text(querySuffix(suggestion))
|
||||
Text(suggestion)
|
||||
.lineLimit(1)
|
||||
.layoutPriority(1)
|
||||
.truncationMode(.head)
|
||||
.frame(minWidth: 0, maxWidth: .infinity, alignment: .leading)
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
@ -90,10 +84,6 @@ struct SearchSuggestions: View {
|
||||
}
|
||||
}
|
||||
|
||||
private func querySuffix(_ suggestion: String) -> String {
|
||||
suggestion.replacingFirstOccurrence(of: state.suggestionsText.lowercased(), with: "")
|
||||
}
|
||||
|
||||
#if os(macOS)
|
||||
private func onHover(_ inside: Bool) {
|
||||
if inside {
|
||||
|
@ -33,8 +33,8 @@ struct SearchTextField: View {
|
||||
.textFieldStyle(.plain)
|
||||
#else
|
||||
.textFieldStyle(.roundedBorder)
|
||||
.padding(.leading, 5)
|
||||
.padding(.trailing, 10)
|
||||
.padding(.horizontal, 5)
|
||||
.padding(.trailing, state.queryText.isEmpty ? 0 : 10)
|
||||
#endif
|
||||
|
||||
if !state.queryText.isEmpty {
|
||||
|
@ -210,11 +210,13 @@ struct SearchView: View {
|
||||
Section {
|
||||
FavoriteButton(item: favoriteItem)
|
||||
}
|
||||
|
||||
} label: {
|
||||
Image(systemName: "chevron.down.circle.fill")
|
||||
.foregroundColor(.accentColor)
|
||||
.imageScale(.medium)
|
||||
HStack {
|
||||
Image(systemName: "magnifyingglass")
|
||||
Image(systemName: "chevron.down.circle.fill")
|
||||
}
|
||||
.foregroundColor(.accentColor)
|
||||
.imageScale(.medium)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user