-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAlarmTimeLineView.swift
41 lines (38 loc) · 1.38 KB
/
AlarmTimeLineView.swift
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
//
// AlarmTimeLineView.swift
// Lucify (iOS)
//
// Created by Patrick Elfert on 16.06.22.
//
import SwiftUI
struct AlarmTimeLineView: View {
@Binding var runningAlarms: [LDAlarm]
var body: some View {
VStack(spacing: 5) {
ForEach(runningAlarms) {
alarm in
VStack(alignment: .leading, spacing: 5) {
HStack {
VStack {
Image(systemName: runningAlarms.last?.id == alarm.id ? "sun.and.horizon.fill" : "moon.stars.fill")
}.frame(width: 40, height: 40).background(Primary).cornerRadius(5)
Text(alarm.date.toString(.custom("hh:mm a"))!).fontWeight(.semibold)
}
if runningAlarms.last?.id != alarm.id {
VStack(alignment: .center) {
Rectangle()
.frame(width: 5, height: 70)
.cornerRadius(5)
.foregroundColor(Primary).opacity(0.5)
}.frame(width: 40)
}
}
}
}
}
}
struct AlarmTimeLineView_Previews: PreviewProvider {
static var previews: some View {
AlarmTimeLineView(runningAlarms: .constant([LDAlarm(fromNow: 9.hours), LDAlarm(fromNow: 6.hours)]))
}
}