DFCoupleMiniCard.swift
1.38 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
//
// DFCoupleMiniCard.swift
// hippo-watch-extension
//
import SwiftUI
struct DFCoupleMiniCard: View {
let name: String
let status: DFStressStatus
let value: String
let themeImage: Image?
let title: String?
init(
name: String,
status: DFStressStatus,
value: String,
themeImage: Image? = nil,
title: String? = nil
) {
self.name = name
self.status = status
self.value = value
self.themeImage = themeImage
self.title = title
}
var body: some View {
HStack(spacing: 5) {
DFStatusOrb(status: status, value: "", themeImage: themeImage)
.frame(width: 30, height: 30)
VStack(alignment: .leading, spacing: 1) {
Text(title ?? status.title)
.font(.system(size: 10, weight: .semibold))
.foregroundStyle(status.color)
.lineLimit(1)
.minimumScaleFactor(0.7)
Text(name)
.font(.system(size: 8, weight: .medium))
.foregroundStyle(.white)
.lineLimit(1)
Text(value)
.font(.system(size: 8, weight: .regular))
.foregroundStyle(.white.opacity(0.78))
}
}
.frame(maxWidth: .infinity, alignment: .leading)
}
}