| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- // LoopFollow
- // AddAlarmSheet.swift
- import SwiftUI
- struct AddAlarmSheet: View {
- let onSelect: (AlarmType) -> Void
- @Environment(\.dismiss) private var dismiss
- private let columns = [
- GridItem(.adaptive(minimum: 110), spacing: 16),
- ]
- var body: some View {
- NavigationStack {
- ScrollView {
- LazyVGrid(columns: columns, spacing: 16) {
- ForEach(AlarmType.Group.allCases, id: \.self) { group in
- if AlarmType.allCases.contains(where: { $0.group == group }) {
- Section(header: Text(group.rawValue)
- .font(.headline)
- .frame(maxWidth: .infinity, alignment: .leading)
- .padding(.horizontal, 4)
- ) {
- ForEach(AlarmType.allCases.filter { $0.group == group }, id: \.self) { type in
- AlarmTile(type: type) {
- onSelect(type)
- }
- }
- }
- }
- }
- }
- .padding()
- }
- .navigationTitle("Add Alarm")
- .toolbar {
- ToolbarItem(placement: .cancellationAction) {
- Button("Cancel") { dismiss() }
- }
- }
- }
- .preferredColorScheme(Storage.shared.appearanceMode.value.colorScheme)
- }
- }
|