Comments (fixes #4)

This commit is contained in:
Arkadiusz Fal
2021-12-04 20:35:41 +01:00
parent eb537676e6
commit 19a3f08336
29 changed files with 688 additions and 68 deletions

View File

@@ -6,6 +6,12 @@ struct SearchTextField: View {
@EnvironmentObject<RecentsModel> private var recents
@EnvironmentObject<SearchModel> private var state
@Binding var favoriteItem: FavoriteItem?
init(favoriteItem: Binding<FavoriteItem?>? = nil) {
_favoriteItem = favoriteItem ?? .constant(nil)
}
var body: some View {
ZStack {
#if os(macOS)
@@ -37,7 +43,14 @@ struct SearchTextField: View {
.padding(.leading)
.padding(.trailing, 15)
#endif
if !self.state.queryText.isEmpty {
#if os(iOS)
FavoriteButton(item: favoriteItem)
.id(favoriteItem?.id)
.labelStyle(.iconOnly)
.padding(.trailing)
#endif
clearButton
}
}

View File

@@ -42,7 +42,7 @@ struct SearchView: View {
PlayerControlsView {
#if os(iOS)
VStack {
SearchTextField()
SearchTextField(favoriteItem: $favoriteItem)
if state.query.query != state.queryText, !state.queryText.isEmpty, !state.querySuggestions.collection.isEmpty {
SearchSuggestions()
@@ -93,15 +93,6 @@ struct SearchView: View {
.transaction { t in t.animation = .none }
}
#if os(iOS)
Spacer()
FavoriteButton(item: favoriteItem)
.id(favoriteItem?.id)
Spacer()
#endif
if accounts.app.supportsSearchFilters {
filtersMenu
}