fix: file was not added to git
This commit is contained in:
58
MindDump/Views/FilterChipBar.swift
Normal file
58
MindDump/Views/FilterChipBar.swift
Normal file
@@ -0,0 +1,58 @@
|
||||
import SwiftUI
|
||||
|
||||
struct FilterChipBar: View {
|
||||
@Binding var filterUrgent: Bool
|
||||
@Binding var filterDue: Bool
|
||||
@Binding var selectedSort: ListDetailSort
|
||||
|
||||
var body: some View {
|
||||
HStack(spacing: 12) {
|
||||
chipButton(icon: "exclamationmark.triangle", isActive: filterUrgent, color: .orange) {
|
||||
withAnimation { filterUrgent.toggle() }
|
||||
}
|
||||
chipButton(icon: "calendar.badge.clock", isActive: filterDue, color: .red) {
|
||||
withAnimation { filterDue.toggle() }
|
||||
}
|
||||
sortMenu
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
.listRowInsets(EdgeInsets(top: 8, leading: 16, bottom: 8, trailing: 16))
|
||||
.listRowBackground(Color.clear)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
private func chipButton(icon: String, isActive: Bool, color: Color, action: @escaping () -> Void) -> some View {
|
||||
Button(action: action) {
|
||||
Image(systemName: icon)
|
||||
.font(.subheadline.weight(.medium))
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.vertical, 6)
|
||||
.background(isActive ? color.opacity(0.15) : Color(.systemGray6))
|
||||
.foregroundStyle(isActive ? color : .secondary)
|
||||
.clipShape(Capsule())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
|
||||
private var sortMenu: some View {
|
||||
Menu {
|
||||
Picker("Sortierung", selection: $selectedSort) {
|
||||
ForEach(ListDetailSort.allCases, id: \.self) { sort in
|
||||
Text(sort.label).tag(sort)
|
||||
}
|
||||
}
|
||||
} label: {
|
||||
HStack(spacing: 4) {
|
||||
Image(systemName: "arrow.up.arrow.down")
|
||||
ZStack(alignment: .leading) {
|
||||
ForEach(ListDetailSort.allCases, id: \.self) { sort in
|
||||
Text(sort.shortLabel)
|
||||
.opacity(sort == selectedSort ? 1 : 0)
|
||||
}
|
||||
}
|
||||
}
|
||||
.font(.subheadline)
|
||||
.foregroundStyle(.secondary)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user