52 lines
1.7 KiB
Swift
52 lines
1.7 KiB
Swift
import SwiftUI
|
|
|
|
struct LeadResultsSection: View {
|
|
let leads: [Lead]
|
|
let columns: [GridItem]
|
|
@Binding var selection: LeadOverviewSelection
|
|
let cardMotion: Namespace.ID
|
|
let isBusy: Bool
|
|
let onOpen: (Lead) -> Void
|
|
let onBookmark: (Lead) -> Void
|
|
|
|
var body: some View {
|
|
VStack(alignment: .leading, spacing: 14) {
|
|
ViewThatFits(in: .horizontal) {
|
|
HStack {
|
|
heading
|
|
Spacer(minLength: 20)
|
|
picker.frame(width: 300)
|
|
}
|
|
VStack(alignment: .leading, spacing: 12) {
|
|
heading
|
|
picker
|
|
}
|
|
}
|
|
LeadCardGrid(columnCount: columns.count) {
|
|
ForEach(leads) { lead in
|
|
LeadCardView(lead: lead, isBusy: isBusy,
|
|
onOpen: { onOpen(lead) }, onBookmark: { onBookmark(lead) })
|
|
.matchedGeometryEffect(id: lead.isBookmarked ? "regular-\(lead.id)" : "flight-\(lead.id)",
|
|
in: cardMotion)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private var heading: some View {
|
|
HStack(alignment: .firstTextBaseline, spacing: 8) {
|
|
Text("Alle Interessenten").font(.title2.bold())
|
|
Text(leads.count, format: .number).foregroundStyle(.secondary)
|
|
}
|
|
}
|
|
|
|
private var picker: some View {
|
|
Picker("Sortierung und Filter", selection: $selection) {
|
|
ForEach(LeadOverviewSelection.allCases) { option in
|
|
Text(option.title).tag(option)
|
|
}
|
|
}
|
|
.pickerStyle(.segmented)
|
|
}
|
|
}
|