Initial project setup - Phases 1-3 complete
This commit is contained in:
34
UI/SharedComponents/FilterChipsView.swift
Normal file
34
UI/SharedComponents/FilterChipsView.swift
Normal file
@@ -0,0 +1,34 @@
|
||||
import SwiftUI
|
||||
|
||||
struct FilterChip: Identifiable {
|
||||
let id = UUID()
|
||||
let label: String
|
||||
var isSelected: Bool = false
|
||||
}
|
||||
|
||||
struct FilterChipsView: View {
|
||||
@Binding var chips: [FilterChip]
|
||||
|
||||
var body: some View {
|
||||
ScrollView(.horizontal, showsIndicators: false) {
|
||||
HStack(spacing: 8) {
|
||||
ForEach($chips) { $chip in
|
||||
Button {
|
||||
chip.isSelected.toggle()
|
||||
} label: {
|
||||
Text(chip.label)
|
||||
.font(.caption.weight(.medium))
|
||||
.padding(.horizontal, 12)
|
||||
.padding(.vertical, 6)
|
||||
.background(
|
||||
chip.isSelected ? Color.accentColor : Color(.systemGray5),
|
||||
in: Capsule()
|
||||
)
|
||||
.foregroundStyle(chip.isSelected ? .white : .primary)
|
||||
}
|
||||
}
|
||||
}
|
||||
.padding(.horizontal)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user