From 308b9b56ee75f15a50284391f293074bbacccc43 Mon Sep 17 00:00:00 2001 From: Paul Date: Mon, 16 Feb 2026 14:05:06 +0100 Subject: [PATCH] fix: file was not added to git --- MindDump/Views/FilterChipBar.swift | 58 ++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 MindDump/Views/FilterChipBar.swift diff --git a/MindDump/Views/FilterChipBar.swift b/MindDump/Views/FilterChipBar.swift new file mode 100644 index 0000000..720ec91 --- /dev/null +++ b/MindDump/Views/FilterChipBar.swift @@ -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) + } + } +}