|
|
@@ -230,28 +230,13 @@ struct DictionaryView: View {
|
|
|
|
|
|
private var recentSearchesSection: some View {
|
|
|
VStack(alignment: .leading, spacing: 10) {
|
|
|
- Text("Recent Searches")
|
|
|
+ Text("Recent Search")
|
|
|
.font(.system(size: 13, weight: .semibold))
|
|
|
.foregroundStyle(AppTheme.textSecondary)
|
|
|
|
|
|
- LazyVGrid(
|
|
|
- columns: [GridItem(.adaptive(minimum: 72), spacing: 8)],
|
|
|
- alignment: .leading,
|
|
|
- spacing: 8
|
|
|
- ) {
|
|
|
- ForEach(viewModel.recentSearches, id: \.self) { word in
|
|
|
- Button {
|
|
|
- viewModel.lookUpRecent(word)
|
|
|
- } label: {
|
|
|
- Text(word)
|
|
|
- .font(.system(size: 13, weight: .medium))
|
|
|
- .foregroundStyle(AppTheme.teal)
|
|
|
- .padding(.horizontal, 12)
|
|
|
- .padding(.vertical, 7)
|
|
|
- .background(AppTheme.tealLight)
|
|
|
- .clipShape(Capsule())
|
|
|
- }
|
|
|
- .buttonStyle(.plain)
|
|
|
+ if let latestSearch = viewModel.recentSearches.first {
|
|
|
+ ToolbarButton(title: latestSearch, iconName: "clock") {
|
|
|
+ viewModel.lookUpRecent(latestSearch)
|
|
|
}
|
|
|
}
|
|
|
}
|