-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathSafetyViewFilterScrollView.swift
More file actions
57 lines (53 loc) · 2.17 KB
/
SafetyViewFilterScrollView.swift
File metadata and controls
57 lines (53 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//
// SafetyViewFilterScrollView.swift
// berkeley-mobile
//
// Created by Justin Wong on 9/4/25.
// Copyright © 2025 ASUC OCTO. All rights reserved.
//
import SwiftUI
struct SafetyViewFilterScrollView: View {
@EnvironmentObject var safetyViewModel: SafetyViewModel
@Binding var drawerViewState: BMDrawerViewState
var body: some View {
ScrollView(.horizontal) {
HStack {
ForEach(safetyViewModel.selectedSafetyLogFilterStates, id: \.id) { filterState in
HStack {
Text(filterState.rawValue.capitalized)
.font(Font(BMFont.regular(16)))
.foregroundStyle(.white)
Button(action: {
withAnimation {
if let removeIndex = safetyViewModel.selectedSafetyLogFilterStates.firstIndex(of: filterState) {
safetyViewModel.selectedSafetyLogFilterStates.remove(at: removeIndex)
drawerViewState = .small
}
}
}) {
Image(systemName: "xmark.circle.fill")
.font(.system(size: 14))
.modify {
if #available(iOS 26.0, *) {
$0.foregroundStyle(.white)
} else {
$0.foregroundStyle(.regularMaterial)
}
}
}
}
.padding(8)
.modify {
if #available(iOS 26.0, *) {
$0.glassEffect(.regular.tint(.gray).interactive(), in: .capsule)
} else {
$0.background(.gray.opacity(0.6))
$0.clipShape(.capsule)
}
}
}
}
}
.scrollIndicators(.hidden)
}
}