forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFloatingBarNotificationCardLead.swift
More file actions
65 lines (61 loc) · 2.25 KB
/
Copy pathFloatingBarNotificationCardLead.swift
File metadata and controls
65 lines (61 loc) · 2.25 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
58
59
60
61
62
63
64
65
import OmiTheme
import SwiftUI
/// Lead of the generic floating-bar notification card: kind glyph plus the
/// category-aware copy stack. Extracted so `FloatingControlBarView` does not
/// grow past the product-file line-count freeze while the title/body layout
/// learns not to shout the Settings category louder than the actual content.
struct FloatingBarNotificationCardLead: View {
let copy: ProactiveNotificationCopy.CardLines
var messageLineLimit: Int = 3
var footer: String? = nil
var body: some View {
HStack(alignment: .top, spacing: OmiSpacing.md) {
ZStack {
RoundedRectangle(cornerRadius: 13, style: .continuous)
.fill(
LinearGradient(
colors: [Color.white.opacity(0.18), Color.white.opacity(0.08)],
startPoint: .top,
endPoint: .bottom
)
)
.overlay(
RoundedRectangle(cornerRadius: 13, style: .continuous)
.strokeBorder(Color.white.opacity(0.12), lineWidth: 1)
)
.frame(width: 44, height: 44)
Image(systemName: copy.systemImage)
.font(.system(size: 18, weight: .semibold))
.foregroundColor(.white)
}
VStack(alignment: .leading, spacing: 3) {
if let caption = copy.caption {
Text(caption)
.scaledFont(size: OmiType.caption, weight: .semibold)
.foregroundColor(.white.opacity(0.5))
.lineLimit(1)
}
Text(copy.heading)
.scaledFont(size: OmiType.subheading, weight: .semibold)
.foregroundColor(.white)
.lineLimit(copy.detail == nil ? 3 : 1)
.multilineTextAlignment(.leading)
.fixedSize(horizontal: false, vertical: true)
if let detail = copy.detail, !detail.isEmpty {
Text(detail)
.scaledFont(size: OmiType.body)
.foregroundColor(.white.opacity(0.78))
.lineLimit(messageLineLimit)
.lineSpacing(1.5)
.fixedSize(horizontal: false, vertical: true)
}
if let footer, !footer.isEmpty {
Text(footer)
.scaledFont(size: OmiType.micro, weight: .medium)
.foregroundColor(.white.opacity(0.45))
.lineLimit(1)
}
}
}
}
}