summaryrefslogtreecommitdiffstats
path: root/Solsnu.Widget/Views/MediumWidgetView.swift
blob: 69bbbe27a0576e96ef37dd0aa87824566591c5b8 (plain) (blame)
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
import SwiftUI
import WidgetKit

struct MediumWidgetView: View {
    let entry: SolvervEntry

    var body: some View {
        HStack(spacing: 12) {
            VStack(alignment: .leading, spacing: 8) {
                Text("Season Event")
                    .font(.headline)
                    .lineLimit(1)

                Text("\(entry.def.daysUntilNext()) days")
                    .font(.system(.title3, design: .default).weight(.semibold))

                ProgressView(value: Double(entry.def.progressRatio()))

                if !entry.def.sunriseFormatted.isEmpty && !entry.def.sunsetFormatted.isEmpty {
                    HStack {
                        Text("Sunrise: \(entry.def.sunriseFormatted)")
                        Spacer()
                        Text("Sunset: \(entry.def.sunsetFormatted)")
                    }
                    .font(.system(size: 12, weight: .regular))
                    .foregroundStyle(Color(red: 0.152, green: 0.136, blue: 0.056))
                }

                Spacer()
            }

            Spacer()
        }
        .padding()
    }
}