blob: d40640e1fd4f67a38b90cda437298cdb2a55f2c8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import SwiftUI
struct RecentSearchSuggestions: View {
let title: String
let entries: [ScopedSearchHistoryEntry]
let onSelect: (String) -> Void
let onClear: () -> Void
var body: some View {
if !entries.isEmpty {
Section(title) {
ForEach(entries) { entry in
Button {
onSelect(entry.query)
} label: {
Label(entry.query, systemImage: "clock.arrow.circlepath")
}
}
Button("Clear Recent Searches", role: .destructive) {
onClear()
}
}
}
}
}
|